"Better" pattern matching for name of jump VM 42/70642/3
authorGeorg Kunz <georg.kunz@est.tech>
Sun, 2 Aug 2020 20:35:33 +0000 (22:35 +0200)
committerGeorg Kunz <georg.kunz@est.tech>
Mon, 17 Aug 2020 20:40:14 +0000 (22:40 +0200)
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 <georg.kunz@est.tech>
Change-Id: I8cb98a5540a41f5e6044efe12584403b7f4398df

functions.sh

index b0baf2d..55edfbf 100755 (executable)
 
 # 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"