lib/kitchen/driver/vsphere.rb in chef-provisioning-vsphere-2.2.2 vs lib/kitchen/driver/vsphere.rb in chef-provisioning-vsphere-2.3.0
- old
+ new
@@ -1,11 +1,11 @@
# frozen_string_literal: true
-require 'json'
-require 'kitchen'
-require 'chef/provisioning/vsphere_driver'
-require 'chef/provisioning/machine_spec'
+require "json"
+require "kitchen"
+require "chef/provisioning/vsphere_driver"
+require "chef/provisioning/machine_spec"
# Main Kitchen Module
module Kitchen
# Main Kitchen::Driver Module
module Driver
@@ -19,18 +19,18 @@
stop_timeout: 600,
ready_timeout: 90,
bootstrap_options: {
use_linked_clone: true,
ssh: {
- user: 'root',
+ user: "root",
paranoid: false,
- port: 22
+ port: 22,
},
convergence_options: {},
customization_spec: {
- domain: 'local'
- }
+ domain: "local",
+ },
}
default_config(:vsphere_name) do |driver|
"#{driver.instance.name}-#{SecureRandom.hex(4)}"
end
@@ -51,12 +51,12 @@
rescue
raise
ensure
if machine_spec
if machine_spec.location
- state[:server_id] = machine_spec.location['server_id']
- state[:hostname] = machine_spec.location['ipaddress']
+ state[:server_id] = machine_spec.location["server_id"]
+ state[:hostname] = machine_spec.location["ipaddress"]
end
machine_spec.save(action_handler)
end
end
end
@@ -67,12 +67,12 @@
# @param [Object] state Uses state of the machine from Chef provisioning.
def destroy(state)
return if state[:server_id].nil?
with_provisioning_driver(state) do |action_handler, driver, machine_spec|
- machine_spec.location = { 'driver_url' => driver.driver_url,
- 'server_id' => state[:server_id] }
+ machine_spec.location = { "driver_url" => driver.driver_url,
+ "server_id" => state[:server_id] }
driver.destroy_machine(action_handler, machine_spec, config[:machine_options])
end
state.delete(:server_id)
state.delete(:hostname)
@@ -101,10 +101,10 @@
unless @@chef_zero_server
vsphere_mutex.synchronize do
unless @@chef_zero_server
Chef::Config.local_mode = true
Chef::Config.chef_repo_path = Chef::Config.find_chef_repo_path(Dir.pwd)
- require 'chef/local_mode'
+ require "chef/local_mode"
Chef::LocalMode.setup_server_connectivity
@@chef_zero_server = true
end
end
end