Class: Kitchen::Driver::Ec2
- Inherits:
-
SSHBase
- Object
- SSHBase
- Kitchen::Driver::Ec2
- Defined in:
- lib/kitchen/driver/ec2.rb
Overview
Amazon EC2 driver for Test Kitchen.
Instance Method Summary collapse
Instance Method Details
#create(state) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/kitchen/driver/ec2.rb', line 68 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] = hostname(server) wait_for_sshd(state[:hostname], config[:username]) print '(ssh ready)\n' debug("ec2:create '#{state[:hostname]}'") rescue Fog::Errors::Error, Excon::Errors::Error => ex raise ActionFailed, ex. end |
#default_ami ⇒ Object
93 94 95 96 |
# File 'lib/kitchen/driver/ec2.rb', line 93 def default_ami region = amis['regions'][config[:region]] region && region[instance.platform.name] end |
#default_username ⇒ Object
98 99 100 |
# File 'lib/kitchen/driver/ec2.rb', line 98 def default_username amis['usernames'][instance.platform.name] || 'root' end |
#destroy(state) ⇒ Object
83 84 85 86 87 88 89 90 91 |
# File 'lib/kitchen/driver/ec2.rb', line 83 def destroy(state) return if state[:server_id].nil? server = connection.servers.get(state[:server_id]) server.destroy unless server.nil? info("EC2 instance <#{state[:server_id]}> destroyed.") state.delete(:server_id) state.delete(:hostname) end |