-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't use --profile #19
Comments
I would definitely like to see command line options included as it would allow one to easily switch/override |
I was able to get this working with pure hackery: docker-repo-uri =
!f() {
oargs=($(ps -o args= $PPID | cut -d' ' -f 3-))
for i in "${!oargs[@]}"; do
if [[ "${oargs[$i]}" == "--region" ]]; then
region="--region ${oargs[$i+1]}"
elif [[ "${oargs[$i]}" == "--profile" ]]; then
profile="--profile ${oargs[$i+1]}"
fi
done
aws ecr $region $profile \
describe-repositories --output text \
--query "repositories[?repositoryName == '${1}'].repositoryUri"
}; f |
That's an interesting edge case. So for the external aliases, the global arguments such as I do not for sure if we can make the change (for backwards compatibility reasons), but I think it will be safe to make the change because we do not forward any of the values from the global parameters to the subprocess. But we will need to do more research to make sure there are no missing edge cases. |
Hey @kyleknap. Thanks for looking into this. What do you think about my idea to populate |
It might. I would need to think about it. It may solve the issue involving |
Hi @kyleknap, thanks for the update but I think calling it an edge case is maybe understating its usefulness. I work with a number of accounts, Iam user ids and roles, the use of profiles has helped but the last thing I want to do is start mucking around with environment variables. I like the ideas and concepts introduced by the project but I think support of core CLI functionality will be needed. |
In a quick test I did, @vaneek I don't think Kyle was referring this issue as an edge case, but rather he was trying to think of new bugs that could be introduced in certain edge cases by fixing this bug, so he's just being extra careful not to break something else. :) |
Thanks @ranman for the hack! 🙂 Without it, using AWS Aliases would have been no go for me as I use multiple AWS accounts (therefore multiple profiles) and regions. But again, it's a hack and now I must include it to every external alias I make, so hoping this gets fixed in AWS CLI! |
This is actually a real pain.. I think the sooner this is fixed, the better. I don't want to rely on some hacky solution. |
Any updates on this request? |
+1 |
1 similar comment
+1 |
Without the use of --profile the tool is truly a no go for me and for everyone I know in that is an AWS DevOps engineer. I don't know anyone not using multiple accounts these days. seeing the issue is 3 years old I feel it has been abandon. cool concept and tool, would be nice to complete it :) |
Based on ranman's hackery I had to add this codeblock to every single AWS CLI alias that is wrapped into a function:
Only opts listed in the |
Would be nice if we could have @yermulnik extracted into a function or something - that snippet works great, though. |
Has AWS abandoned CLI extensibility? Should we just give up trying to use this and go back to shell aliases? |
I've just stublmed upon AWS CLI not passing args from command line properly as I would have expected it to... and found that when running AWS CLI installed with Homebrew
to this:
which is the cause of the issue with AWS CLI cmdline parameters being missed. |
I am trying to use
--profile
in my alias, but awscli is not forwarding it. It would also be acceptable for me if it instead setAWS_PROFILE
since that would make things work in most cases.Example alias:
Output:
It would be great if I would get this result:
Thanks!
Edit: The same thing happens with
--region
.The text was updated successfully, but these errors were encountered: