Skip to content

Commit 72dc78f

Browse files
authored
Fix accepting input from the CLI (#11060)
Follow-up to #10268. There were still cases where input was ignored, eg. `rabbitmq-diagnostics -n node observer`
1 parent 6e056e5 commit 72dc78f

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

deps/rabbit/scripts/rabbitmq-diagnostics

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ set -a
2222

2323
maybe_noinput='noinput'
2424

25-
case "$1" in
26-
observer)
25+
case "$@" in
26+
*observer*)
2727
maybe_noinput='input'
2828
;;
29-
remote_shell)
29+
*remote_shell*)
3030
maybe_noinput='input'
3131
;;
3232
*)

deps/rabbit/scripts/rabbitmqctl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ unset _tmp_help_requested
5555

5656
maybe_noinput='noinput'
5757

58-
case "$1" in
59-
add_user)
58+
case "$@" in
59+
*add_user*)
6060
if [ "$#" -eq 2 ]
6161
then
6262
# In this case, input is required to provide the password:
@@ -91,7 +91,7 @@ case "$1" in
9191
maybe_noinput='noinput'
9292
fi
9393
;;
94-
authenticate_user)
94+
*authenticate_user*)
9595
if [ "$#" -eq 2 ]
9696
then
9797
# In this case, input is required to provide the password:
@@ -106,7 +106,7 @@ case "$1" in
106106
maybe_noinput='noinput'
107107
fi
108108
;;
109-
change_password)
109+
*change_password*)
110110
maybe_noinput='input'
111111
if [ "$#" -gt 2 ]
112112
then
@@ -118,13 +118,13 @@ case "$1" in
118118
maybe_noinput='noinput'
119119
fi
120120
;;
121-
decode|encode)
121+
*decode*|*encode*)
122122
# It is unlikely that these commands will be run in a shell script loop
123123
# with redirection, so always assume that stdin input is needed
124124
#
125125
maybe_noinput='input'
126126
;;
127-
eval)
127+
*eval*)
128128
if [ "$#" -eq 1 ]
129129
then
130130
# If there is only one argument, 'eval', then input is required
@@ -134,7 +134,7 @@ case "$1" in
134134
maybe_noinput='input'
135135
fi
136136
;;
137-
hash_password)
137+
*hash_password*)
138138
if [ "$#" -eq 1 ]
139139
then
140140
# If there is only one argument, 'hash_password', then input is required

0 commit comments

Comments
 (0)