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

If no keys specified on CLI/config use an AWS credential file if present #548

Merged
merged 7 commits into from
Aug 6, 2018

Conversation

tas50
Copy link
Contributor

@tas50 tas50 commented Aug 3, 2018

Right now we require the user to specify the location to the aws credentials file, but the file has a standard location. This moves us to a model where that credentials file is the standard source of credentials unless otherwise specified. In 2018 that seems like a sane expectation since ~/.aws/credentials is the standard aws location for creds now.

This also breaks up the insane validate! method into 3 methods so you can more easily follow the logic. It was getting crazy.

Finally it gives more friendly error messages if the specified config/credential file location doesn't actually exist so you don't just get a Ruby error message.

It was huge and hard to follow

Signed-off-by: Tim Smith <[email protected]>
AWS keys on the CLI and in knife.rb will continue to take precedent, but if you specify nothing on the CLI now we'll go looking for a credentials file and if we find it we'll use those credentials. In 2016 people should be using the credentials file unless they have a need to override those values so this makes that easy.

Signed-off-by: Tim Smith <[email protected]>
Signed-off-by: Tim Smith <[email protected]>
We can't double validate the config since it loads the values when we do that and then we fail the config file + keys scenario later on.

side note: why does validation load config values into the config hash. That seems like a bad idea

Make sure to load the correct config in the credentials loading method

Signed-off-by: Tim Smith <[email protected]>
Getting a generic ruby error isn't really delightful.

Signed-off-by: Tim Smith <[email protected]>
Signed-off-by: Tim Smith <[email protected]>
@tas50 tas50 changed the title WIP: If no keys specified on CLI/config use an AWS cred file if present If no keys specified on CLI/config use an AWS cred file if present Aug 4, 2018
@tas50 tas50 changed the title If no keys specified on CLI/config use an AWS cred file if present If no keys specified on CLI/config use an AWS credential file if present Aug 4, 2018
Copy link

@cheeseplus cheeseplus left a comment

Choose a reason for hiding this comment

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

image

@tas50 tas50 merged commit 2a1db2f into master Aug 6, 2018
@chef-ci chef-ci deleted the use_creds_file branch August 6, 2018 16:44
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