diff options
| author | Jenkins <jenkins@review.openstack.org> | 2015-09-25 17:12:18 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2015-09-25 17:12:18 +0000 |
| commit | 5eaa52eae476ad1208b9156af558f6a4f4277119 (patch) | |
| tree | 4bf121b0aec09ebf14684f4a7e07decce5dfcff5 /glanceclient/shell.py | |
| parent | 6e7c64bd5b36119be6e58889afcebfae667e2343 (diff) | |
| parent | c31c1365573d10bd09afad47ca1974af3e50b5eb (diff) | |
| download | python-glanceclient-5eaa52eae476ad1208b9156af558f6a4f4277119.tar.gz | |
Merge "No auth when token and endpoint are passed"
Diffstat (limited to 'glanceclient/shell.py')
| -rwxr-xr-x | glanceclient/shell.py | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/glanceclient/shell.py b/glanceclient/shell.py index 7d3a49e..7534c91 100755 --- a/glanceclient/shell.py +++ b/glanceclient/shell.py @@ -443,18 +443,13 @@ class OpenStackImagesShell(object): return ks_session def _get_endpoint_and_token(self, args): - image_url = self._get_image_url(args) + endpoint = self._get_image_url(args) auth_token = args.os_auth_token - auth_reqd = (not (auth_token and image_url) or - (hasattr(args, 'func') and - utils.is_authentication_required(args.func))) - - if not auth_reqd: - endpoint = image_url - token = args.os_auth_token - else: + auth_req = (hasattr(args, 'func') and + utils.is_authentication_required(args.func)) + if auth_req and not (endpoint and auth_token): if not args.os_username: raise exc.CommandError( _("You must provide a username via" @@ -527,7 +522,7 @@ class OpenStackImagesShell(object): 'key': args.os_key } ks_session = self._get_keystone_session(**kwargs) - token = args.os_auth_token or ks_session.get_token() + auth_token = args.os_auth_token or ks_session.get_token() endpoint_type = args.os_endpoint_type or 'public' service_type = args.os_service_type or 'image' @@ -536,7 +531,7 @@ class OpenStackImagesShell(object): interface=endpoint_type, region_name=args.os_region_name) - return endpoint, token + return endpoint, auth_token def _get_versioned_client(self, api_version, args): endpoint, token = self._get_endpoint_and_token(args) |
