From ce896972a0b263e1d83b61f071e5ccbb945c8696 Mon Sep 17 00:00:00 2001 From: xudan Date: Mon, 27 Mar 2017 03:32:50 +0000 Subject: dovetail tool: change function pull_image JIRA: DOVETAIL-378 1. test_runner checks the result of cmd "pull image". If fail to pull, then break the running. 2. pull_image will return None when there are errors, otherwise return image name. 3. if there is an old image named the same as the new one, the old one's tag will be changed into . In this case, the old image needs to be removed. 4. if there are some containers using this old image, the remove will be skipped rather than logging error. Change-Id: I940cb18911112d5e13f3c14f87ddbdbaced3538a Signed-off-by: xudan --- dovetail/test_runner.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'dovetail/test_runner.py') diff --git a/dovetail/test_runner.py b/dovetail/test_runner.py index ea58768c..1ac9f196 100644 --- a/dovetail/test_runner.py +++ b/dovetail/test_runner.py @@ -35,10 +35,11 @@ class DockerRunner(object): self.logger.error('%s image not exist offline running', self.testcase.validate_type()) return - container_id = Container.create(self.testcase.validate_type()) else: - Container.pull_image(self.testcase.validate_type()) - container_id = Container.create(self.testcase.validate_type()) + if not Container.pull_image(self.testcase.validate_type()): + self.logger.error("Failed to pull the image.") + return + container_id = Container.create(self.testcase.validate_type()) if not container_id: self.logger.error('failed to create container') return -- cgit 1.2.3-korg