summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-03-21 21:20:48 +0000
committerGerrit Code Review <review@openstack.org>2016-03-21 21:20:48 +0000
commita48de855d0df90efc127db61457a0adb1c32b532 (patch)
tree2a222b58e6d307fbe6c3a841becd74eb241723c3 /openstackclient
parent59ffee26a673ba6f217eb261359e69de32522c5d (diff)
parent15edb2f61a4d193c069dce903b29c391f04ba0b8 (diff)
downloadpython-openstackclient-a48de855d0df90efc127db61457a0adb1c32b532.tar.gz
Merge "Improve error for token issue command without auth"
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/identity/v3/token.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/openstackclient/identity/v3/token.py b/openstackclient/identity/v3/token.py
index bf039d2f..62a4c4a3 100644
--- a/openstackclient/identity/v3/token.py
+++ b/openstackclient/identity/v3/token.py
@@ -18,6 +18,7 @@
import six
from openstackclient.common import command
+from openstackclient.common import exceptions
from openstackclient.common import utils
from openstackclient.identity import common
@@ -172,6 +173,9 @@ class IssueToken(command.ShowOne):
return parser
def take_action(self, parsed_args):
+ if not self.app.client_manager.auth_ref:
+ raise exceptions.AuthorizationFailure(
+ "Only an authorized user may issue a new token.")
token = self.app.client_manager.auth_ref.service_catalog.get_token()
if 'tenant_id' in token:
token['project_id'] = token.pop('tenant_id')