Skip to content
Snippets Groups Projects
Commit bd43c47c authored by Wieslaw Kedzierski's avatar Wieslaw Kedzierski
Browse files

Simplifie activate_beekeeper.sh script by using clive beekeeper spawn and create-session commands.

parent 09f8c801
No related branches found
No related tags found
2 merge requests!555v1.27.5.20 Release,!518Add possibility of creating beekeeper session with clive
......@@ -5,27 +5,17 @@ trap "clean_up" SIGTERM SIGQUIT SIGHUP EXIT
# Start Beekeeper with prepared session token
start_beekeeper_with_prepared_session_token() {
output=$(clive beekeeper spawn)
CLIVE_BEEKEEPER__REMOTE_ADDRESS=$(clive beekeeper spawn --echo-address-only)
# shellcheck disable=SC2181
if [[ $? -ne 0 ]]; then
echo "Error: Fail to spawn Beekeeper. Aborting..."
exit 1
fi
CLIVE_BEEKEEPER__REMOTE_ADDRESS=$(echo "$output" | grep -oE 'http://[0-9.]+:[0-9]+')
CLIVE_BEEKEEPER__SESSION_TOKEN=$(curl -s --data '{
"jsonrpc": "2.0",
"method": "beekeeper_api.create_session",
"params": {
"salt": "clive-cli-session",
"notifications_endpoint": "'"${CLIVE_BEEKEEPER__REMOTE_ADDRESS}"'"
},
"id": 1
}' "${CLIVE_BEEKEEPER__REMOTE_ADDRESS}" | jq .result.token | tr -d '"')
if [[ "${CLIVE_BEEKEEPER__SESSION_TOKEN}" == "null" ]]; then
echo "Error: There is no valid token."
CLIVE_BEEKEEPER__SESSION_TOKEN=$(clive beekeeper create-session --echo-token-only)
# shellcheck disable=SC2181
if [[ $? -ne 0 ]]; then
echo "Error: Failed to create a new beekeeper session. Aborting..."
exit 1
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment