Skip to content
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

Reload credentials before writing to avoid clashes with other processes #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions awsmfa/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ def find_mfa_for_user(user_specified_serial, botocore_session, boto3_session):

def update_credentials_file(filename, target_profile, source_profile,
credentials, new_access_key):
# reload credentials before writing to avoid conflicts with other processes
credentials.read(filename)
if target_profile != source_profile:
credentials.remove_section(target_profile)
# Hack: Python 2's implementation of ConfigParser rejects new sections
Expand Down