summaryrefslogtreecommitdiffstats
path: root/dovetail/container.py
diff options
context:
space:
mode:
authorLeo Wang <grakiss.wanglei@huawei.com>2016-12-21 02:34:44 -0500
committerLeo wang <grakiss.wanglei@huawei.com>2016-12-22 02:14:26 +0000
commit76be7f7c6b2921aad6a68504a2020fb032eb5fde (patch)
treed46b86eff31cd11fc50b6cdc9f45965e14a919b8 /dovetail/container.py
parent1124a453feb24308f58bda363c229f632cafd82f (diff)
[dovetail tool]check and get results for each cmd
JIRA: DOVETAIL-166 Check the results of each cmds executed in test case 1. the results of pre_condition, post_condition, cmds need to be checked, so it can get a quick fail, dont need to go through the next step 2. it's more accurate to show where error occurred as early as possible 3. get results from shell scripts Change-Id: I5c1e59839c55b92de0e83e7e1eb552aa364b3f80 Signed-off-by: Leo Wang <grakiss.wanglei@huawei.com>
Diffstat (limited to 'dovetail/container.py')
-rw-r--r--dovetail/container.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/dovetail/container.py b/dovetail/container.py
index 59fc0d8a..b3450fa3 100644
--- a/dovetail/container.py
+++ b/dovetail/container.py
@@ -67,8 +67,10 @@ class Container:
(docker_image))
else:
cmd = 'sudo docker pull %s' % (docker_image)
- dt_utils.exec_cmd(cmd, cls.logger)
- cls.has_pull_latest_image[type] = True
+ ret, msg = dt_utils.exec_cmd(cmd, cls.logger)
+ if ret == 0:
+ cls.logger.debug('docker pull %s success!', docker_image)
+ cls.has_pull_latest_image[type] = True
@classmethod
def clean(cls, container_id):
@@ -80,6 +82,6 @@ class Container:
@classmethod
def exec_cmd(cls, container_id, sub_cmd, exit_on_error=False):
if sub_cmd == "":
- return
+ return (1, 'sub_cmd is empty')
cmd = 'sudo docker exec %s /bin/bash -c "%s"' % (container_id, sub_cmd)
- dt_utils.exec_cmd(cmd, cls.logger, exit_on_error)
+ return dt_utils.exec_cmd(cmd, cls.logger, exit_on_error)