lib/kitchen/driver/centurylink.rb in kitchen-centurylink-0.1.5 vs lib/kitchen/driver/centurylink.rb in kitchen-centurylink-0.1.6

- old
+ new

@@ -29,11 +29,11 @@ # @author Anthony Howell class Centurylink < Kitchen::Driver::SSHBase default_config :username, 'root' default_config :password, 'Kitchen123' default_config :server_name, 'test' - default_config :alias, 'DFT' + default_config :accountAlias, 'DFT' default_config :cpu, 2 default_config :memoryGB, 4 default_config :serverTemplate, 'CENTOS-6-64-TEMPLATE' default_config :type, 'standard' default_config :assign_public_ip, false @@ -54,17 +54,17 @@ end @@client.setToken(config[:token] || state[:token]) queueId = create_server - serverInfo = @@client.getServerDetails(config[:alias], queueId + '?uuid=True') + serverInfo = @@client.getServerDetails(config[:accountAlias], queueId + '?uuid=True') info 'Checking server status before continuing' while serverInfo['status'] != 'active' do info "Server not up. Server status is: #{serverInfo['status']}." - serverInfo = @@client.getServerDetails(config[:alias], queueId + '?uuid=True') + serverInfo = @@client.getServerDetails(config[:accountAlias], queueId + '?uuid=True') sleep 20 end info serverInfo state[:server_id] = serverInfo["id"] info "Created server with id #{state[:server_id]}" @@ -80,21 +80,21 @@ def destroy(state) info "Sending delete request for server #{state[:server_id]}" @@client.setToken(config[:token] || state[:token]) - response = @@client.deleteServer(config[:alias], state[:server_id]) + response = @@client.deleteServer(config[:accountAlias], state[:server_id]) if response['isQueued'] == true info 'Delete request is queued up' state.delete(:server_id) state.delete(:hostname) end end def create_server info 'Sending create server request' - response = @@client.createServer(config[:alias], + response = @@client.createServer(config[:accountAlias], { :name => config[:server_name], :groupId => config[:groupId], :cpu => config[:cpu], :memoryGB => config[:memoryGB], @@ -109,26 +109,26 @@ serverId end def assign_public_ip(state) - response = @@client.addPublicIpAddress(config[:alias], state[:server_id], { + response = @@client.addPublicIpAddress(config[:accountAlias], state[:server_id], { :ports => [ {:protocol => 'TCP', :port => 80}, {:protocol => 'TCP', :port => 8080}, {:protocol => 'TCP', :port => 443}, {:protocol => 'TCP', :port => 22}, ]}) puts response statusId = response['id'] - status = @@client.getQueueStatus(config[:alias], statusId) + status = @@client.getQueueStatus(config[:accountAlias], statusId) while status['status'] != 'succeeded' do info "Waiting for public IP job to complete. Status is #{status["status"]}" sleep 20 - status = @@client.getQueueStatus(config[:alias], statusId) + status = @@client.getQueueStatus(config[:accountAlias], statusId) end - serverInfo = @@client.getServerDetails(config[:alias], state[:server_id]) + serverInfo = @@client.getServerDetails(config[:accountAlias], state[:server_id]) state[:hostname] = serverInfo['details']['ipAddresses'].find {|ipSet| ipSet['public'] }['public'] info "Assigned public IP of: #{state[:hostname]}" end def generateToken(state)