diff options
| author | guang-yee <guang.yee@hpe.com> | 2016-02-08 11:16:24 -0800 |
|---|---|---|
| committer | guang-yee <guang.yee@hpe.com> | 2016-02-19 16:07:13 -0800 |
| commit | 41e1bd0be64e15a5e0c12b45bdf3dcde5fabf244 (patch) | |
| tree | 0d5f55b0495c3208f981b7a180619d8d6b02d3a2 /openstackclient/identity | |
| parent | ab6ba385a2c292a7a906390ad911db8c59811a07 (diff) | |
| download | python-openstackclient-41e1bd0be64e15a5e0c12b45bdf3dcde5fabf244.tar.gz | |
Support unscoped token request
Make scope check optional for the "token issue" command as unscoped token is
a valid Keystone V2/V3 API.
Change-Id: Ie1cded4dbfdafd3a78c0ebdf89e3f66762509930
Closes-Bug: #1543214
Diffstat (limited to 'openstackclient/identity')
| -rw-r--r-- | openstackclient/identity/v2_0/token.py | 6 | ||||
| -rw-r--r-- | openstackclient/identity/v3/token.py | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/openstackclient/identity/v2_0/token.py b/openstackclient/identity/v2_0/token.py index db38fae8..6a66a1c6 100644 --- a/openstackclient/identity/v2_0/token.py +++ b/openstackclient/identity/v2_0/token.py @@ -24,6 +24,9 @@ from openstackclient.i18n import _ # noqa class IssueToken(command.ShowOne): """Issue new token""" + # scoped token is optional + required_scope = False + def get_parser(self, prog_name): parser = super(IssueToken, self).get_parser(prog_name) return parser @@ -31,7 +34,8 @@ class IssueToken(command.ShowOne): def take_action(self, parsed_args): token = self.app.client_manager.auth_ref.service_catalog.get_token() - token['project_id'] = token.pop('tenant_id') + if 'tenant_id' in token: + token['project_id'] = token.pop('tenant_id') return zip(*sorted(six.iteritems(token))) diff --git a/openstackclient/identity/v3/token.py b/openstackclient/identity/v3/token.py index 9ebd1799..5f131939 100644 --- a/openstackclient/identity/v3/token.py +++ b/openstackclient/identity/v3/token.py @@ -164,6 +164,9 @@ class CreateRequestToken(command.ShowOne): class IssueToken(command.ShowOne): """Issue new token""" + # scoped token is optional + required_scope = False + def get_parser(self, prog_name): parser = super(IssueToken, self).get_parser(prog_name) return parser |
