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
This commit is contained in:
Niall Bunting
2016-05-09 16:23:33 +00:00
committed by Stuart McLaren
parent f39647ab47
commit a862196cfb
2 changed files with 87 additions and 17 deletions
+10 -1
View File
@@ -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)