Fix exit status for many vm commands

The pattern "[ $? -ne 0 ] && util::err ..." is problematic since it
leaves an exit status of 1 if the test fails, which is the non-error
case. So various commands (e.g., vm datastore add) return status 1 even
when they succeed if this pattern appears as the last line of a command
implementation.

Fix this by mechanically converting this pattern to
"[ $? -eq 0 ] || util:err ...".
This commit is contained in:
Mark Johnston
2018-02-06 17:39:11 -05:00
parent c9ec4d05f6
commit 4c931a7e01
8 changed files with 40 additions and 40 deletions

View File

@@ -44,7 +44,7 @@ util::load_module(){
kldstat -qm ${_mod} >/dev/null 2>&1
if [ $? -ne 0 ]; then
kldload ${_mod} >/dev/null 2>&1
[ $? -ne 0 ] && util::err "unable to load ${_mod}.ko!"
[ $? -eq 0 ] || util::err "unable to load ${_mod}.ko!"
fi
}