From 9f29b8d4bed88c65f040c54242b53dc2e787ad32 Mon Sep 17 00:00:00 2001 From: Aitor Perez Cedres Date: Mon, 16 Aug 2021 14:05:17 +0100 Subject: [PATCH] Adapt instance manage to support Linux The command `open` is specific to MacOS. Linux desktops use `xdg-open` instead. The rest of the script should be compatible with Linux. [#801] Signed-off-by: Aitor Perez Cedres --- bin/kubectl-rabbitmq | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/kubectl-rabbitmq b/bin/kubectl-rabbitmq index d69744def..c25aa1c47 100755 --- a/bin/kubectl-rabbitmq +++ b/bin/kubectl-rabbitmq @@ -10,6 +10,7 @@ set -euo pipefail +PLATFORM="$(uname)" NAMESPACE="" instance="" @@ -164,9 +165,16 @@ manage() { MGMT_PORT=15672 MGMT_URL="http://localhost:$MGMT_PORT/" fi + + if [[ "${PLATFORM}" == "Darwin" ]]; then + OPEN="open" + else + OPEN="xdg-open" + fi + ( sleep 2 - open "$MGMT_URL" + $OPEN "$MGMT_URL" ) & kubectl ${NAMESPACE} port-forward "service/${service}" $MGMT_PORT }