Openstack CLI tests failed on devstack

The issue is happening because of the devstack is using secure
connection for all the API calls with the self signed certificate.
This certificate is not trusted by the host so all the openstack
client tests are failed. Need to specify the certificate file with
the `--os-cacert` command line parameter to trust the certificate.

Change-Id: I3f2606d1da5fbcf1bf6ec1472748ddeb6906dd79
This commit is contained in:
Alex Katz 2020-11-19 12:20:20 +02:00 committed by Federico Ressi
parent 1eac0e0b9a
commit 53ca561ad8
4 changed files with 19 additions and 7 deletions

View File

@ -121,6 +121,7 @@ class CloudsFileKeystoneCredentialsFixture(
username = auth.get('username') or auth.get('user_id')
password = auth.get('password')
cacert = clouds_config.get('cacert')
project_name = (auth.get('project_name') or
auth.get('tenant_namer') or
auth.get('project_id') or
@ -154,6 +155,7 @@ class CloudsFileKeystoneCredentialsFixture(
user_domain_name=user_domain_name,
project_domain_name=project_domain_name,
project_domain_id=project_domain_id,
cacert=cacert,
trust_id=trust_id)
def _get_cloud_name(self):

View File

@ -38,6 +38,7 @@ class KeystoneCredentials(collections.namedtuple(
'user_domain_name',
'project_domain_name',
'project_domain_id',
'cacert',
'trust_id'])):
def to_dict(self):
@ -142,6 +143,7 @@ def keystone_credentials(api_version=None,
user_domain_name=None,
project_domain_name=None,
project_domain_id=None,
cacert=None,
trust_id=None,
cls=KeystoneCredentials) -> KeystoneCredentials:
return cls(api_version=api_version,
@ -153,6 +155,7 @@ def keystone_credentials(api_version=None,
user_domain_name=user_domain_name,
project_domain_name=project_domain_name,
project_domain_id=project_domain_id,
cacert=cacert,
trust_id=trust_id)

View File

@ -63,6 +63,7 @@ class KeystoneSessionFixture(tobiko.SharedFixture):
params = credentials.to_dict()
# api version parameter is not accepted
params.pop('api_version', None)
params.pop('cacert', None)
auth = loader.load_from_options(**params)
self.session = session = _session.Session(auth=auth, verify=False)
http.setup_http_session(session)

View File

@ -55,14 +55,20 @@ def execute(cmd, *args, **kwargs):
def _param_list(*args, **kwargs):
if not any(param in kwargs for param in ['os-token', 'os-username']):
credentials = keystone.get_keystone_credentials()
kwargs['os-auth-url'] = credentials.auth_url
kwargs['os-password'] = credentials.password
kwargs['os-username'] = credentials.username
kwargs['os-project-name'] = credentials.project_name
tmp_auth = {}
tmp_auth['os-auth-url'] = credentials.auth_url
tmp_auth['os-password'] = credentials.password
tmp_auth['os-username'] = credentials.username
tmp_auth['os-cacert'] = credentials.cacert
tmp_auth['os-project-name'] = credentials.project_name
tmp_auth['os-user-domain-name'] = credentials.user_domain_name
tmp_auth['os-project-domain-name'] = credentials.project_domain_name
tmp_auth['os-project-domain-id'] = credentials.project_domain_id
if credentials.api_version == 3:
kwargs['os-user-domain-name'] = credentials.user_domain_name
kwargs['os-project-domain-name'] = credentials.project_domain_name
kwargs['os-identity-api-version'] = credentials.api_version
tmp_auth['os-identity-api-version'] = credentials.api_version
for key, val in tmp_auth.items():
if val is not None:
kwargs[key] = val
arg_list = []
for arg in args:
if len(arg) == 1: