Skip to content

ironfan 6.1.6 doesn't respect AWS region / AZ defined for realm #355

@westbywest

Description

@westbywest

I'm trying out ironfan v6.1.6 gem within ironfan-homebase, and I discovered the latest version in master apparently does not respect the region or AZ I have defined for the realm, defaulting instead to us-east-1.

Here is what I see trying to launch an instance:

MyMac:ironfan-homebase mymachine$ bundle exec knife cluster launch dev1-sandbox-simple-0
no realm-specific Gemfile found. using default Gemfile.
Inventorying servers in dev1 realm, sandbox cluster, simple facet, servers 0
  sandbox:  Loading chef
  sandbox:  Loading ec2
  sandbox:  Reconciling DSL and provider information
  +-----------------------+-------+-------------+----------+------------+-------------+-------+
  | Name                  | Chef? | State       | Flavor   | AZ         | Env         | Realm |
  +-----------------------+-------+-------------+----------+------------+-------------+-------+
  | dev1-sandbox-simple-0 | no    | not running | m1.large | us-west-2a | development | dev1  |
  +-----------------------+-------+-------------+----------+------------+-------------+-------+
Syncing to chef
Preparing shared resources:
  sandbox:  Loading chef
  sandbox:  Loading ec2
  sandbox:  Reconciling DSL and provider information
Loaded information for 1 computer(s) in cluster sandbox
  dev1-sandbox: creating key pair for dev1-sandbox
  sandbox:  creating security groups
  dev1:           creating dev1 security group
  dev1-sandbox:   creating dev1-sandbox security group
  splice_aws:         creating splice_aws security group
  splice_ssh:         creating splice_ssh security group
  sandbox:  ensuring security group permissions
  dev1-sandbox:   ensuring access from dev1-sandbox to dev1-sandbox
  splice_ssh:         ensuring tcp access from 0.0.0.0/0 to 22..22

Launching computers
  +-----------------------+-------+-------------+----------+------------+-------------+-------+
  | Name                  | Chef? | State       | Flavor   | AZ         | Env         | Realm |
  +-----------------------+-------+-------------+----------+------------+-------------+-------+
  | dev1-sandbox-simple-0 | no    | not running | m1.large | us-west-2a | development | dev1  |
  +-----------------------+-------+-------------+----------+------------+-------------+-------+
  dev1-sandbox-simple-0:    creating cloud machine
WARNING: Error running #<Ironfan::Broker::Computer(server=#<Ironfan::Dsl::Server(name="0", components=c{  }, run_list_items=c{ role[splice_aws], role[dev1-sandbox-cluster], role[dev1-sandbox-simple-facet] }, clouds=c{ ec2 }, volumes=c{  }, security_groups=c{ dev1, dev1-sandbox }, environment=:development, realm_name="dev1", cluster_role=#<Ironfan::Dsl::Role>, facet_role=#<Ironfan::Dsl::Role>, cluster_names={:sandbox=>:sandbox}, cluster_name="sandbox", facet_name="simple")>, resources=c{  }, drives=c{ root, ephemeral0, ephemeral1 }, providers=c{ chef, iaas })>:
WARNING: Failed validation: {"mismatched region"=>["us-east-1", "us-west-2"]}
ERROR: Failed validation: {"mismatched region"=>["us-east-1", "us-west-2"]} (ArgumentError)
/Users/me/src/ironfan/lib/ironfan/provider/ec2/machine.rb:172:in `create!'
/Users/me/src/ironfan/lib/ironfan/broker/computer.rb:78:in `launch'
/Users/me/src/ironfan/lib/ironfan/broker/computer.rb:320:in `block in launch'
/Users/me/src/ironfan/lib/ironfan.rb:114:in `block (3 levels) in parallel'
/Users/me/src/ironfan/lib/ironfan.rb:123:in `safely'
/Users/me/src/ironfan/lib/ironfan.rb:113:in `block (2 levels) in parallel'
ERROR: /Users/me/src/ironfan/lib/ironfan/provider/ec2/machine.rb:172:in `create!'
/Users/me/src/ironfan/lib/ironfan/broker/computer.rb:78:in `launch'
/Users/me/src/ironfan/lib/ironfan/broker/computer.rb:320:in `block in launch'
/Users/me/src/ironfan/lib/ironfan.rb:114:in `block (3 levels) in parallel'
/Users/me/src/ironfan/lib/ironfan.rb:123:in `safely'
/Users/me/src/ironfan/lib/ironfan.rb:113:in `block (2 levels) in parallel'
ERROR: Error launching #<ArgumentError: Failed validation: {"mismatched region"=>["us-east-1", "us-west-2"]}>; skipping after-launch tasks.
Some computers could not be launched

This is the realm I have defined in $IRONFAN_HOMBASE/realms/dev1.rb:

#
# dev1 realm -- use this for general development
#
Ironfan.realm 'dev1' do
  cluster 'sandbox' do
    cloud(:ec2) do
      permanent           false
      availability_zones  %w[ us-west-2a ]
      flavor              'm1.large'
      backing             'ebs'
      image_name          'ironfan-precise'
      bootstrap_distro    'ubuntu12.04-ironfan'
      chef_client_script  'client.rb'
      mount_ephemerals
    end

    environment           :development

    role                :my_aws, :first
    cloud(:ec2).security_group :my_aws
    cloud(:ec2).security_group(:my_ssh).authorize_port_range 22..22

    facet :simple do
      instances           1
    end

    cluster_role.override_attributes({
                                     })
  end
end

I bundle ironfan v6.1.6 into ironfan-homebase by checking out a local copy of the repo and adding this to $IRONFAN_HOMBASE/Gemfile: gem 'ironfan', :path => "~/src/ironfan"

I can confirm that explicitly setting the same region in $IRONFAN_HOMBASE/knife/credentials/knife-org.rb does allow this instance to launch into the correct region:

Chef::Config.knife[:region]  = "us-west-2"

Is ironfan not picking up the AWS region specified for the realm?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions