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
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/kitchen/driver/ec2.rb', line 45 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. end |
#destroy(state) ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'lib/kitchen/driver/ec2.rb', line 58 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 |