summaryrefslogtreecommitdiff
path: root/glanceclient/shell.py
diff options
context:
space:
mode:
authorNiall Bunting <niall.bunting@hpe.com>2016-05-09 16:23:33 +0000
committerStuart McLaren <stuart.mclaren@hp.com>2016-05-12 12:47:35 +0000
commita862196cfb7f7323b1864b4c1660c39850487a64 (patch)
tree72c267ed27daf37c28ddfde6436f8890b6b3d64e /glanceclient/shell.py
parentf39647ab47cb10af83a6861149f5897ed570f4a0 (diff)
downloadpython-glanceclient-a862196cfb7f7323b1864b4c1660c39850487a64.tar.gz
Get endpoint if os_image_url is not set
If env['OS_IMAGE_URL'] is not set then None is returned. This is then used ignoring the endpoint_type, service_type and region_name. This patch will use those values if the endpoint is None. Change-Id: I76cc527b05d2be75d3dbc33123a0d71be97fe25c Closes-bug: #1579768
Diffstat (limited to 'glanceclient/shell.py')
-rwxr-xr-xglanceclient/shell.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/glanceclient/shell.py b/glanceclient/shell.py
index 2a77b69..8f2a205 100755
--- a/glanceclient/shell.py
+++ b/glanceclient/shell.py
@@ -442,7 +442,16 @@ class OpenStackImagesShell(object):
}
else:
kwargs = self._get_kwargs_for_create_session(args)
- kwargs = {'session': self._get_keystone_session(**kwargs)}
+ ks_session = self._get_keystone_session(**kwargs)
+ kwargs = {'session': ks_session}
+
+ if endpoint is None:
+ endpoint_type = args.os_endpoint_type or 'public'
+ service_type = args.os_service_type or 'image'
+ endpoint = ks_session.get_endpoint(
+ service_type=service_type,
+ interface=endpoint_type,
+ region_name=args.os_region_name)
return glanceclient.Client(api_version, endpoint, **kwargs)