Skip to content

Commit

Permalink
Merge pull request #49 from CodeNow/user-vault-rollbar-trap
Browse files Browse the repository at this point in the history
User vault rollbar trap
  • Loading branch information
henrymollman authored May 26, 2017
2 parents e50f090 + 3dfa270 commit 77bc57f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/aws.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ aws::fetch_poppa_id() {
log::info "Setting Poppa ID"

# Generate the org-tag fetching script
rollbar::fatal_trap \
rollbar::warning_trap \
"Dock-Init: Failed to Render Org Script" \
"Consule-Template was unable to realize the given template."

Expand Down
5 changes: 5 additions & 0 deletions lib/vault.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ vault::set_s3_keys() {

# creates a token for a the organizations-readonly policy
vault::store_private_registry_token() {
rollbar::fatal_trap \
"Dock-Init: Cannot store private registry token" \
"The user vault token was not generated"

log::info "Storing vault token for private registry key"
local NODE_ENV=$(consul::get node/env)
local token_path="${DOCK_INIT_BASE}/consul-resources/vault/${NODE_ENV}"
Expand All @@ -72,4 +76,5 @@ vault::store_private_registry_token() {
vault token-create -policy=dock-${POPPA_ID} | awk '/token/ { print $2 }' | awk 'NR==1 { print $1 }' > /opt/runnable/dock-init/user-private-registry-token
VAULT_TOKEN=$(cat "${token_path}"/auth-token)
export VAULT_TOKEN
rollbar::clear_trap
}

0 comments on commit 77bc57f

Please sign in to comment.