From 3cf37c9ac7b40a388f81fed13cfb0ad606dcd9a1 Mon Sep 17 00:00:00 2001 From: xudan Date: Wed, 15 Mar 2017 10:17:08 +0000 Subject: dovetail tool: change name of credentials from creds to openrc 1. change file name from openstack.creds to openrc.sh 2. change the cmd --creds to --openrc/-o 3. now the path of --openrc can be relative path no restrict to abspath 4. remove the useless "work_dir" in dovetail_config.yml JIRA: DOVETAIL-369 JIRA: DOVETAIL-367 Change-Id: I2592438eef060f84132ff7fa226aea93ea947362 Signed-off-by: xudan --- dovetail/conf/cmd_config.yml | 7 ++++--- dovetail/conf/dovetail_config.yml | 3 +-- dovetail/conf/functest_config.yml | 2 +- dovetail/conf/yardstick_config.yml | 2 +- dovetail/container.py | 15 +++++++++------ dovetail/test_runner.py | 2 +- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/dovetail/conf/cmd_config.yml b/dovetail/conf/cmd_config.yml index e66434b0..05567709 100644 --- a/dovetail/conf/cmd_config.yml +++ b/dovetail/conf/cmd_config.yml @@ -53,11 +53,12 @@ cli: path: - 'functest/docker_tag' help: 'Overwrite tag for functest docker container (e.g. stable or latest)' - creds: + openrc: flags: - - '--creds' + - '--openrc' + - '-o' path: - - 'creds' + - 'openrc' help: 'Openstack Credential file location' control: testsuite: diff --git a/dovetail/conf/dovetail_config.yml b/dovetail/conf/dovetail_config.yml index f8f18e46..9d2c0cf3 100644 --- a/dovetail/conf/dovetail_config.yml +++ b/dovetail/conf/dovetail_config.yml @@ -1,11 +1,10 @@ --- -work_dir: /home/opnfv/dovetail result_dir: /home/opnfv/dovetail/results report_file: 'dovetail_report.txt' cli_file_name: 'cmd_config.yml' # OPENSTACK Credential file -creds: '/home/opnfv/dovetail/openstack.creds' +openrc: '/home/opnfv/dovetail/openrc.sh' repo: tag: tag_name diff --git a/dovetail/conf/functest_config.yml b/dovetail/conf/functest_config.yml index 7182b27d..2fca713d 100644 --- a/dovetail/conf/functest_config.yml +++ b/dovetail/conf/functest_config.yml @@ -24,4 +24,4 @@ functest: file_path: 'functest_result.json' tp_path: 'tempest/tempest.log' db_url: 'http://testresults.opnfv.org/test/api/v1/results?case=%s&last=1' - creds: '/home/opnfv/functest/conf/openstack.creds' + openrc: '/home/opnfv/functest/conf/openstack.creds' diff --git a/dovetail/conf/yardstick_config.yml b/dovetail/conf/yardstick_config.yml index a7544f0c..029100cd 100644 --- a/dovetail/conf/yardstick_config.yml +++ b/dovetail/conf/yardstick_config.yml @@ -25,4 +25,4 @@ yardstick: store_type: 'file' file_path: 'yardstick.log' db_url: 'http://testresults.opnfv.org/test/api/v1/results?case=%s&last=1' - creds: '/home/opnfv/openrc' + openrc: '/home/opnfv/openrc' diff --git a/dovetail/container.py b/dovetail/container.py index 3c2c2944..4f6975fc 100644 --- a/dovetail/container.py +++ b/dovetail/container.py @@ -48,16 +48,19 @@ class Container(object): envs = dovetail_config[type]['envs'] opts = dovetail_config[type]['opts'] - # if file openstack.creds doesn't exist, creds need to be empty - if os.path.isfile(dovetail_config['creds']): - creds = ' -v %s:%s ' % (dovetail_config['creds'], - dovetail_config[type]['creds']) + # credentials file openrc.sh is neccessary + dovetail_config['openrc'] = os.path.abspath(dovetail_config['openrc']) + if os.path.isfile(dovetail_config['openrc']): + openrc = ' -v %s:%s ' % (dovetail_config['openrc'], + dovetail_config[type]['openrc']) else: - creds = '' + cls.logger.error("File %s is not exist", dovetail_config['openrc']) + return None + result_volume = ' -v %s:%s ' % (dovetail_config['result_dir'], dovetail_config[type]['result']['dir']) cmd = 'sudo docker run %s %s %s %s %s %s /bin/bash' % \ - (opts, envs, sshkey, creds, result_volume, docker_image) + (opts, envs, sshkey, openrc, result_volume, docker_image) dt_utils.exec_cmd(cmd, cls.logger) ret, container_id = \ dt_utils.exec_cmd("sudo docker ps | grep " + docker_image + diff --git a/dovetail/test_runner.py b/dovetail/test_runner.py index 588f049a..537fdec8 100644 --- a/dovetail/test_runner.py +++ b/dovetail/test_runner.py @@ -31,7 +31,7 @@ class DockerRunner(object): def run(self): Container.pull_image(self.testcase.validate_type()) container_id = Container.create(self.testcase.validate_type()) - if container_id == '': + if not container_id: self.logger.error('failed to create container') return -- cgit 1.2.3-korg