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
This commit is contained in:
Telles Nobrega
2014-11-17 22:45:14 -03:00
parent 8cfc1d6a1f
commit 7ecac90599
3 changed files with 6 additions and 3 deletions

View File

@@ -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.

View File

@@ -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():

View File

@@ -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='<service-type>',
help='Defaults to data_processing for all '
help='Defaults to data-processing for all '
'actions.')
parser.add_argument('--service_type',
help=argparse.SUPPRESS)