diff options
author | Linda Wang <wangwulin@huawei.com> | 2017-06-20 06:31:29 +0000 |
---|---|---|
committer | Linda Wang <wangwulin@huawei.com> | 2017-06-22 16:24:59 +0000 |
commit | dbfb9c4e94e500592a8b93f42b7b87230d0af311 (patch) | |
tree | e8c15131bdca7e7c52abe93f641c366e4d6934cb /snaps/openstack/os_credentials.py | |
parent | 39b46e7e43dffff8f4abfbc142c9e28c9ce0d260 (diff) |
Enable https for Openstack in Snaps
When running in https environment, snaps should provide two options:
1. To support certification verify when https certification file is provided;
2. To disable server certificate verification without cert file.
JIRA: SNAPS-84
Change-Id: I5a9094238db5c8017cc8b80e3353adc6e793b552
Signed-off-by: Linda Wang <wangwulin@huawei.com>
Diffstat (limited to 'snaps/openstack/os_credentials.py')
-rw-r--r-- | snaps/openstack/os_credentials.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/snaps/openstack/os_credentials.py b/snaps/openstack/os_credentials.py index db6369b..b55e480 100644 --- a/snaps/openstack/os_credentials.py +++ b/snaps/openstack/os_credentials.py @@ -22,7 +22,7 @@ class OSCreds: def __init__(self, username, password, auth_url, project_name, identity_api_version=2, image_api_version=2, network_api_version=2, compute_api_version=2, user_domain_id='default', project_domain_id='default', - proxy_settings=None): + proxy_settings=None, cacert=True): """ Constructor :param username: The user (required) @@ -36,6 +36,8 @@ class OSCreds: :param user_domain_id: Used for v3 APIs :param project_domain_id: Used for v3 APIs :param proxy_settings: instance of os_credentials.ProxySettings class + :param cacert: Default to be True for http, or the certification file is specified for https verification, + or set to be False to disable server certificate verification without cert file """ self.username = username self.password = password @@ -48,6 +50,7 @@ class OSCreds: self.user_domain_id = user_domain_id self.project_domain_id = project_domain_id self.proxy_settings = proxy_settings + self.cacert = cacert if self.proxy_settings and not isinstance(self.proxy_settings, ProxySettings): raise Exception('proxy_settings must be an instance of the class ProxySettings') @@ -72,7 +75,8 @@ class OSCreds: ', network_api_version=' + str(self.network_api_version) + \ ', compute_api_version=' + str(self.compute_api_version) + \ ', user_domain_id=' + str(self.user_domain_id) + \ - ', proxy_settings=' + str(self.proxy_settings) + ', proxy_settings=' + str(self.proxy_settings) + \ + ', cacert=' + str(self.cacert) class ProxySettings: |