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

Regression in AWS profile support #639

Closed
btm opened this issue Feb 21, 2020 · 0 comments · Fixed by #640
Closed

Regression in AWS profile support #639

btm opened this issue Feb 21, 2020 · 0 comments · Fixed by #640
Assignees
Labels
Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected.

Comments

@btm
Copy link
Contributor

btm commented Feb 21, 2020

Version:

knife-ec2 1.0.31 in Chef Workstation 0.6.29.

Environment:

Scenario:

Use an AWS profile with knife ec2 server create

Steps to Reproduce:

My ~/.chef/credentials file has a section like this:

[foo] 
chef_server_url = "..."

[foo.knife]
aws_profile = "chef-engineering"
ssh_user = "ubuntu"

Expected Result:

The credentials are used.

Actual Result:

It looks for "profile chef-engineering" which appears to be a regression from #632.

According to the documentation, ~/.aws/config has [profile user1] entries but ~/.aws/credentials should not use the word profile and should be just [user1].

https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html

The credentials file uses a different naming format than the CLI config file for named profiles. Include the prefix word "profile" only when configuring a named profile in the config file. Do not use the word profile when creating an entry in the credentials file.

$ knife ec2 server create -VVV
DEBUG: Checking if we need to accept Chef license to bootstrap node
DEBUG: Reading products and relationships...
DEBUG: Successfully read products and relationships
DEBUG: License acceptance required for chef version: 15
DEBUG: Searching for the following licenses: ["infra-client", "inspec"]
DEBUG: Found license chef_infra_client at /etc/chef/accepted_licenses/chef_infra_client
DEBUG: Found license inspec at /etc/chef/accepted_licenses/inspec
DEBUG: Missing licenses remaining: []
DEBUG: All licenses present
DEBUG: Using AWS credential file at /home/btm/.aws/credentials
DEBUG: Using AWS profile profile chef-engineering
Traceback (most recent call last):
	11: from /opt/chef-workstation/bin/knife:357:in `<main>'
	10: from /opt/chef-workstation/bin/knife:357:in `load'
	 9: from /opt/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.8.23/bin/knife:24:in `<top (required)>'
	 8: from /opt/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.8.23/lib/chef/application/knife.rb:163:in `run'
	 7: from /opt/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.8.23/lib/chef/knife.rb:229:in `run'
	 6: from /opt/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.8.23/lib/chef/knife.rb:485:in `run_with_pretty_exceptions'
	 5: from /opt/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.8.23/lib/chef/local_mode.rb:42:in `with_server_connectivity'
	 4: from /opt/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.8.23/lib/chef/knife.rb:486:in `block in run_with_pretty_exceptions'
	 3: from /opt/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.8.23/lib/chef/knife/bootstrap.rb:561:in `run'
	 2: from /opt/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/knife-ec2-1.0.31/lib/chef/knife/ec2_server_create.rb:579:in `plugin_setup!'
	 1: from /opt/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/knife-ec2-1.0.31/lib/chef/knife/helpers/ec2_base.rb:219:in `validate_aws_config!'
/opt/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/knife-ec2-1.0.31/lib/chef/knife/helpers/ec2_base.rb:344:in `validate_aws_credential_file!': The provided --aws-profile 'profile chef-engineering' is invalid. Does the credential file at '/home/btm/.aws/credentials' contain this profile? (ArgumentError)
@btm btm added Type: Bug Does not work as expected. Status: Untriaged An issue that has yet to be triaged. labels Feb 21, 2020
@kapilchouhan99 kapilchouhan99 self-assigned this Feb 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants