summaryrefslogtreecommitdiffstats
path: root/bifrost/scripts/destroy-env.sh
diff options
context:
space:
mode:
authorMarkos Chandras <mchandras@suse.de>2018-03-10 09:48:28 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-03-10 09:48:28 +0000
commit75e75b5a411c376c52e9117742016b39a25a6ec3 (patch)
treea68c84fbe1fcfa7b13b07ae73b4aea8702330f29 /bifrost/scripts/destroy-env.sh
parenta27157c8f7a4af128de6b7a470fa5eddb158fa53 (diff)
parent718ceb6421da12ff3ae72305f9667c3785d0d8ea (diff)
Merge "bifrost: Do not run virsh commands if it's not installed"
Diffstat (limited to 'bifrost/scripts/destroy-env.sh')
-rwxr-xr-xbifrost/scripts/destroy-env.sh6
1 files changed, 4 insertions, 2 deletions
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; }