Skip to content

Commit a48de85

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Improve error for token issue command without auth"
2 parents 59ffee2 + 15edb2f commit a48de85

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)