Class: Kitchen::Driver::Softlayer
- Inherits:
-
SSHBase
- Object
- SSHBase
- Kitchen::Driver::Softlayer
- Defined in:
- lib/kitchen/driver/softlayer.rb
Overview
Softlayer driver for Kitchen. rubocop:disable Metrics/LineLength
Instance Method Summary collapse
-
#create(state) ⇒ Object
rubocop:disable Metrics/AbcSize.
- #destroy(state) ⇒ Object
Instance Method Details
#create(state) ⇒ Object
rubocop:disable Metrics/AbcSize
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/kitchen/driver/softlayer.rb', line 83 def create(state) config_server_name config[:disable_ssl_validation] && disable_ssl_validation config[:fqdn] = "#{config[:server_name]}.#{config[:domain]}" debug "fqdn: #{config[:fqdn]}" debug "server_name: #{config[:server_name]}" debug "server_name_prefix: #{config[:server_name_prefix]}" server = create_server unless find_server(config[:fqdn]) state[:server_id] = server.id info "Softlayer instance <#{state[:server_id]}> created." server.wait_for do print '.' ready? end info "\n(server ready)" tag_server(server) # set state[:hostname] to be able to setup ssh using Fog::SSH state[:hostname] = if config[:ssh_via_hostname] config[:server_name] elsif config[:alternate_ip] config[:alternate_ip] else get_ip(server) end setup_ssh(server, state) wait_for_ssh_key_access(state) rescue Fog::Errors::Error, Excon::Errors::Error => ex raise ActionFailed, ex. end |
#destroy(state) ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/kitchen/driver/softlayer.rb', line 113 def destroy(state) return if state[:server_id].nil? config[:disable_ssl_validation] && disable_ssl_validation server = compute.servers.get(state[:server_id]) server.destroy unless server.nil? || server.id.nil? wait_for_server_to_delete(state) if config[:destroy_wait] info "Softlayer instance <#{state[:server_id]}> destroyed." state.delete(:server_id) state.delete(:server_name) end |