run tgt-admin --delete only if input not empty
This change provides better handling of tgtadm --op show output as input of tgt-admin --delete command. In situation where no output of the first command is present no tgt-admin command is run. Change-Id: Ief5e1d50dd679f4d47cffef29ff07e54cc37f80a Closes-bug: 1554997
This commit is contained in:
parent
6fff3cc035
commit
084efc7158
2
lib/lvm
2
lib/lvm
@ -124,7 +124,7 @@ function init_lvm_volume_group {
|
||||
if [ "$CINDER_ISCSI_HELPER" = "lioadm" ]; then
|
||||
sudo cinder-rtstool get-targets | sudo xargs -rn 1 cinder-rtstool delete
|
||||
else
|
||||
sudo tgtadm --op show --mode target | grep Target | cut -f3 -d ' ' | sudo xargs -n1 tgt-admin --delete || true
|
||||
sudo tgtadm --op show --mode target | awk '/Target/ {print $3}' | sudo xargs -r -n1 tgt-admin --delete
|
||||
fi
|
||||
_clean_lvm_volume_group $vg
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user