mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-12-22 12:48:01 +00:00
[aws] Detect whenever a aws sso login is needed
This commit is contained in:
parent
2676780766
commit
3d3346be0a
@ -148,6 +148,7 @@ function ssh_aws_any {
|
||||
|
||||
function aws_switch_profile {
|
||||
local region
|
||||
local credentials
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
echo "Profile can't be an empty string"
|
||||
@ -166,7 +167,14 @@ function aws_switch_profile {
|
||||
fi
|
||||
|
||||
if [[ ${_aws_sso} == "true" ]]; then
|
||||
eval $(aws-export-credentials --env-export)
|
||||
credentials=$(aws-export-credentials --env-export 2>&1)
|
||||
|
||||
if [[ $credentials =~ "has expired" ]]; then
|
||||
aws sso login
|
||||
credentials=$(aws-export-credentials --env-export)
|
||||
fi
|
||||
|
||||
eval $credentials
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user