Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #14052: create a rudder server trigger_policy_generation command #199

Conversation

ncharles
Copy link
Member

done

# check if the API is available
if netstat -lnt | grep -q "8080" > /dev/null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe better to use the status API?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha, i was wondering what was the state of the art for that

@ncharles ncharles force-pushed the bug_14052/create_a_rudder_server_trigger_policy_generation_command branch from 666753b to 63f1700 Compare December 27, 2018 15:26
@ncharles
Copy link
Member Author

Commit modified

then
echo "Successfully triggered a new policy generation"
else
echo "Failed to trigger a policy "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should return 1 in this case

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and display the message on stderr

@ncharles ncharles force-pushed the bug_14052/create_a_rudder_server_trigger_policy_generation_command branch from 63f1700 to 01147aa Compare January 23, 2019 10:57
@ncharles
Copy link
Member Author

Commit modified

. "${BASEDIR}/../lib/api_call.sh"

TOKEN="$(cat /var/rudder/run/api-token)"
DISPLAY_COMMAND=false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is never used, it should always be the 5th arg of filtered_api_call, see api_call.sh

done

# check if the API is available
api_result=$(filtered_api_call "${API_URL}/api/system/status" "${TOKEN}" "GET" -f)
Copy link
Contributor

@Fdall Fdall Jan 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The request need an api version, most likely "latest", and add the DISPLAY_COMMAND arg


if [ ${api_code} -eq 0 ]
then
result=$(filtered_api_call "${API_URL}/api/system/update/policies" "${TOKEN}" "POST" -f)
Copy link
Contributor

@Fdall Fdall Jan 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The request need an api version, most likely "latest", and add the DISPLAY_COMMAND arg

@ncharles ncharles force-pushed the bug_14052/create_a_rudder_server_trigger_policy_generation_command branch from 01147aa to 3a13261 Compare January 24, 2019 14:00
@ncharles
Copy link
Member Author

Commit modified

@Normation-Quality-Assistant

OK, merging this PR

@Normation-Quality-Assistant Normation-Quality-Assistant merged commit 3a13261 into Normation:branches/rudder/5.0 Jan 24, 2019
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants