This repository was archived by the owner on Sep 18, 2023. It is now read-only.
Unset environment variables more consistently.#242
Open
Conversation
bkochendorfer
suggested changes
Sep 10, 2021
mozilla_aws_cli/login.py
Outdated
| "AWS_SHARED_CREDENTIALS_FILE": None, | ||
| "MAWS_PROMPT": self.display_name}) | ||
| {var: self.credentials.get(key) | ||
| for key, var in ENV_VARIABLE_NAME_MAP.item()}) |
Member
There was a problem hiding this comment.
Encountered error : Unable to contact AWS : Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/mozilla_aws_cli-1.2.4-py3.9.egg/mozilla_aws_cli/login.py", line 363, in exchange_token_for_credentials
self.print_output()
File "/usr/local/lib/python3.9/dist-packages/mozilla_aws_cli-1.2.4-py3.9.egg/mozilla_aws_cli/login.py", line 428, in print_output
for key, var in ENV_VARIABLE_NAME_MAP.item()})
AttributeError: 'dict' object has no attribute 'item'
Author
There was a problem hiding this comment.
Sorry about that! Should be .items(). Fixed now (togerther with a few other clean-ups). This time I at least did a basic test that it's still working.
Contributor
|
I think this is a good idea (unsetting those variables). This PR may be the way to do it, or maybe some other approach. Either way, ya we should introduce this change in some form. |
fc9026d to
0a3f3b0
Compare
Member
|
Hey @smarnach have you been running this locally for a while? It seems fine to me with your update. |
Author
|
Yes, I ran this locally since I filed the PR, and didn't run into any issues. |
bkochendorfer
approved these changes
Apr 5, 2022
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
We noticed that maws currently does not unset the AWS_SECURITY_TOKEN evnironment variable, which can lead to confusing behaviour if it is still set. This PR makes sure this env variable is always unset, and makes unsetting env vars overall a bit more consistent.
It's not tested at all, and probably needs unit tests, so this is still a draft.