Add support for supplying custom service type.

Change-Id: I1fc317b7235b54ceea0228dfd71b933f8bbb8855
This commit is contained in:
Kiall Mac Innes 2013-01-24 09:27:47 +00:00
parent 62a0163caa
commit 6574e7d2a2
3 changed files with 9 additions and 2 deletions

View File

@ -33,6 +33,7 @@ class Command(CliffCommand):
'tenant_id': self.app.options.os_tenant_id,
'tenant_name': self.app.options.os_tenant_name,
'token': self.app.options.os_token,
'service_type': self.app.options.os_service_type,
'region_name': self.app.options.os_region_name,
}

View File

@ -59,6 +59,10 @@ class MonikerShell(App):
default=os.environ.get('OS_SERVICE_TOKEN'),
help="Defaults to env[OS_SERVICE_TOKEN]")
parser.add_argument('--os-service-type',
default=os.environ.get('OS_SERVICE_TYPE', 'dns'),
help="Defaults to env[OS_SERVICE_TYPE], or 'dns'")
parser.add_argument('--os-region-name',
default=os.environ.get('OS_REGION_NAME'),
help="Defaults to env[OS_REGION_NAME]")

View File

@ -26,7 +26,8 @@ class Client(object):
def __init__(self, endpoint=None, auth_url=None, username=None,
password=None, tenant_id=None, tenant_name=None, token=None,
region_name=None, endpoint_type='publicURL'):
region_name=None, service_type='dns',
endpoint_type='publicURL'):
"""
:param endpoint: Endpoint URL
:param auth_url: Keystone auth_url
@ -40,7 +41,8 @@ class Client(object):
"""
if auth_url:
auth = KeystoneAuth(auth_url, username, password, tenant_id,
tenant_name, token, 'dns', endpoint_type)
tenant_name, token, service_type,
endpoint_type)
self.endpoint = auth.get_url()
elif endpoint:
auth = None