Skip to content
Snippets Groups Projects
Commit fc24743c authored by nimrod's avatar nimrod
Browse files

smile-exec fixes.

- Run `bundle show smile-cli` correctly in directories that have a
  Gemfile.
- The AWS profile for the security is not in the format of
  smile-$ENV-admin (the only one, I might add). Deal with that.
parent fc9ccdb9
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,13 @@ aws_account() {
esac
}
aws_profile() {
case "$1" in
security) echo "smile-security";;
*) echo "smile-$1-admin";;
esac
}
if [ "$#" -eq 0 ]
then
usage
......@@ -66,7 +73,8 @@ then
fi
export AWS_CONFIG_FILE="$HOME/.smile/aws/config"
export AWS_PROFILE="smile-$SMILE_ENV-admin"
# shellcheck disable=SC2155
export AWS_PROFILE="$(aws_profile "$SMILE_ENV")"
export AWS_DEFAULT_PROFILE="$AWS_PROFILE"
export AWS_DEFAULT_REGION=us-east-1
export HELM_HOME="$HOME/.smile/helm/$SMILE_ENV-sre"
......@@ -79,7 +87,7 @@ export KUBECONFIG="$HOME/.smile/kube/$SMILE_ENV/config"
export TILLER_NAMESPACE="applications-tiller"
# shellcheck disable=SC2155
export VAULT_ADDR="$(vault_addr "$SMILE_ENV")"
VAULT_CAPATH="$(bundle show smile-cli)/lib/vault_ca"
VAULT_CAPATH="$(BUNDLE_GEMFILE="$HOME/Repositories/Smile/Gemfile" bundle show smile-cli)/lib/vault_ca"
export VAULT_CAPATH
connected_vpn="$(dig env.smile.config TXT | xargs)"
......@@ -92,9 +100,9 @@ then
fi
if [ -n "$VAULT_ADDR" ]
then
aws-vault exec "smile-$SMILE_ENV-admin" -- \
aws-vault exec "$AWS_PROFILE" -- \
vault login -method aws -no-print role=smile-ops
fi
fi
eval exec aws-vault exec "smile-$SMILE_ENV-admin" -- "$@"
eval exec aws-vault exec "$AWS_PROFILE" -- "$@"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment