Adding service type as configurable shell option

fixes lp#997698

Change-Id: I5179a2ed5f32a8e7253806f6f9b02de3c06913ed
This commit is contained in:
Michael Basnight
2012-05-10 11:38:11 -05:00
parent b31c272ae1
commit 399d0bbdef
2 changed files with 11 additions and 3 deletions

View File

@@ -5,3 +5,4 @@ Dean Troyer <dtroyer@gmail.com>
Gabriel Hurley <gabriel@strikeawe.com> Gabriel Hurley <gabriel@strikeawe.com>
James E. Blair <jeblair@hp.com> James E. Blair <jeblair@hp.com>
Chuck Short <chuck.short@canonical.com> Chuck Short <chuck.short@canonical.com>
Michael Basnight <mbasnight@gmail.com>

View File

@@ -85,6 +85,10 @@ class OpenStackImagesShell(object):
default=utils.env('OS_IMAGE_URL'), default=utils.env('OS_IMAGE_URL'),
help='Defaults to env[OS_IMAGE_URL]') help='Defaults to env[OS_IMAGE_URL]')
parser.add_argument('--os-service-type',
default=utils.env('OS_SERVICE_TYPE'),
help='Defaults to env[OS_SERVICE_TYPE]')
return parser return parser
def get_subcommand_parser(self, version): def get_subcommand_parser(self, version):
@@ -150,7 +154,9 @@ class OpenStackImagesShell(object):
tenant_id=kwargs.get('tenant_id'), tenant_id=kwargs.get('tenant_id'),
tenant_name=kwargs.get('tenant_name'), tenant_name=kwargs.get('tenant_name'),
auth_url=kwargs.get('auth_url')) auth_url=kwargs.get('auth_url'))
endpoint = _ksclient.service_catalog.url_for(service_type='image', service_type = kwargs.get('service_type') or 'image'
endpoint = _ksclient.service_catalog.url_for(
service_type=service_type,
endpoint_type='publicURL') endpoint_type='publicURL')
endpoint = self._strip_version(endpoint) endpoint = self._strip_version(endpoint)
return (endpoint, _ksclient.auth_token) return (endpoint, _ksclient.auth_token)
@@ -210,7 +216,8 @@ class OpenStackImagesShell(object):
'password': args.os_password, 'password': args.os_password,
'tenant_id': args.os_tenant_id, 'tenant_id': args.os_tenant_id,
'tenant_name': args.os_tenant_name, 'tenant_name': args.os_tenant_name,
'auth_url': args.os_auth_url 'auth_url': args.os_auth_url,
'service_type': args.os_service_type
} }
endpoint, token = self._authenticate(**kwargs) endpoint, token = self._authenticate(**kwargs)