dovetail tool: change name of credentials from creds to openrc 53/30553/3
authorxudan <xudan16@huawei.com>
Wed, 15 Mar 2017 10:17:08 +0000 (10:17 +0000)
committerxudan <xudan16@huawei.com>
Mon, 20 Mar 2017 01:24:08 +0000 (01:24 +0000)
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 <xudan16@huawei.com>
dovetail/conf/cmd_config.yml
dovetail/conf/dovetail_config.yml
dovetail/conf/functest_config.yml
dovetail/conf/yardstick_config.yml
dovetail/container.py
dovetail/test_runner.py

index e66434b..0556770 100644 (file)
@@ -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:
index f8f18e4..9d2c0cf 100644 (file)
@@ -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
index 7182b27..2fca713 100644 (file)
@@ -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'
index a7544f0..029100c 100644 (file)
@@ -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'
index 3c2c294..4f6975f 100644 (file)
@@ -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 +
index 588f049..537fdec 100644 (file)
@@ -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