xci: xci-destroy-env.sh: Update virtualbmc path 43/60843/1
authorMarkos Chandras <mchandras@suse.de>
Fri, 10 Aug 2018 12:16:10 +0000 (15:16 +0300)
committerMarkos Chandras <mchandras@suse.de>
Fri, 10 Aug 2018 12:47:27 +0000 (15:47 +0300)
Bifrost no longer installs on the deployment host so we don't need
to look into the bifrost venv for a vbmc installation. Moreover, XCI
uses virtualenv by default, so we should only look there for vbmc.
Finally, we should clear vbmc config files from previous deployments
since that could leave artifacts behind.

Change-Id: I4cd35636a65e1823c9e4ca9a7c5b17d4b103c6a2
Signed-off-by: Markos Chandras <mchandras@suse.de>
xci/files/xci-destroy-env.sh

index c95ea83..6c146b0 100755 (executable)
@@ -24,17 +24,15 @@ rm -rf ${HOME}/.ansible
 # Wipe repos
 rm -rf ${XCI_CACHE}/repos
 
-# bifrost installs everything on venv so we need to look there if virtualbmc is not installed on the host.
-if which vbmc &>/dev/null || { [[ -e ${XCI_VENV}/bifrost/bin/activate ]] && source ${XCI_VENV}/bifrost/bin/activate; }; then
+if which ${XCI_VENV}/bin/vbmc &>/dev/null; then
     # Delete all libvirt VMs and hosts from vbmc (look for a port number)
-    for vm in $(vbmc list | awk '/[0-9]/{{ print $2 }}'); do
+    for vm in $(${XCI_VENV}/bin/vbmc list | awk '/[0-9]/{{ print $2 }}'); do
         if which virsh &>/dev/null; then
-            virsh destroy $vm &>/dev/null || true
-            virsh undefine $vm &>/dev/null || true
+            virsh destroy $vm || true
+            virsh undefine $vm || true
         fi
-        vbmc delete $vm
+        ${XCI_VENV}/bin/vbmc delete $vm
     done
-    which vbmc &>/dev/null || { [[ -e /opt/stack/bifrost/bin/activate ]] && deactivate; }
 fi
 
 # Destroy all XCI VMs on all flavors
@@ -42,8 +40,8 @@ for varfile in ${flavors[@]}; do
     source ${XCI_PATH}/xci/config/${varfile}-vars
     for vm in ${NODE_NAMES}; do
         if which virsh &>/dev/null; then
-            virsh destroy $vm &>/dev/null || true
-            virsh undefine $vm &>/dev/null || true
+            virsh destroy $vm &> /dev/null || true
+            virsh undefine $vm &> /dev/null || true
         fi
     done
 done
@@ -84,5 +82,7 @@ service ironic-conductor start || true
 service ironic-inspector restart || true
 
 rm -rf ${XCI_VENV}
+# We also need to clear up previous vbmc config dirs
+rm -r ${HOME}/.vbmc
 
 # vim: set ts=4 sw=4 expandtab: