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

Update config when changing profile #4

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

kmendler
Copy link

@kmendler kmendler commented Oct 5, 2019

AWS CLI pulls from both credentials and config files, with credentials being preferred (see the docs). The changes in this PR will cause the default profile in both files to be updated.

This PR addresses issue #2 and includes minor refactoring.

avm/bin/avm Outdated
@@ -49,7 +57,7 @@ if args.add:
config.add_section(args.alias)
config[args.alias]["aws_access_key_id"] = row['Access key ID']
config[args.alias]["aws_secret_access_key"] = row['Secret access key']
with open(home_creds, 'w') as configfile:
with open(home_credentials, 'w') as configfile:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you forgot to write into /.aws/config here.

Copy link
Author

@kmendler kmendler Oct 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to add to ~/.aws/config if ~/.aws/credentials holds the configuration details, but I think it would be better practise if the fields were split between the two files. Is that what you were thinking? So all fields except aws_access_key_id and aws_secret_access_key would go into ~/.aws/config?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about it more and it doesn't seem like we would want any other fields written from the .csv file except those two... I've updated the variable names to make it more clear that only the ~/.aws/credentials file is being manipulated with the --add option.

Copy link
Owner

@ror6ax ror6ax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good here. There's only one comment and I'd also ask you to add a mention of this functionality in the readme, ok?

@kmendler
Copy link
Author

I addressed your concern with the --add option and the updates to the README. Let me know if there's anything else you'd like :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants