Support --os-endpoint-type in glanceclient.

Bug: 993993

* glanceclient/shellp.py
  OpenStackImagesShell.get_base_parser(): Parse --os-endpoint-type
  argument. Default to one defined in os.environ.
  OpenStackImagesShell._authenticate(): Define endpoint type based
  on command line argument. Use 'publicURL', if it's not specified
  in command line and also not defined in os.environ.
  OpenStackImagesShell.main(): Pass this value to authenticate.

Change-Id: I0c0cde5212198eec2a7d75fb2a7cad1cde048c7c
This commit is contained in:
Bhuvan Arumugam
2012-06-23 22:27:11 -07:00
parent 99e872a57b
commit d6e0a03a93
+8 -2
View File
@@ -97,6 +97,10 @@ class OpenStackImagesShell(object):
default=utils.env('OS_SERVICE_TYPE'),
help='Defaults to env[OS_SERVICE_TYPE]')
parser.add_argument('--os-endpoint-type',
default=utils.env('OS_ENDPOINT_TYPE'),
help='Defaults to env[OS_ENDPOINT_TYPE]')
return parser
def get_subcommand_parser(self, version):
@@ -164,9 +168,10 @@ class OpenStackImagesShell(object):
tenant_name=kwargs.get('tenant_name'),
auth_url=kwargs.get('auth_url'))
service_type = kwargs.get('service_type') or 'image'
endpoint_type = kwargs.get('endpoint_type') or 'publicURL'
endpoint = _ksclient.service_catalog.url_for(
service_type=service_type,
endpoint_type='publicURL')
endpoint_type=endpoint_type)
endpoint = self._strip_version(endpoint)
return (endpoint, _ksclient.auth_token)
@@ -226,7 +231,8 @@ class OpenStackImagesShell(object):
'tenant_id': args.os_tenant_id,
'tenant_name': args.os_tenant_name,
'auth_url': args.os_auth_url,
'service_type': args.os_service_type
'service_type': args.os_service_type,
'endpoint_type': args.os_endpoint_type
}
endpoint, token = self._authenticate(**kwargs)