Skip to content

Commit

Permalink
Merge pull request #48 from CodeNow/extend-aws-tag-retrieval-time
Browse files Browse the repository at this point in the history
This will keep retrying the retrieval of tags for dock-init
  • Loading branch information
henrymollman authored May 25, 2017
2 parents 616010e + 8a4a487 commit e50f090
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions lib/aws.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,25 @@ aws::get_org_ids() {
# Note: this only works for us-.{4}-\d
export REGION=$(ec2-metadata --availability-zone | awk '{ where = match($2, /us\-.+\-[1|2]/); print substr($2, where, 9); }')

backoff aws::fetch_org_id
backoff aws::fetch_poppa_id
if [[ "$ORG_ID" == "" ]]; then
# this will print an error, so that's good
rollbar::report_error \
"Dock-Init: Org ID is Empty After cut" \
"Evidently the Org ID was bad, and we have an empty ORG_ID."
# we can not continue, halt
halter::halt
fi
while [[ "$ORG_ID" == "" ]]
do
aws::fetch_org_id
sleep 2
done

while [[ "$POPPA_ID" == "" ]]
do
aws::fetch_poppa_id
sleep 2
done

log::info "Got Org ID: $ORG_ID"
log::info "Got Poppa ID: $POPPA_ID"
}

aws::fetch_org_id() {
local attempt=${1}
log::info 'Attempting to get org id on prem'
log::info 'Attempting to get org id'
data='{"attempt":'"${attempt}"'}'

rollbar::warning_trap \
Expand Down

0 comments on commit e50f090

Please sign in to comment.