From 7ecac90599c54654fd20d72b7ec30ec2b7d4220c Mon Sep 17 00:00:00 2001 From: Telles Nobrega Date: Mon, 17 Nov 2014 22:45:14 -0300 Subject: [PATCH] Replacing data_processing with data-processing Using data_processing causes a problem when defining the endpoint statically in keystone. Change-Id: I8fb2be802c4390bdcd49e1722cd36f50781b1feb Partial-bug: #1356053 --- doc/source/api.rst | 2 +- saharaclient/api/client.py | 3 +++ saharaclient/shell.py | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/source/api.rst b/doc/source/api.rst index 4686c642..24e91c5e 100644 --- a/doc/source/api.rst +++ b/doc/source/api.rst @@ -17,7 +17,7 @@ The client constructor has a list of parameters to authenticate and locate Sahar * auth_url - Keystone URL that will be used for authentication. * sahara_url - Sahara REST API URL to communicate with. - * service_type - Sahara service name in Keystone catalog. (Default: data_processing) + * service_type - Sahara service name in Keystone catalog. (Default: data-processing) * endpoint_type - Desired Sahara endpoint type. (Default: publicURL) * username - Username for Keystone authentication. * api_key - Password for Keystone authentication. diff --git a/saharaclient/api/client.py b/saharaclient/api/client.py index 9a87bbe5..8cfb8f32 100644 --- a/saharaclient/api/client.py +++ b/saharaclient/api/client.py @@ -54,6 +54,9 @@ class Client(object): project_id=project_id, project_name=project_name) catalog = keystone.service_catalog.get_endpoints(service_type) + if service_type not in catalog: + service_type = service_type.replace('-', '_') + if service_type in catalog: for e_type, endpoint in catalog.get(service_type)[0].items(): if str(e_type).lower() == str(endpoint_type).lower(): diff --git a/saharaclient/shell.py b/saharaclient/shell.py index 0ffc6f22..883e0004 100644 --- a/saharaclient/shell.py +++ b/saharaclient/shell.py @@ -57,7 +57,7 @@ from saharaclient import version DEFAULT_API_VERSION = 'api' DEFAULT_ENDPOINT_TYPE = 'publicURL' -DEFAULT_SERVICE_TYPE = 'data_processing' +DEFAULT_SERVICE_TYPE = 'data-processing' logger = logging.getLogger(__name__) @@ -279,7 +279,7 @@ class OpenStackSaharaShell(object): parser.add_argument('--service-type', metavar='', - help='Defaults to data_processing for all ' + help='Defaults to data-processing for all ' 'actions.') parser.add_argument('--service_type', help=argparse.SUPPRESS)