mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-12-22 13:58:00 +00:00
[aws] Fix switch_aws_profile when dealing with AWS_DEFAULT_REGION
This commit is contained in:
parent
cb0099ec7a
commit
a73bb314cc
@ -13,7 +13,7 @@ typeset -gA aws_info
|
|||||||
|
|
||||||
|
|
||||||
if (( ${+AWS_PROFILE} )); then
|
if (( ${+AWS_PROFILE} )); then
|
||||||
if (( ${+AWS_DEFAULT_REGION+1} )) && [[ ${_aws_region} = "true" ]]; then
|
if (( ${+AWS_DEFAULT_REGION} )) && [[ ${_aws_region} = "true" ]]; then
|
||||||
AWS_REGION=$(cut -d "-" -f 1 <<<$AWS_DEFAULT_REGION | cut -b 1)$(cut -d "-" -f 2 <<<$AWS_DEFAULT_REGION | cut -b 1)$(cut -d "-" -f 3 <<<$AWS_DEFAULT_REGION | cut -b 1)
|
AWS_REGION=$(cut -d "-" -f 1 <<<$AWS_DEFAULT_REGION | cut -b 1)$(cut -d "-" -f 2 <<<$AWS_DEFAULT_REGION | cut -b 1)$(cut -d "-" -f 3 <<<$AWS_DEFAULT_REGION | cut -b 1)
|
||||||
AWS_REGION_PROMPT=" $AWS_REGION"
|
AWS_REGION_PROMPT=" $AWS_REGION"
|
||||||
fi
|
fi
|
||||||
|
@ -136,9 +136,15 @@ function ssh_aws_any {
|
|||||||
|
|
||||||
function aws_switch_profile {
|
function aws_switch_profile {
|
||||||
echo "Activating profile $1..."
|
echo "Activating profile $1..."
|
||||||
export AWS_PROFILE=$1
|
local region
|
||||||
|
|
||||||
|
export AWS_PROFILE=$1
|
||||||
if [[ -f ~/.aws/credentials ]]; then #&& (( ! ${+AWS_DEFAULT_REGION} ))
|
if [[ -f ~/.aws/credentials ]]; then #&& (( ! ${+AWS_DEFAULT_REGION} ))
|
||||||
export AWS_DEFAULT_REGION=$(aws configure get region)
|
region=$(aws configure get region)
|
||||||
|
if [[ ! -z $region ]]; then
|
||||||
|
export AWS_DEFAULT_REGION=$region
|
||||||
|
else
|
||||||
|
unset AWS_DEFAULT_REGION
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user