From: Markos Chandras Date: Fri, 9 Mar 2018 14:37:16 +0000 (+0000) Subject: bifrost: Do not run virsh commands if it's not installed X-Git-Tag: 6.0.0~126^2 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F19%2F53419%2F1;p=releng-xci.git bifrost: Do not run virsh commands if it's not installed Check if 'virsh' is available before trying to remove the VMs: Fixes the following warning ./scripts/destroy-env.sh: line 36: virsh: command not found ./scripts/destroy-env.sh: line 37: virsh: command not found ./scripts/destroy-env.sh: line 36: virsh: command not found ./scripts/destroy-env.sh: line 37: virsh: command not found ./scripts/destroy-env.sh: line 36: virsh: command not found ./scripts/destroy-env.sh: line 37: virsh: command not found Change-Id: I9c82c8b8b40462584c6324871284ba12d660ae9d Signed-off-by: Markos Chandras --- diff --git a/bifrost/scripts/destroy-env.sh b/bifrost/scripts/destroy-env.sh index 3ee66642..97638303 100755 --- a/bifrost/scripts/destroy-env.sh +++ b/bifrost/scripts/destroy-env.sh @@ -23,8 +23,10 @@ rm -rf ${HOME}/.config/openstack if which vbmc &>/dev/null || { [[ -e /opt/stack/bifrost/bin/activate ]] && source /opt/stack/bifrost/bin/activate; }; 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 - virsh destroy $vm || true - virsh undefine $vm || true + if which virsh &>/dev/null; then + virsh destroy $vm || true + virsh undefine $vm || true + fi vbmc delete $vm done which vbmc &>/dev/null || { [[ -e /opt/stack/bifrost/bin/activate ]] && deactivate; }