diff options
author | Lars Wirzenius <liw@liw.fi> | 2019-12-07 10:34:26 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2019-12-07 10:34:26 +0200 |
commit | c07fd635be75c7831509cdcdd1ec4618da4acb3a (patch) | |
tree | 692bc786f0762b13bba37a17d810cb5684149806 /remove-vm | |
parent | a4b78a473202a50cfde613493214e7f6b808edb8 (diff) | |
download | ansibleness-c07fd635be75c7831509cdcdd1ec4618da4acb3a.tar.gz |
Fix: logic
Diffstat (limited to 'remove-vm')
-rwxr-xr-x | remove-vm | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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. |