-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Allow sam local invoke
to retrieve account id from current logged in session
#7013
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
61a5c5f
Allow AWS sam local invoke to retrieve account id from current logged…
kevin-james-sp 9605545
Moved account id code to separate function
kevin-james-sp c7732ac
Merge branch 'develop' into develop
mildaniel 8ef323f
Update samcli/commands/local/cli_common/invoke_context.py
defenderkev 6a39e1d
Update samcli/commands/local/cli_common/invoke_context.py
defenderkev fb33fbe
Requested changes
kevin-james-sp 77543bf
unit tests
kevin-james-sp fe8ace6
Update tests/unit/commands/local/cli_common/test_invoke_context.py
defenderkev f2ee4a2
put docstring in
kevin-james-sp 8da5919
requested assertion changes
kevin-james-sp 0c6d025
Fix changes requested by @hawflau
defenderkev f412c84
Merge branch 'develop' into develop
defenderkev 290c556
missed removing a debugging statement
defenderkev b3c5831
add cmd line params to client_provider init
defenderkev f046969
Merge branch 'develop' into develop
defenderkev c2543ce
import get boto client method directly
defenderkev 3ec9847
Changed some existing tests, as the new code now means any profile sp…
defenderkev 6190ad2
Merge branch 'develop' into develop
mildaniel 40ee4e2
Added return type annotation
defenderkev 29f539c
Merge branch 'develop' of github-as-defenderkev:defenderkev/aws-sam-c…
defenderkev e7061b3
catch another Exception type, as `make pr` was failing when no creden…
defenderkev 5e7c72e
Merge branch 'develop' into develop
defenderkev dafa4c8
Merge branch 'develop' into develop
jysheng123 90bca1a
Add ClientError catch and update some of the tests
defenderkev 1740627
Fixed the last tests - mocked out the new account_id code as it's not…
defenderkev 35b0a22
Merge branch 'develop' into develop
hnnasit 74d8852
Merge branch 'develop' into develop
lucashuy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this function is ok to error, can you also add a generic exception handling right now? If theres no exception handling here, if an error occurs outside of the 2 defined errors, there is potential for this function to panic the execution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I caatch these two exceptions because they can be the consequences of
~/.aws/credentials
or~/.aws/config
fileIf anything else causes an error, we don't know what's caused it and in my opinion the execution should panic because we don't know how to handle it.
Thoughts? I mean, I'm happy to put in a generic
except
and continue but I'm not sure if that's what we should do hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to consider catching the
ClientError
exception here too. Using expired credentials, botocore returns:You had mentioned that other tests start failing once the
ClientError
was caught, maybe we could look at fixing those?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lucashuy What I've done is add catching
ClientError
to the new method, and patching the new method for the existing tests so it's just a stub; they don't need a live connection so inserting a live account ID is irrelevant. All tests are passing nowI also put back in some definitions of
aws_profile
I had taken out of some of those tests. Now the only differences to upstream are the patching of_add_account_id_to_global
and the extra tests for the new code.