summaryrefslogtreecommitdiff
path: root/remove-vm
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2019-12-07 10:34:26 +0200
committerLars Wirzenius <liw@liw.fi>2019-12-07 10:34:26 +0200
commitc07fd635be75c7831509cdcdd1ec4618da4acb3a (patch)
tree692bc786f0762b13bba37a17d810cb5684149806 /remove-vm
parenta4b78a473202a50cfde613493214e7f6b808edb8 (diff)
downloadansibleness-c07fd635be75c7831509cdcdd1ec4618da4acb3a.tar.gz
Fix: logic
Diffstat (limited to 'remove-vm')
-rwxr-xr-xremove-vm11
1 files changed, 6 insertions, 5 deletions
diff --git a/remove-vm b/remove-vm
index 9d1e940..77880d7 100755
--- a/remove-vm
+++ b/remove-vm
@@ -30,11 +30,12 @@ remove_vm()
lvpath="/dev/$vg/$name"
if [ -e "$lvpath" ]
then
- sudo lvremove --force "$lvpath"
- else
- # In case the LV was kpartx'd, undo that
- sudo kpartx -dsv "$lvpath"
- sudo lvremove --force "$lvpath"
+ if ! sudo lvremove --force "$lvpath"
+ then
+ # In case the LV was kpartx'd, undo that
+ sudo kpartx -dsv "$lvpath"
+ sudo lvremove --force "$lvpath"
+ fi
fi
# Remove the host from /etc/hosts, if there.