Allow EC2/IAM endpoint configuration #34

Merged
merged 1 commit into from Aug 18, 2014

Projects

None yet

3 participants

@viglesiasce
Contributor

This commit allows configuration via environment variables as well as compute_options provided in
a recipe.

Examples:
with_driver 'fog:AWS', :compute_options => { :aws_access_key_id => 'YYYYYYYYYYYYYYYYY',
:aws_secret_access_key => 'XXXXXXXXXXXXXXXXXXXXXXX',
:ec2_endpoint => 'http://10.111.1.136:8773/services/compute/',
:iam_endpoint => 'http://10.111.1.136:8773/services/Euare/'}

Or use the following environment variables:
EC2_URL
AWS_IAM_URL

@viglesiasce viglesiasce Allow EC2/IAM endpoint configuration
This commit allows configuration via environment
variables as well as compute_options provided in
a recipe.
c5044c2
@chef-supermarket

Hi. Your friendly Curry bot here. Just letting you know that there are commit authors in this Pull Request who appear to not have signed a Chef CLA.

The following GitHub users do not appear to have signed a CLA:

Please sign the CLA here.

@jkeiser jkeiser commented on the diff Aug 18, 2014
lib/chef_metal_fog/providers/aws.rb
@@ -144,7 +158,11 @@ def self.aws_account_info_for(aws_profile)
options = {
:aws_access_key_id => aws_profile[:aws_access_key_id],
:aws_secret_access_key => aws_profile[:aws_secret_access_key],
- :aws_session_token => aws_profile[:aws_security_token]
+ :aws_session_token => aws_profile[:aws_security_token],
+ :host => URI(aws_profile[:iam_endpoint]).host,
+ :scheme => URI(aws_profile[:iam_endpoint]).scheme,
+ :port => URI(aws_profile[:iam_endpoint]).port,
+ :path => URI(aws_profile[:iam_endpoint]).path
@jkeiser
jkeiser Aug 18, 2014 Member

I can't figure out who uses host/scheme/port/path ... what are they used for? (It would be good to name them iam_*, too.)

@viglesiasce
viglesiasce Aug 18, 2014 Contributor

Those param names are what the Fog IAM connection requires:
https://github.com/fog/fog/blob/master/lib/fog/aws/iam.rb#L175

@jkeiser
Member
jkeiser commented Aug 18, 2014

@viglesiasce I think I'm blind, I simply can't figure out what code is going to use host/scheme/port/path--I don't see any full automatic merge of aws_profile into anything. How is the IAM endpoint communicated to fog, and how does it affect things?

@viglesiasce
Contributor

Hey @jkeiser!

The IAM parameters are passed as options when the Fog IAM connection is created:
https://github.com/viglesiasce/chef-metal-fog/blob/configure-endpoints/lib/chef_metal_fog/providers/aws.rb#L169

@jkeiser jkeiser merged commit 647fc3d into chef:master Aug 18, 2014
@jkeiser
Member
jkeiser commented Aug 18, 2014

Ah, I see! OK!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment