-
Notifications
You must be signed in to change notification settings - Fork 14
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
Wait for agent startup before updating CAPI tags #145
Conversation
@@ -1,13 +1,30 @@ | |||
#!/bin/sh | |||
|
|||
# wait for the buildpack scripts to finish | |||
timeout=0 | |||
while { ! [ "$(pgrep -f ./agent)" = "" ] && ! [ "$(pgrep -f ./dogstatsd)" = "" ]; } && [ $timeout -lt 120 ]; do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these processes are started using a pid file and it's logically possible for the associated buildpack applications to have a binary with the same name, does use of -F make more sense with pgrep?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it does make more sense. However, when this script is invoked by the Garden API, the underlying process doesn't have the DATADOG_DIR
ENV variable, which we would need to find the pid file (e.g.: ${DATADOG_DIR}/run/agent.pid
) . @sarah-witt was using this approach as a temporary workaround. We didn't want to assume that DATADOG_DIR=/home/vcap/app/.datadog
without careful consideration, as we noticed in some parts in the scripts DATADOG_DIR
could be a user input.
We're going to make a separate PR to address this issue and then we'll resume this PR.
aa1f50d
to
6f75187
Compare
What does this PR do?
This PR fixes the conditions when waiting for the agent to start up before running the update script to inject DCA tags. Now the
update_agent_config_restart
script will not run until either the agent or dogstatsd process is running. This PR also adds more logging.Description of the Change
Alternate Designs
Possible Drawbacks
Verification Process
Additional Notes
Release Notes
Review checklist (to be filled by reviewers)
changelog/
label attached. If applicable it should have thebackward-incompatible
label attached.do-not-merge/
label attached.kind/
andseverity/
labels attached at least.