diff --git a/salt/manager/tools/sbin/so-client b/salt/manager/tools/sbin/so-client index c1d352328..5b8365f86 100755 --- a/salt/manager/tools/sbin/so-client +++ b/salt/manager/tools/sbin/so-client @@ -28,7 +28,7 @@ function usage() { Optional parameters: --role (defaults to $DEFAULT_ROLE) --note (defaults to blank) - --raw only output generated secret + --json output as JSON delete: Deletes a client from the oauth2 system Required parameters: @@ -54,7 +54,7 @@ function usage() { Required parameters: --id Optional parameters: - --raw only output generated secret + --json output as JSON USAGE_EOF exit 1 @@ -87,8 +87,8 @@ while [[ $# -gt 0 ]]; do note=$1 shift ;; - --raw) - raw=1 + --json) + json=1 ;; *) echo "Encountered unexpected parameter: $param" @@ -326,10 +326,10 @@ case "${operation}" in lock createClient "$name" "${role:-$DEFAULT_ROLE}" "${note}" - if [[ "$raw" == "1" ]]; then - echo $secret + if [[ "$json" == "1" ]]; then + echo "{\"id\":\"$id\",\"secret\":\"$secret\"}" else - echo "Successfully added user and generated secret: $secret" + echo "Successfully added user ID $id with generated secret: $secret" fi ;; @@ -376,8 +376,8 @@ case "${operation}" in lock generateSecret "$id" - if [[ "$raw" == "1" ]]; then - echo $secret + if [[ "$json" == "1" ]]; then + echo "{\"secret\":\"$secret\"}" else echo "Successfully generated secret: $secret" fi diff --git a/salt/soc/files/bin/salt-relay.sh b/salt/soc/files/bin/salt-relay.sh index bc8ac169f..8bd40384c 100755 --- a/salt/soc/files/bin/salt-relay.sh +++ b/salt/soc/files/bin/salt-relay.sh @@ -170,7 +170,7 @@ function manage_client() { name=$(echo "$request" | jq -r .name) note=$(echo "$request" | jq -r .note) log "Performing client '$op' for client with name '$name', note '$note' and role '$role'" - response=$(so-client "$op" --name "$name" --note "$note" --role "$role" --raw) + response=$(so-client "$op" --name "$name" --note "$note" --role "$role" --json) webResponse=$response exit_code=$? ;; @@ -190,7 +190,7 @@ function manage_client() { generate-secret) client_id=$(echo "$request" | jq -r .id) log "Performing '$op' operation for client '$client_id'" - response=$(so-client "$op" --id "$client_id" --raw) + response=$(so-client "$op" --id "$client_id" --json) webResponse=$response exit_code=$? ;;