Skip to content

Commit 15edb2f

Browse files
author
timothy-symanczyk
committed
Improve error for token issue command without auth
Currently when you perform the 'token issue' command with the admin_token, the error is a nonsense python error. This commit changes it to be user-friendly. Change-Id: I5cc92c342e3f83e099354cd04301c7b8d8d2dabc Closes-Bug: #1547721
1 parent f9f6abe commit 15edb2f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

openstackclient/identity/v3/token.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import six
1919

2020
from openstackclient.common import command
21+
from openstackclient.common import exceptions
2122
from openstackclient.common import utils
2223
from openstackclient.identity import common
2324

@@ -172,6 +173,9 @@ def get_parser(self, prog_name):
172173
return parser
173174

174175
def take_action(self, parsed_args):
176+
if not self.app.client_manager.auth_ref:
177+
raise exceptions.AuthorizationFailure(
178+
"Only an authorized user may issue a new token.")
175179
token = self.app.client_manager.auth_ref.service_catalog.get_token()
176180
if 'tenant_id' in token:
177181
token['project_id'] = token.pop('tenant_id')

0 commit comments

Comments
 (0)