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

Shared AWS credentials file being ignored. #295

Closed
tom-schultz opened this issue Feb 14, 2017 · 6 comments
Closed

Shared AWS credentials file being ignored. #295

tom-schultz opened this issue Feb 14, 2017 · 6 comments

Comments

@tom-schultz
Copy link

tom-schultz commented Feb 14, 2017

Hi,

When I try to run kitchen test I get the following error. I have AWS credentials and they can be used by knife and the AWS CLI. Any idea why kitchen seems to be ignoring them? I've also attached kitchen.log.

>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Failed to complete #create action: [unable to sign request without credentials set] on default-amazon
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
@cheeseplus
Copy link
Contributor

We've identified a bad merge that is causing this and are trying to resolve this - I'd recommend pinning to 1.2.0 for the time being but I'm hoping to have this resolved by EOD tomorrow (I'm unfortunately on an airplane a good deal of the day)

@cheeseplus
Copy link
Contributor

@tom-schultz do you happen to have any ENV vars related to AWS set as well?

Specifically - "AWS_ACCESS_KEY_ID" and "AWS_SECRET_ACCESS_KEY" (not the values obviously just whether they are set or not)

@tom-schultz
Copy link
Author

tom-schultz commented Feb 14, 2017 via email

@paperorplastic
Copy link

Additional information: I was just standing up a new cookbook and testing our our kitchen.yml to make sure it stood up an instance successfully when we hit the issue.

Reposting what I have found when I ran into this issue.

I'm not fully sure I understand the issue getting fixed here, but I upgraded to kitchen-ec2 1.3.0 in order to take advantage of PR #291 to get Windows 2016 AMI's working. Now when I'm trying to interact with the 2016 instance or my previously working 2012r2 instance, I get the following kitchen error:

c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.6.35/lib/aws-sdk-core/plugins/request_signer.rb:104:in **`require_credentials': unable to sign request without credentials set (Aws::Errors::MissingCredentialsError)**
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.6.35/lib/aws-sdk-core/plugins/request_signer.rb:94:in `sign_authenticated_requests'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.6.35/lib/aws-sdk-core/plugins/request_signer.rb:87:in `call'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.6.35/lib/aws-sdk-core/plugins/helpful_socket_errors.rb:10:in `call'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.6.35/lib/aws-sdk-core/plugins/retry_errors.rb:87:in `call'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.6.35/lib/aws-sdk-core/query/handler.rb:27:in `call'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.6.35/lib/aws-sdk-core/plugins/user_agent.rb:12:in `call'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.6.35/lib/seahorse/client/plugins/endpoint.rb:41:in `call'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.6.35/lib/aws-sdk-core/plugins/param_validator.rb:21:in `call'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.6.35/lib/seahorse/client/plugins/raise_response_errors.rb:14:in `call'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.6.35/lib/aws-sdk-core/plugins/idempotency_token.rb:18:in `call'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.6.35/lib/aws-sdk-core/plugins/param_converter.rb:20:in `call'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.6.35/lib/aws-sdk-core/plugins/response_paging.rb:26:in `call'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.6.35/lib/seahorse/client/plugins/response_target.rb:21:in `call'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.6.35/lib/seahorse/client/request.rb:70:in `send_request'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-2.6.35/lib/seahorse/client/base.rb:207:in `block (2 levels) in define_operation_methods'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-resources-2.6.35/lib/aws-sdk-resources/request.rb:24:in `call'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-resources-2.6.35/lib/aws-sdk-resources/operations.rb:41:in `call'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-resources-2.6.35/lib/aws-sdk-resources/operations.rb:61:in `call'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-resources-2.6.35/lib/aws-sdk-resources/resource.rb:147:in `load'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-resources-2.6.35/lib/aws-sdk-resources/resource.rb:120:in `data'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-resources-2.6.35/lib/aws-sdk-resources/resource.rb:223:in `block in add_data_attribute'
        from C:/Users/spitner/AppData/Local/chefdk/gem/ruby/2.3.0/gems/kitchen-ec2-1.3.0/lib/kitchen/driver/ec2.rb:588:in `show_chosen_image'
        from C:/Users/spitner/AppData/Local/chefdk/gem/ruby/2.3.0/gems/kitchen-ec2-1.3.0/lib/kitchen/driver/ec2.rb:255:in `image'
        from C:/Users/spitner/AppData/Local/chefdk/gem/ruby/2.3.0/gems/kitchen-ec2-1.3.0/lib/kitchen/driver/ec2.rb:281:in `actual_platform'
        from C:/Users/spitner/AppData/Local/chefdk/gem/ruby/2.3.0/gems/kitchen-ec2-1.3.0/lib/kitchen/driver/ec2.rb:558:in `default_windows_user_data'
        from C:/Users/spitner/AppData/Local/chefdk/gem/ruby/2.3.0/gems/kitchen-ec2-1.3.0/lib/kitchen/driver/ec2.rb:62:in `block in <class:Ec2>'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/lazy_hash.rb:135:in `proc_or_val'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/lazy_hash.rb:76:in `[]'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/configurable.rb:119:in `block in diagnose'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/configurable.rb:119:in `each'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/configurable.rb:119:in `diagnose'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:245:in `block in diagnose'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:243:in `each'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/instance.rb:243:in `diagnose'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/diagnostic.rb:125:in `block in prepare_instances'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/diagnostic.rb:125:in `each'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/diagnostic.rb:125:in `prepare_instances'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/diagnostic.rb:52:in `read'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/command/diagnose.rb:38:in `call'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/cli.rb:53:in `perform'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/cli.rb:143:in `diagnose'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/cli.rb:334:in `invoke_task'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/bin/kitchen:13:in `block in <top (required)>'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/lib/kitchen/errors.rb:171:in `with_friendly_errors'
        from c:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.14.2/bin/kitchen:13:in `<top (required)>'
        from c:/opscode/chefdk/bin/kitchen:24:in `load'
        from c:/opscode/chefdk/bin/kitchen:24:in `<main>'

This is mostly new ground for me in interacting with AWS EC2 instances, but I do know that what I had was working with 1.2.0 kitchen-ec2 and now it's not.

I'm running ChefDK 1.1.16 and Kitchen 1.14.2 and kitchen-ec2 1.3.0.

@tom-schultz
Copy link
Author

tom-schultz commented Feb 14, 2017

Reverting to 1.2.0 fixed this for me.

chef gem install kitchen-ec2 -v 1.2.0
chef gem uninstall kitchen-ec2 -v 1.3.0

@davidcpell
Copy link
Contributor

davidcpell commented Feb 15, 2017

@cheeseplus I believe this has to do with this line: https://github.com/test-kitchen/kitchen-ec2/blob/master/lib/kitchen/driver/aws/client.rb#L72

The way I changed it in #259, it only sources the shared credentials file if a profile name is provided. Originally, #loadable? was being called on an instance of Aws::SharedCredentials to see if the default profile existed, but at that time an exception was being raised by Aws::SharedCredentials.new (with no profile_name argument passed) if the credentials file (~/.aws/credentials) was found but contained no "default" profile. #258 contains the original issue that my PR #259 was trying to address.

davidcpell added a commit to davidcpell/kitchen-ec2 that referenced this issue Feb 15, 2017
This allows a user to rely on a [default] profile getting picked up in
the shared credentials file (~/.aws/credentials).

Fixes test-kitchen#295
Fixes test-kitchen#258
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

No branches or pull requests

4 participants