aboutsummaryrefslogtreecommitdiffstats
path: root/functest/utils
diff options
context:
space:
mode:
Diffstat (limited to 'functest/utils')
-rw-r--r--functest/utils/decorators.py9
-rw-r--r--functest/utils/functest_logger.py13
-rw-r--r--functest/utils/openstack_utils.py17
3 files changed, 35 insertions, 4 deletions
diff --git a/functest/utils/decorators.py b/functest/utils/decorators.py
index 99bcef3e..276235d9 100644
--- a/functest/utils/decorators.py
+++ b/functest/utils/decorators.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
+import errno
import mock
+import os
import requests.sessions
import urlparse
@@ -10,7 +12,12 @@ def can_dump_request_to_file(method):
def dump_preparedrequest(request, **kwargs):
parseresult = urlparse.urlparse(request.url)
if parseresult.scheme == "file":
- with open(parseresult.path.replace('/results', ''), 'a') as f:
+ try:
+ os.makedirs(parseresult.path)
+ except OSError as e:
+ if e.errno != errno.EEXIST:
+ raise
+ with open(os.path.join(parseresult.path, 'dump.txt'), 'a') as f:
headers = ""
for key in request.headers:
headers += key + " " + request.headers[key] + "\n"
diff --git a/functest/utils/functest_logger.py b/functest/utils/functest_logger.py
index 022211cb..555e9c28 100644
--- a/functest/utils/functest_logger.py
+++ b/functest/utils/functest_logger.py
@@ -28,13 +28,24 @@ import json
from functest.utils.constants import CONST
+ignore = ["paramiko",
+ "stevedore.extension",
+ "keystoneauth.session",
+ "keystoneauth.identity.v3.base",
+ "novaclient.v2.client",
+ "neutronclient.v2_0.client",
+ "glanceclient.common.http",
+ "cinderclient.v2.client",
+ "cinderclient.client"]
+
class Logger(object):
def __init__(self, logger_name):
self.setup_logging()
self.logger = logging.getLogger(logger_name)
- logging.getLogger("paramiko").setLevel(logging.WARNING)
+ for module_name in ignore:
+ logging.getLogger(module_name).setLevel(logging.WARNING)
def getLogger(self):
return self.logger
diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py
index e33af63b..ffc870f6 100644
--- a/functest/utils/openstack_utils.py
+++ b/functest/utils/openstack_utils.py
@@ -82,7 +82,8 @@ def get_env_cred_dict():
'OS_PROJECT_DOMAIN_NAME': 'project_domain_name',
'OS_PROJECT_NAME': 'project_name',
'OS_ENDPOINT_TYPE': 'endpoint_type',
- 'OS_REGION_NAME': 'region_name'
+ 'OS_REGION_NAME': 'region_name',
+ 'OS_CACERT': 'https_cacert'
}
return env_cred_dict
@@ -149,6 +150,11 @@ def get_credentials_for_rally():
if region_name is not None:
cred_key = env_cred_dict.get('OS_REGION_NAME')
rally_conf[cred_key] = region_name
+
+ cacert = os.getenv('OS_CACERT')
+ if cacert is not None:
+ cred_key = env_cred_dict.get('OS_CACERT')
+ rally_conf[cred_key] = cacert
return rally_conf
@@ -168,7 +174,14 @@ def get_endpoint(service_type, endpoint_type='publicURL'):
def get_session(other_creds={}):
auth = get_session_auth(other_creds)
- return session.Session(auth=auth)
+ cacert = os.getenv('OS_CACERT')
+ if cacert is not None:
+ if not os.path.isfile(cacert):
+ raise Exception("The 'OS_CACERT' environment"
+ "variable is set to %s but the file"
+ "does not exist.", cacert)
+
+ return session.Session(auth=auth, verify=cacert)
# *********************************************