Fixed the function: remove test docker container by name
Earlier we removed the container by grepping the image link.
The command was not nice and with pepper the awk and single
quotation it is more compicated. Better to remove Rally container
by its name. The 'runRallyScenarios' functions sets the name
for the container. No need to delete container for Tempest, because
docker runs with --rm.
Change-Id: Iccf62ac054315513e28983e0558556ada05af5b3
diff --git a/src/com/mirantis/mk/Test.groovy b/src/com/mirantis/mk/Test.groovy
index 0c4f5f0..5632b2d 100644
--- a/src/com/mirantis/mk/Test.groovy
+++ b/src/com/mirantis/mk/Test.groovy
@@ -235,8 +235,7 @@
* @param target Target node to remove Docker container
* @param image_link The link of the Docker image that was used for the container
*/
-def removeDockerContainer(master, target, image_link) {
+def removeDockerContainer(master, target, containerName) {
def salt = new com.mirantis.mk.Salt()
- salt.cmdRun(master, target, "docker stop \$(docker ps -a | grep ${image_link} | awk '{print \$1}')")
- salt.cmdRun(master, target, "docker rm \$(docker ps -a | grep ${image_link} | awk '{print \$1}')")
+ salt.cmdRun(master, target, "docker rm -f ${containerName}")
}