Skip to content

Commit

Permalink
Fixes #25804: Use the system token header file in agent scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
amousset committed Nov 5, 2024
1 parent 6fb987f commit 98da74c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion share/commands/server-reload-groups
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ while getopts "iIvdc" opt; do
done

action="reload groups"
curl_opt="--header \"X-API-Token: ${TOKEN}\" --request POST"
curl_opt="--header @/var/rudder/run/api-token-header --request POST"
expected='{"action":"reloadGroups","result":"success","data":{"groups":"Started"}}'

checked_api_call "http://127.0.0.1:8080/rudder/api/latest/system/reload/groups" "reload groups" "${DISPLAY_COMMAND}" "${expected}" "${curl_opt}"
Expand Down
2 changes: 1 addition & 1 deletion share/commands/server-reload-techniques
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ done

# Make call to jetty directly and bypass apache conf so we are sure we have no problem to call reload techniques API
action="reload techniques from files"
curl_opt="--header \"X-API-Token: ${TOKEN}\" --request POST"
curl_opt="--header @/var/rudder/run/api-token-header --request POST"
expected='{"action":"reloadTechniques","result":"success","data":{"techniques":"Started"}}'

checked_api_call "http://127.0.0.1:8080/rudder/api/latest/system/reload/techniques" "reload techniques from files" "${DISPLAY_COMMAND}" "${expected}" "${curl_opt}"
Expand Down
2 changes: 1 addition & 1 deletion share/lib/api_call.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ rudder_api_call() {
action="$2"
curl_opt="$3"
display_command="$4"
curl_command="${DOWNLOAD_COMMAND} --header \"X-API-Token: ${TOKEN}\" --header \"Content-Type: application/json\" --request ${action} \"${API_URL}/api/latest${api}\" ${curl_opt}"
curl_command="${DOWNLOAD_COMMAND} --header @/var/rudder/run/api-token-header --header \"Content-Type: application/json\" --request ${action} \"${API_URL}/api/latest${api}\" ${curl_opt}"
if ${display_command};
then
printf "${WHITE}${curl_command}${NORMAL}\n\n" >&2
Expand Down

0 comments on commit 98da74c

Please sign in to comment.