add proper keyword args to distilclient
It's nice to have the ctor signature indicate what is actually accepted. Change-Id: Ie5f529c299756edcaa884ab58993f8ab9dc1cc60
This commit is contained in:
@@ -21,21 +21,27 @@ import json
|
|||||||
|
|
||||||
class Client(object):
|
class Client(object):
|
||||||
|
|
||||||
def __init__(self, distil_url=None, os_auth_token=None, **kwargs):
|
def __init__(self, distil_url=None, os_auth_token=None,
|
||||||
self.insecure = kwargs.get('insecure')
|
os_username=None, os_password=None,
|
||||||
|
os_tenant_id=None, os_tenant_name=None,
|
||||||
|
os_auth_url=None, os_region_name=None,
|
||||||
|
os_cacart=None, insecure=False,
|
||||||
|
os_service_type='rating', os_endpoint_type='publicURL'):
|
||||||
|
|
||||||
|
self.insecure = insecure
|
||||||
|
|
||||||
if os_auth_token and distil_url:
|
if os_auth_token and distil_url:
|
||||||
self.auth_token = os_auth_token
|
self.auth_token = os_auth_token
|
||||||
self.endpoint = distil_url
|
self.endpoint = distil_url
|
||||||
else:
|
else:
|
||||||
ks = Keystone(username=kwargs.get('os_username'),
|
ks = Keystone(username=os_username,
|
||||||
password=kwargs.get('os_password'),
|
password=os_password,
|
||||||
tenant_id=kwargs.get('os_tenant_id'),
|
tenant_id=os_tenant_id,
|
||||||
tenant_name=kwargs.get('os_tenant_name'),
|
tenant_name=os_tenant_name,
|
||||||
auth_url=kwargs.get('os_auth_url'),
|
auth_url=os_auth_url,
|
||||||
region_name=kwargs.get('os_region_name'),
|
region_name=os_region_name,
|
||||||
cacert=kwargs.get('os_cacert'),
|
cacert=os_cacert,
|
||||||
insecure=kwargs.get('insecure'))
|
insecure=insecure)
|
||||||
if os_auth_token:
|
if os_auth_token:
|
||||||
self.auth_token = os_auth_token
|
self.auth_token = os_auth_token
|
||||||
else:
|
else:
|
||||||
@@ -45,8 +51,8 @@ class Client(object):
|
|||||||
self.endpoint = distil_url
|
self.endpoint = distil_url
|
||||||
else:
|
else:
|
||||||
self.endpoint = ks.service_catalog.url_for(
|
self.endpoint = ks.service_catalog.url_for(
|
||||||
service_type=kwargs.get('os_service_type', 'rating'),
|
service_type=os_service_type,
|
||||||
endpoint_type=kwargs.get('os_endpoint_type', 'publicURL')
|
endpoint_type=os_endpoint_type
|
||||||
)
|
)
|
||||||
|
|
||||||
def usage(self):
|
def usage(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user