diff options
author | xudan <xudan16@huawei.com> | 2017-09-25 04:44:38 -0400 |
---|---|---|
committer | xudan <xudan16@huawei.com> | 2017-09-26 03:11:58 -0400 |
commit | 98ff39a0bb75e2ae07b4af77ddb127ffaeb4ce5b (patch) | |
tree | cbc38d97d8a4ac28551c92f05b4f8e7aa8f94ea8 /dovetail/container.py | |
parent | 6f47c82d4b6f830863ff1330163d869baa6c7eec (diff) |
Make Yardstick log level can be set by CLI
1. Currently, the log level of yardstick is DEBUG and cannot be modified.
2. Make it can be changed from CLI.
3. When use dovetail run --debug, can see all Yardstick logs (including DEBUG)
in dovetail.log.
4. When run without debug option, cannot see Yardstick debug logs in
dovetail.logs.
5. yardstick.log always doesn't include debug logs.
JIRA: DOVETAIL-506
Change-Id: Iaafb61232a22e16fff2fa4605bf7e262b022085e
Signed-off-by: xudan <xudan16@huawei.com>
Diffstat (limited to 'dovetail/container.py')
-rw-r--r-- | dovetail/container.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/dovetail/container.py b/dovetail/container.py index 14045165..ff92fa4a 100644 --- a/dovetail/container.py +++ b/dovetail/container.py @@ -149,14 +149,19 @@ class Container(object): # CI_DEBUG is used for showing the debug logs of the upstream projects # BUILD_TAG is the unique id for this test - envs = ' -e CI_DEBUG=true -e NODE_NAME=master' + envs = ' -e NODE_NAME=master' + DEBUG = os.getenv('DEBUG') + if DEBUG is not None and DEBUG.lower() == "true": + envs = envs + ' -e CI_DEBUG=true' + else: + envs = envs + ' -e CI_DEBUG=false' envs = envs + ' -e BUILD_TAG=%s-%s' % (dovetail_config['build_tag'], testcase_name) hosts_config = "" hosts_config_file = os.path.join(dovetail_config['config_dir'], 'hosts.yaml') - try: + if os.path.isfile(hosts_config_file): with open(hosts_config_file) as f: hosts_info = yaml.safe_load(f) if hosts_info['hosts_info']: @@ -165,10 +170,6 @@ class Container(object): hosts_config += " --add-host " hosts_config += str(host) cls.logger.debug('Get hosts info {}.'.format(host)) - except Exception: - cls.logger.warn('Failed to get hosts info in {}, ' - 'maybe some issues with domain name resolution.' - .format(hosts_config_file)) config = "" if type.lower() == "functest": |