Adapt admin_node_command to accept commands both via stdin and args

Change-Id: I04800a9c5e24d31942864dd5554043142584f6eb
This commit is contained in:
Matthew Mosesohn 2017-01-12 19:36:35 +03:00 committed by Sergii Golovatiuk
parent 9597ca0680
commit 652276b02a
1 changed files with 4 additions and 2 deletions

View File

@ -84,8 +84,10 @@ function with_retries {
}
function admin_node_command {
if [[ "$ADMIN_IP" == "local" ]];then
eval "$@"
# Accepts commands from args passed to function or multiple commands via stdin,
# one per line.
if [[ "$ADMIN_IP" == "local" ]]; then
bash < <(test $# -gt 0 && echo -ne "$@" || cat)
else
ssh $SSH_OPTIONS $ADMIN_USER@$ADMIN_IP "$@"
fi