Slight fix for when help/usage is displayed for onos-power
Change-Id: Ic4186823ffeed77244e8f745b115fd14cd4b7628
(cherry picked from commit 78c098dcb93d3ba68749773a37b781df1a3dec6c)
diff --git a/tools/test/bin/onos-power b/tools/test/bin/onos-power
index fc684ca..d072413 100755
--- a/tools/test/bin/onos-power
+++ b/tools/test/bin/onos-power
@@ -8,6 +8,10 @@
# 'onos-die' command.
# -----------------------------------------------------------------------------
+function usage() {
+ echo "usage: $(basename $0) node-ip {on|off} [user]" >&2 && exit 1
+}
+
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
. $ONOS_ROOT/tools/build/envDefaults
@@ -15,7 +19,10 @@
cmd=${2:-on}
user=${3:$(id -un)}
-if [ "$cmd" = "on" ]; then
+if [ "$node" = "--help" ]; then
+ usage
+
+elif [ "$cmd" = "on" ]; then
if [ -n "$HARD_POWER_OFF" -a $ONOS_CELL = "borrow" ]; then
curl -sS -X PUT "http://$CELL_WARDEN:4321/?cmd=powerOn&nodeIp=$node&user=$user"
else
@@ -30,6 +37,6 @@
fi
else
- echo "usage: $(basename $0) node-ip {on|off} user" >&2 && exit 1
+ usage
fi