Improve cleanup function in validation pipeline
Change-Id: I8e85bfb145727fe852bf26171cd7db9ae549e417
diff --git a/src/com/mirantis/mcp/Validate.groovy b/src/com/mirantis/mcp/Validate.groovy
index 016d5eb..bd1661a 100644
--- a/src/com/mirantis/mcp/Validate.groovy
+++ b/src/com/mirantis/mcp/Validate.groovy
@@ -77,7 +77,9 @@
*/
def runCleanup(master, target, output_dir) {
def salt = new com.mirantis.mk.Salt()
- salt.cmdRun(master, target, "docker rm -f qa_tools")
+ if ( salt.cmdRun(master, target, "docker ps -f name=qa_tools -q", false, null, false)['return'][0].values()[0] ) {
+ salt.cmdRun(master, target, "docker rm -f qa_tools")
+ }
sh "rm -r ${output_dir}"
}