Skip to content

Commit

Permalink
Fix print-env multiline cert output
Browse files Browse the repository at this point in the history
[Bug Fixes]

* Fixes the certificate exports for BOSH and CredHub environment
  variables that had embedded newlines expressed as \n.
  • Loading branch information
dennisjbell committed Jan 30, 2024
1 parent 93d126c commit d43413a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions hooks/addon-print-env
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,19 @@ $bosh || $credhub || $ssh || {

exodus="$(exodus --all)"

#host="$(bosh env | head -n1 | sed -E 's#.*(https?://[^:'"'"']+(:[0-9]+)?).*#\1#')"
host_addr="$(jq -r '.url | sub("https?://";"") | sub(":[0-9]+$";"")' <<<"$exodus")"

if $bosh; then
echo "export BOSH_ENVIRONMENT=$(jq '.url' <<<"$exodus")"
echo "export BOSH_CA_CERT=$(jq '.ca_cert' <<<"$exodus")"
echo "export BOSH_CA_CERT=\"\$(echo -e $(jq '.ca_cert' <<<"$exodus"))\""
echo "export BOSH_CLIENT=$(jq '.admin_username' <<<"$exodus")"
echo "export BOSH_CLIENT_SECRET=$(jq '.admin_password' <<<"$exodus")"
fi
if $credhub; then
echo "export CREDHUB_SERVER=$(jq '.credhub_url' <<<"$exodus")"
echo "export CREDHUB_CLIENT=$(jq '.credhub_username' <<<"$exodus")"
echo "export CREDHUB_SECRET=$(jq '.credhub_password' <<<"$exodus")"
echo "export CREDHUB_CA_CERT=$(jq '"\(.ca_cert)\(.credhub_ca_cert)"' <<<"$exodus")"
echo "export CREDHUB_CA_CERT=\"\$(echo -e $(jq '"\(.ca_cert)\(.credhub_ca_cert)"' <<<"$exodus"))\""
fi

# set bosh_all_proxy so it can be shared with copy/paste
Expand Down

0 comments on commit d43413a

Please sign in to comment.