Skip to content

Commit

Permalink
Merge pull request #3 from igorpeshansky/agent-metadata-control
Browse files Browse the repository at this point in the history
Agent startup should be controlled by *instance* metadata, not project.
  • Loading branch information
mr-salty committed Sep 3, 2015
2 parents 612fad2 + bdb2b56 commit 52f1141
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion templates/etc/init.d/deb/td-agent
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ do_start() {
if kill_by_file -0 "${TD_AGENT_PID_FILE}"; then
return 1
else
GOOGLE_LOGGING_ENABLE=$(curl --silent -f -H "Metadata-Flavor: Google" http://169.254.169.254/computeMetadata/v1/project/attributes/google-logging-enable 2>/dev/null)
GOOGLE_LOGGING_ENABLE=$(curl --silent -f -H "Metadata-Flavor: Google" http://169.254.169.254/computeMetadata/v1/instance/attributes/google-logging-enable 2>/dev/null)
if [ -n "$GOOGLE_LOGGING_ENABLE" -a "$GOOGLE_LOGGING_ENABLE" = "0" ]; then
log_warning_msg "Disabled via metadata"
return 3
Expand Down
2 changes: 1 addition & 1 deletion templates/etc/init.d/rpm/td-agent
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ do_start() {
# 3 if daemon was not supposed to be started
# other if daemon could not be started or a failure occurred

GOOGLE_LOGGING_ENABLE=$(curl --silent -f -H "Metadata-Flavor: Google" http://169.254.169.254/computeMetadata/v1/project/attributes/google-logging-enable 2>/dev/null)
GOOGLE_LOGGING_ENABLE=$(curl --silent -f -H "Metadata-Flavor: Google" http://169.254.169.254/computeMetadata/v1/instance/attributes/google-logging-enable 2>/dev/null)
if [ -n "$GOOGLE_LOGGING_ENABLE" -a "$GOOGLE_LOGGING_ENABLE" = "0" ]; then
echo "Disabled via metadata"
return 3
Expand Down

0 comments on commit 52f1141

Please sign in to comment.