From 4cfcf9b1afb2cf47f7f7042b10d0bdaac4635afc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Knut=20Arne=20Bj=C3=B8rndal?= Date: Tue, 24 Jul 2018 16:14:23 +0200 Subject: [PATCH] Improve command and option handling The way it was structured before meant it was impossible to use the (documented) filter argument to the tag command. --- ganeti-roll-helper.sh | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/ganeti-roll-helper.sh b/ganeti-roll-helper.sh index 78e9b3e..080fa5d 100755 --- a/ganeti-roll-helper.sh +++ b/ganeti-roll-helper.sh @@ -190,6 +190,11 @@ next_clear_offline() { } next() { + test $# -eq 0 || { + echo "next (and run) does not take any arguments" >&2 + return 64 + } + if [ "$(list_nodes "'$next_maintenance_tag' in tags" | wc -l)" -gt 0 ]; then next_evacuate_nodes || return $?; elif [ "$(list_nodes "'$in_maintenance_tag' in tags" | wc -l)" -gt 0 ]; then @@ -219,7 +224,7 @@ usage() { fi cat <