From 399d0bbdefd66cf47fa1e21402adc2fad6b40bbf Mon Sep 17 00:00:00 2001 From: Michael Basnight Date: Thu, 10 May 2012 11:38:11 -0500 Subject: [PATCH] Adding service type as configurable shell option fixes lp#997698 Change-Id: I5179a2ed5f32a8e7253806f6f9b02de3c06913ed --- AUTHORS | 1 + glanceclient/shell.py | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index fdf97884..aaaecc8c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -5,3 +5,4 @@ Dean Troyer Gabriel Hurley James E. Blair Chuck Short +Michael Basnight \ No newline at end of file diff --git a/glanceclient/shell.py b/glanceclient/shell.py index 6044f372..2f54cc15 100644 --- a/glanceclient/shell.py +++ b/glanceclient/shell.py @@ -85,6 +85,10 @@ class OpenStackImagesShell(object): default=utils.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 def get_subcommand_parser(self, version): @@ -150,8 +154,10 @@ class OpenStackImagesShell(object): tenant_id=kwargs.get('tenant_id'), tenant_name=kwargs.get('tenant_name'), auth_url=kwargs.get('auth_url')) - endpoint = _ksclient.service_catalog.url_for(service_type='image', - endpoint_type='publicURL') + service_type = kwargs.get('service_type') or 'image' + endpoint = _ksclient.service_catalog.url_for( + service_type=service_type, + endpoint_type='publicURL') endpoint = self._strip_version(endpoint) return (endpoint, _ksclient.auth_token) @@ -210,7 +216,8 @@ class OpenStackImagesShell(object): 'password': args.os_password, 'tenant_id': args.os_tenant_id, '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)