lib/kitchen/driver/ec2.rb in kitchen-ec2-0.4.0 vs lib/kitchen/driver/ec2.rb in kitchen-ec2-0.5.0

- old
+ new

@@ -31,22 +31,28 @@ class Ec2 < Kitchen::Driver::SSHBase default_config :region, 'us-east-1' default_config :availability_zone, 'us-east-1b' default_config :flavor_id, 'm1.small' - default_config :groups, [ 'default' ] + default_config :groups, ['default'] + default_config :tags, { 'created-by' => 'test-kitchen' } default_config :username, 'root' - default_config :port, '22' + required_config :aws_access_key_id + required_config :aws_secret_access_key + required_config :aws_ssh_key_id + required_config :image_id + def create(state) server = create_server state[:server_id] = server.id info("EC2 instance <#{state[:server_id]}> created.") server.wait_for { print "."; ready? } ; print "(server ready)" state[:hostname] = server.public_ip_address wait_for_sshd(state[:hostname]) ; print "(ssh ready)\n" + debug("ec2:create '#{state[:hostname]}'") rescue Fog::Errors::Error, Excon::Errors::Error => ex raise ActionFailed, ex.message end def destroy(state) @@ -69,16 +75,29 @@ :region => config[:region], ) end def create_server + debug_server_config + connection.servers.create( :availability_zone => config[:availability_zone], :groups => config[:groups], + :tags => config[:tags], :flavor_id => config[:flavor_id], :image_id => config[:image_id], :key_name => config[:aws_ssh_key_id], ) + end + + def debug_server_config + debug("ec2:region '#{config[:region]}'") + debug("ec2:availability_zone '#{config[:availability_zone]}'") + debug("ec2:flavor_id '#{config[:flavor_id]}'") + debug("ec2:image_id '#{config[:image_id]}'") + debug("ec2:groups '#{config[:groups]}'") + debug("ec2:tags '#{config[:tags]}'") + debug("ec2:key_name '#{config[:aws_ssh_key_id]}'") end end end end