Merge "Add ``insecure`` and ``cacert`` options to the client."
This commit is contained in:
commit
a9eb87c436
|
@ -25,12 +25,26 @@ from cloudkittyclient.v1 import storage
|
|||
|
||||
class Client(object):
|
||||
|
||||
def __init__(self, session=None, adapter_options={}, **kwargs):
|
||||
def __init__(self,
|
||||
session=None,
|
||||
adapter_options={},
|
||||
cacert=None,
|
||||
insecure=False,
|
||||
**kwargs):
|
||||
adapter_options.setdefault('service_type', 'rating')
|
||||
|
||||
if insecure:
|
||||
verify_cert = False
|
||||
else:
|
||||
if cacert:
|
||||
verify_cert = cacert
|
||||
else:
|
||||
verify_cert = True
|
||||
|
||||
self.session = session
|
||||
if self.session is None:
|
||||
self.session = ks_session.Session(**kwargs)
|
||||
self.session = ks_session.Session(
|
||||
verify=verify_cert, **kwargs)
|
||||
|
||||
self.api_client = adapter.Adapter(
|
||||
session=self.session, **adapter_options)
|
||||
|
|
|
@ -49,6 +49,16 @@ Else, use it the same way as any other OpenStack client::
|
|||
u'res_type': u'ALL',
|
||||
u'tenant_id': u'bea6a24f77e946b0a92dca7c78b7870b'}]}
|
||||
|
||||
.. warning::
|
||||
|
||||
If you want to use SSL with the client as a python library, you need to
|
||||
provide a cert to keystone's session object. Else, two additional options
|
||||
are available if you provide an ``auth`` object to the client: ``insecure``
|
||||
and ``cacert``::
|
||||
|
||||
>>> client = ck_client.Client(
|
||||
'1', auth=auth, insecure=False, cacert='/path/to/ca')
|
||||
|
||||
When using the ``cloudkitty`` CLI client with keystone authentication, the
|
||||
auth plugin to use should automagically be detected. If not, you can specify
|
||||
the auth plugin to use with ``--os-auth-type/--os-auth-plugin``::
|
||||
|
|
Loading…
Reference in New Issue