-
Notifications
You must be signed in to change notification settings - Fork 8
Unset environment variables more consistently. #242
base: master
Are you sure you want to change the base?
Conversation
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()}) |
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.
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'
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.
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.
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
Hey @smarnach have you been running this locally for a while? It seems fine to me with your update. |
Yes, I ran this locally since I filed the PR, and didn't run into any issues. |
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.