-
Notifications
You must be signed in to change notification settings - Fork 202
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
kitchen converge
failing - not prioritizing env vars over ~/.aws/credentials
#258
Comments
Not sure this is a kitchen thing, it might be an aws sdk thing. I know on our servers that have roles assigned to them in aws if they have a .aws/ folder cli calls will fail. Delete the .aws/ folder and the calls will work again as expected. |
@JaBurd I did a bit of digging and think I found the offending line:
I used
At this point, for me the BTW I'd be happy to open a PR to work on this with your or whoever's feedback if you think it's worth looking at. For now I can just add a |
WHY: Currently in `client.rb` there a number of places are checked for creds. A local variable representing the shared creds file in `~/.aws/credentials` is created before its known whether that option is even necessary (i.e. before all the switching begins). This was causing the client to error out on my machine because I use `ENV` variables and didn't have a `[default]` profile in my shared creds file, which is what this was trying to find (see test-kitchen#258). Rather than create this variable when it's not even clear that we need it, we can wait to use `Aws::SharedCredentials` when the control flow reaches that point and more highly prioritized options have been ruled out. This also simplifies a number of specs in `client_spec.rb` since the call to `SharedCredentials` doesn't need to be stubbed out every time.
WHY: Currently in `client.rb` there a number of places are checked for creds. A local variable representing the shared creds file in `~/.aws/credentials` is created before its known whether that option is even necessary (i.e. before all the switching begins). This was causing the client to error out on my machine because I use `ENV` variables and didn't have a `[default]` profile in my shared creds file, which is what this was trying to find (see test-kitchen#258). Rather than create this variable when it's not even clear that we need it, we can wait to use `Aws::SharedCredentials` when the control flow reaches that point and more highly prioritized options have been ruled out. This also simplifies a number of specs in `client_spec.rb` since the call to `SharedCredentials` doesn't need to be stubbed out every time.
WHY: Currently in `client.rb` there a number of places are checked for creds. A local variable representing the shared creds file in `~/.aws/credentials` is created before its known whether that option is even necessary (i.e. before all the switching begins). This was causing the client to error out on my machine because I use `ENV` variables and didn't have a `[default]` profile in my shared creds file, which is what this was trying to find (see test-kitchen#258). Rather than create this variable when it's not even clear that we need it, we can wait to use `Aws::SharedCredentials` when the control flow reaches that point and more highly prioritized options have been ruled out. This also simplifies a number of specs in `client_spec.rb` since the call to `SharedCredentials` doesn't need to be stubbed out every time.
WHY: Currently in `client.rb` there a number of places are checked for creds. A local variable representing the shared creds file in `~/.aws/credentials` is created before its known whether that option is even necessary (i.e. before all the switching begins). This was causing the client to error out on my machine because I use `ENV` variables and didn't have a `[default]` profile in my shared creds file, which is what this was trying to find (see test-kitchen#258). Rather than create this variable when it's not even clear that we need it, we can wait to use `Aws::SharedCredentials` when the control flow reaches that point and more highly prioritized options have been ruled out. This also simplifies a number of specs in `client_spec.rb` since the call to `SharedCredentials` doesn't need to be stubbed out every time.
WHY: Currently in `client.rb` there a number of places are checked for creds. A local variable representing the shared creds file in `~/.aws/credentials` is created before its known whether that option is even necessary (i.e. before all the switching begins). This was causing the client to error out on my machine because I use `ENV` variables and didn't have a `[default]` profile in my shared creds file, which is what this was trying to find (see test-kitchen#258). Rather than create this variable when it's not even clear that we need it, we can wait to use `Aws::SharedCredentials` when the control flow reaches that point and more highly prioritized options have been ruled out. This also simplifies a number of specs in `client_spec.rb` since the call to `SharedCredentials` doesn't need to be stubbed out every time.
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
Hi all,
My
kitchen converge
command is failing.kitchen diagnose --all
reveals this error:It's true that I have no
[default]
profile in my shared credentials file. However, according to the AWS SDK docs my environment variables should be prioritized over the credentials file. My environment variables are set correctly, and if I move~/.aws
to another location temporarily, the convergence works fine.So I guess my questions are:
Any idea why the shared file is being prioritized here? Is this actually an issue for the AWS SDK rather than kitchen-ec2 or is it possible that kitchen-ec2 is doing something to have the SDK check my creds file?
If I wanted to just use the creds file, how could I make kitchen-ec2 look for a profile other than
[default]
?The text was updated successfully, but these errors were encountered: