From: Georg Kunz Date: Sun, 2 Aug 2020 20:35:33 +0000 (+0200) Subject: "Better" pattern matching for name of jump VM X-Git-Tag: opnfv-10.0.0~27^2 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?p=kuberef.git;a=commitdiff_plain;h=357f4a4c278c95ecddab7fce1e69b1571cdd0bea "Better" pattern matching for name of jump VM The pattern currently used matches also non-exact hits, such as "jumphost" and "xci-jumphost". This tweak attempts to achieve better exact word matches. Note: the -w option of grep does not seem to do the trick as well. Signed-off-by: Georg Kunz Change-Id: I8cb98a5540a41f5e6044efe12584403b7f4398df --- diff --git a/functions.sh b/functions.sh index b0baf2d..55edfbf 100755 --- a/functions.sh +++ b/functions.sh @@ -10,10 +10,10 @@ # Clean up clean_up() { - if sudo virsh list --all | grep "${VM_NAME}.*running" ; then + if sudo virsh list --all | grep " ${VM_NAME} .*running" ; then sudo virsh destroy "$VM_NAME" fi - if sudo virsh list --all | grep "${VM_NAME}" ; then + if sudo virsh list --all | grep " ${VM_NAME} " ; then sudo virsh undefine "$VM_NAME" fi sudo rm -rf "/var/lib/libvirt/images/$VM_NAME"