chef-provisioning-vsphere 2.2.2 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'chef'
4
- require 'cheffish/merged_config'
5
- require 'chef/provisioning/driver'
6
- require 'chef/provisioning/machine/windows_machine'
7
- require 'chef/provisioning/machine/unix_machine'
8
- require 'chef/provisioning/vsphere_driver/clone_spec_builder'
9
- require 'chef/provisioning/vsphere_driver/version'
10
- require 'chef/provisioning/vsphere_driver/vsphere_helpers'
11
- require 'chef/provisioning/vsphere_driver/vsphere_url'
12
- require 'chef/provisioning/vsphere_driver/vm_helper'
3
+ require "chef"
4
+ require "cheffish/merged_config"
5
+ require "chef/provisioning/driver"
6
+ require "chef/provisioning/machine/windows_machine"
7
+ require "chef/provisioning/machine/unix_machine"
8
+ require "chef/provisioning/vsphere_driver/clone_spec_builder"
9
+ require "chef/provisioning/vsphere_driver/version"
10
+ require "chef/provisioning/vsphere_driver/vsphere_helpers"
11
+ require "chef/provisioning/vsphere_driver/vsphere_url"
12
+ require "chef/provisioning/vsphere_driver/vm_helper"
13
13
 
14
14
  # Provisions machines in vSphere.
15
15
  module ChefProvisioningVsphere
@@ -44,10 +44,10 @@ module ChefProvisioningVsphere
44
44
  #
45
45
  # @param [Object] h converts to key:value
46
46
  def self.symbolize_keys(h)
47
- Hash === h ?
47
+ Hash === h ? # rubocop:disable Style/MultilineTernaryOperator
48
48
  Hash[
49
49
  h.map do |k, v|
50
- [k.respond_to?(:to_sym) ? k.to_sym : k, symbolize_keys(v)]
50
+ [k.respond_to?(:to_sym) ? k.to_sym : k, symbolize_keys(v)] # rubocop:disable Style/NestedTernaryOperator
51
51
  end
52
52
  ] : h
53
53
  end
@@ -56,7 +56,8 @@ module ChefProvisioningVsphere
56
56
  #
57
57
  # @param [Object] hash_like converts to key:value
58
58
  def deep_symbolize(hash_like)
59
- return {} if hash_like.nil? || hash_like.empty?
59
+ return {} if hash_like.nil?
60
+
60
61
  r = {}
61
62
  hash_like.each do |key, value|
62
63
  value = deep_symbolize(value) if value.respond_to?(:values)
@@ -74,12 +75,12 @@ module ChefProvisioningVsphere
74
75
 
75
76
  uri = URI(driver_url)
76
77
  @connect_options = {
77
- provider: 'vsphere',
78
+ provider: "vsphere",
78
79
  host: uri.host,
79
80
  port: uri.port,
80
81
  use_ssl: uri.use_ssl,
81
82
  insecure: uri.insecure,
82
- path: uri.path
83
+ path: uri.path,
83
84
  }
84
85
 
85
86
  if driver_options
@@ -150,13 +151,13 @@ module ChefProvisioningVsphere
150
151
  )
151
152
  vm = vm_for(machine_spec)
152
153
  if vm
153
- Chef::Log.warn 'returning existing machine'
154
+ Chef::Log.warn "returning existing machine"
154
155
  return vm
155
156
  else
156
157
  Chef::Log.warn machine_msg(
157
158
  machine_spec.name,
158
- machine_spec.location['server_id'],
159
- 'no longer exists. Recreating ...'
159
+ machine_spec.location["server_id"],
160
+ "no longer exists. Recreating ..."
160
161
  )
161
162
  end
162
163
  end
@@ -173,7 +174,7 @@ module ChefProvisioningVsphere
173
174
  action_handler.performed_action(machine_msg(
174
175
  machine_spec.name,
175
176
  vm.config.instanceUuid,
176
- 'created'
177
+ "created"
177
178
  ))
178
179
  vm
179
180
  end
@@ -195,12 +196,12 @@ module ChefProvisioningVsphere
195
196
  # @param [Object] vm taken from Chef provisioning for all the vm state.
196
197
  def add_machine_spec_location(vm, machine_spec)
197
198
  machine_spec.location = {
198
- 'driver_url' => driver_url,
199
- 'driver_version' => VERSION,
200
- 'server_id' => vm.config.instanceUuid,
201
- 'is_windows' => is_windows?(vm),
202
- 'allocated_at' => Time.now.utc.to_s,
203
- 'ipaddress' => vm.guest.ipAddress
199
+ "driver_url" => driver_url,
200
+ "driver_version" => VERSION,
201
+ "server_id" => vm.config.instanceUuid,
202
+ "is_windows" => is_windows?(vm),
203
+ "allocated_at" => Time.now.utc.to_s,
204
+ "ipaddress" => vm.guest.ipAddress,
204
205
  }
205
206
  end
206
207
 
@@ -218,7 +219,7 @@ module ChefProvisioningVsphere
218
219
  Chef::Log.info machine_msg(
219
220
  machine_spec.name,
220
221
  vm.config.instanceUuid,
221
- 'already created'
222
+ "already created"
222
223
  )
223
224
  else
224
225
  vm = clone_vm(
@@ -239,14 +240,14 @@ module ChefProvisioningVsphere
239
240
  bootstrap_options.to_hash.each_pair do |key, value|
240
241
  if value.is_a?(Hash)
241
242
  temp_value = value.clone
242
- temp_value[:password] = '*********' if value.key?(:password)
243
+ temp_value[:password] = "*********" if value.key?(:password)
243
244
  else
244
245
  temp_value = value
245
246
  end
246
247
  description << " #{key}: #{temp_value.inspect}"
247
248
  end
248
249
  description
249
- end
250
+ end
250
251
 
251
252
  # Creates a string of specific Machine information
252
253
  #
@@ -270,7 +271,7 @@ module ChefProvisioningVsphere
270
271
  vm = start_machine(action_handler, machine_spec, machine_options)
271
272
  if vm.nil?
272
273
  raise "Machine #{machine_spec.name} does not have a server "\
273
- 'associated with it, or server does not exist.'
274
+ "associated with it, or server does not exist."
274
275
  end
275
276
 
276
277
  bootstrap_options = machine_options[:bootstrap_options]
@@ -291,7 +292,7 @@ module ChefProvisioningVsphere
291
292
  end
292
293
 
293
294
  ## Check if true available after added nic
294
- vm_helper.open_port?(machine_spec.location['ipaddress'], vm_helper.port) unless machine_spec.location['ipaddress'].nil?
295
+ vm_helper.open_port?(machine_spec.location["ipaddress"], vm_helper.port) unless machine_spec.location["ipaddress"].nil?
295
296
  machine
296
297
  end
297
298
 
@@ -312,7 +313,7 @@ module ChefProvisioningVsphere
312
313
  bootstrap_options,
313
314
  vm
314
315
  )
315
- if is_windows?(vm) && !new_nics.nil? && vm_helper.open_port?(machine_spec.location['ipaddress'], vm_helper.port)
316
+ if is_windows?(vm) && !new_nics.nil? && vm_helper.open_port?(machine_spec.location["ipaddress"], vm_helper.port)
316
317
  new_nics.each do |nic|
317
318
  nic_label = nic.device.deviceInfo.label
318
319
  machine.execute_always(
@@ -341,13 +342,13 @@ module ChefProvisioningVsphere
341
342
  # Customization below may change this to a valid ip
342
343
  wait_until_ready(action_handler, machine_spec, machine_options, vm)
343
344
 
344
- if !machine_spec.location['ipaddress'] || !has_ip?(machine_spec.location['ipaddress'], vm)
345
+ if !machine_spec.location["ipaddress"] || !has_ip?(machine_spec.location["ipaddress"], vm)
345
346
  # find the ip we actually want
346
347
  # this will be the static ip to assign
347
348
  # or the ip reported back by the vm if using dhcp
348
349
  # it *may* be nil if just cloned
349
350
  vm_ip = ip_to_bootstrap(bootstrap_options, vm) || vm.guest.ipAddress
350
- machine_spec.location['ipaddress'] = vm_ip
351
+ machine_spec.location["ipaddress"] = vm_ip
351
352
  transport = nil
352
353
  unless vm_ip.nil?
353
354
  transport = transport_for(machine_spec, bootstrap_options[:ssh], vm_ip)
@@ -356,7 +357,7 @@ module ChefProvisioningVsphere
356
357
  unless !transport.nil? && transport.available? && has_ip?(vm_ip, vm)
357
358
  attempt_ip(machine_options, action_handler, vm, machine_spec)
358
359
  end
359
- machine_spec.location['ipaddress'] = vm_ip # vm.guest.ipAddress vmWare ip_address here can be 0.0.0.0
360
+ machine_spec.location["ipaddress"] = vm_ip # vm.guest.ipAddress vmWare ip_address here can be 0.0.0.0
360
361
  action_handler.report_progress(
361
362
  "IP address obtained: #{machine_spec.location['ipaddress']}"
362
363
  )
@@ -368,14 +369,14 @@ module ChefProvisioningVsphere
368
369
  wait_for_transport(action_handler, machine_spec, machine_options, vm)
369
370
  rescue Timeout::Error
370
371
  # Only ever reboot once, and only if it's been less than 10 minutes since we stopped waiting
371
- if machine_spec.location['started_at'] ||
372
- remaining_wait_time(machine_spec, machine_options) < -(10 * 60)
372
+ if machine_spec.location["started_at"] ||
373
+ remaining_wait_time(machine_spec, machine_options) < -(10 * 60)
373
374
  raise
374
375
  else
375
376
  Chef::Log.warn(machine_msg(
376
377
  machine_spec.name,
377
378
  vm.config.instanceUuid,
378
- 'started but SSH did not come up. Rebooting...'
379
+ "started but SSH did not come up. Rebooting..."
379
380
  ))
380
381
  restart_server(action_handler, machine_spec, machine_options)
381
382
  wait_until_ready(action_handler, machine_spec, machine_options, vm)
@@ -392,18 +393,18 @@ module ChefProvisioningVsphere
392
393
  # @param [Object] machine_spec The spec required to talk to the VM.
393
394
  def attempt_ip(machine_options, action_handler, vm, machine_spec)
394
395
  vm_ip = ip_to_bootstrap(machine_options[:bootstrap_options], vm)
395
- machine_spec.location['ipaddress'] = vm_ip
396
+ machine_spec.location["ipaddress"] = vm_ip
396
397
 
397
398
  wait_for_ip(vm, machine_options, machine_spec, action_handler)
398
399
 
399
400
  unless has_ip?(vm_ip, vm)
400
- action_handler.report_progress 'rebooting...'
401
- if vm.guest.toolsRunningStatus != 'guestToolsRunning'
402
- msg = 'tools have stopped. current power state is '
401
+ action_handler.report_progress "rebooting..."
402
+ if vm.guest.toolsRunningStatus != "guestToolsRunning"
403
+ msg = "tools have stopped. current power state is "
403
404
  msg << vm.runtime.powerState
404
- msg << ' and tools state is '
405
+ msg << " and tools state is "
405
406
  msg << vm.guest.toolsRunningStatus
406
- msg << '. powering up server...'
407
+ msg << ". powering up server..."
407
408
  action_handler.report_progress(msg)
408
409
  vsphere_helper.start_vm(vm)
409
410
  else
@@ -430,11 +431,11 @@ module ChefProvisioningVsphere
430
431
  spec.identity.domain
431
432
  else
432
433
  bootstrap_options[:customization_spec][:domain]
433
- end
434
+ end
434
435
 
435
436
  return unless domain
436
437
 
437
- if is_windows?(vm) && domain != 'local'
438
+ if is_windows?(vm) && domain != "local"
438
439
  start = Time.now.utc
439
440
  trimmed_name = machine_spec.name.byteslice(0, 15)
440
441
  expected_name = "#{trimmed_name}.#{domain}"
@@ -442,8 +443,8 @@ module ChefProvisioningVsphere
442
443
  "waiting to domain join and be named #{expected_name}"
443
444
  )
444
445
  until (Time.now.utc - start) > 30 ||
445
- (vm.guest.hostName == expected_name)
446
- print '.'
446
+ (vm.guest.hostName == expected_name)
447
+ print "."
447
448
  sleep 5
448
449
  end
449
450
  end
@@ -460,12 +461,12 @@ module ChefProvisioningVsphere
460
461
  ip_to_bootstrap(bootstrap_options, vm)
461
462
  ready_timeout = machine_options[:ready_timeout] || 300
462
463
  msg1 = "waiting up to #{ready_timeout} seconds for customization"
463
- msg2 = " and find #{machine_spec.location['ipaddress']}" unless machine_spec.location['ipaddress'].nil? # unless vm_ip == vm.guest.ipAddress # RuntimeError: can't modify frozen String
464
+ msg2 = " and find #{machine_spec.location['ipaddress']}" unless machine_spec.location["ipaddress"].nil? # unless vm_ip == vm.guest.ipAddress # RuntimeError: can't modify frozen String
464
465
  msg = [msg1, msg2].join
465
466
  action_handler.report_progress msg
466
467
 
467
468
  vm_ip = ip_to_bootstrap(bootstrap_options, vm) || vm.guest.ipAddress
468
- machine_spec.location['ipaddress'] = vm_ip
469
+ machine_spec.location["ipaddress"] = vm_ip
469
470
  until transport_for(
470
471
  machine_spec,
471
472
  machine_options[:bootstrap_options][:ssh],
@@ -475,7 +476,7 @@ module ChefProvisioningVsphere
475
476
  "IP addresses found: #{all_ips_for(vm)}"
476
477
  )
477
478
  vm_ip = ip_to_bootstrap(bootstrap_options, vm) || vm.guest.ipAddress
478
- machine_spec.location['ipaddress'] = vm_ip
479
+ machine_spec.location["ipaddress"] = vm_ip
479
480
  if has_ip?(vm_ip, vm)
480
481
  transport_for(
481
482
  machine_spec,
@@ -527,7 +528,7 @@ module ChefProvisioningVsphere
527
528
  vsphere_helper.stop_vm(vm, machine_options[:stop_timeout])
528
529
  vm.Destroy_Task.wait_for_completion
529
530
  rescue RbVmomi::Fault => fault
530
- raise fault unless fault.fault.class.wsdl_name == 'ManagedObjectNotFound'
531
+ raise fault unless fault.fault.class.wsdl_name == "ManagedObjectNotFound"
531
532
  ensure
532
533
  machine_spec.location = nil
533
534
  end
@@ -579,7 +580,7 @@ module ChefProvisioningVsphere
579
580
  action_handler.perform_action "restart machine #{machine_spec.name} (#{driver_url})" do
580
581
  stop_machine(action_handler, machine_spec, machine_options)
581
582
  start_machine(action_handler, machine_spec, machine_options)
582
- machine_spec.location['started_at'] = Time.now.utc.to_s
583
+ machine_spec.location["started_at"] = Time.now.utc.to_s
583
584
  end
584
585
  end
585
586
 
@@ -591,24 +592,24 @@ module ChefProvisioningVsphere
591
592
  # @param [Object] _machine_spec The machine spec required to start the VM.
592
593
  # @param [Object] machine Machine object to connect to.
593
594
  def setup_ubuntu_dns(machine, bootstrap_options, _machine_spec)
594
- host_lookup = machine.execute_always('host google.com')
595
+ host_lookup = machine.execute_always("host google.com")
595
596
  if host_lookup.exitstatus != 0
596
- if host_lookup.stdout.include?('setlocale: LC_ALL')
597
- machine.execute_always('locale-gen en_US && update-locale LANG=en_US')
597
+ if host_lookup.stdout.include?("setlocale: LC_ALL")
598
+ machine.execute_always("locale-gen en_US && update-locale LANG=en_US")
598
599
  end
599
600
  distro = machine.execute_always("lsb_release -i | sed -e 's/Distributor ID://g'").stdout.strip
600
601
  Chef::Log.info "Found distro:#{distro}"
601
- if distro == 'Ubuntu'
602
- distro_version = machine.execute_always('lsb_release -r | sed -e s/[^0-9.]//g').stdout.strip.to_f
602
+ if distro == "Ubuntu"
603
+ distro_version = machine.execute_always("lsb_release -r | sed -e s/[^0-9.]//g").stdout.strip.to_f
603
604
  Chef::Log.info "Found distro version:#{distro_version}"
604
605
  if distro_version >= 12.04
605
- Chef::Log.info 'Ubuntu version 12.04 or greater. Need to patch DNS.'
606
- interfaces_file = '/etc/network/interfaces'
607
- nameservers = bootstrap_options[:customization_spec][:ipsettings][:dnsServerList].join(' ')
606
+ Chef::Log.info "Ubuntu version 12.04 or greater. Need to patch DNS."
607
+ interfaces_file = "/etc/network/interfaces"
608
+ nameservers = bootstrap_options[:customization_spec][:ipsettings][:dnsServerList].join(" ")
608
609
  machine.execute_always("if ! cat #{interfaces_file} | grep -q dns-search ; then echo 'dns-search #{bootstrap_options[:customization_spec][:domain]}' >> #{interfaces_file} ; fi")
609
610
  machine.execute_always("if ! cat #{interfaces_file} | grep -q dns-nameservers ; then echo 'dns-nameservers #{nameservers}' >> #{interfaces_file} ; fi")
610
- machine.execute_always('/etc/init.d/networking restart')
611
- machine.execute_always('apt-get -qq update')
611
+ machine.execute_always("/etc/init.d/networking restart")
612
+ machine.execute_always("apt-get -qq update")
612
613
  end
613
614
  end
614
615
  end
@@ -633,22 +634,22 @@ module ChefProvisioningVsphere
633
634
  end
634
635
 
635
636
  def remaining_wait_time(machine_spec, machine_options)
636
- if machine_spec.location['started_at']
637
+ if machine_spec.location["started_at"]
637
638
  (machine_options[:start_timeout] || 600) -
638
- (Time.now.utc - Time.parse(machine_spec.location['started_at']))
639
+ (Time.now.utc - Time.parse(machine_spec.location["started_at"]))
639
640
  else
640
641
  (machine_options[:create_timeout] || 600) -
641
- (Time.now.utc - Time.parse(machine_spec.location['allocated_at']))
642
+ (Time.now.utc - Time.parse(machine_spec.location["allocated_at"]))
642
643
  end
643
644
  end
644
645
 
645
646
  def wait_until_ready(action_handler, machine_spec, machine_options, vm)
646
- if vm.guest.toolsRunningStatus != 'guestToolsRunning'
647
+ if vm.guest.toolsRunningStatus != "guestToolsRunning"
647
648
  if action_handler.should_perform_actions
648
649
  action_handler.report_progress "waiting for #{machine_spec.name} (#{vm.config.instanceUuid} on #{driver_url}) to be ready ..."
649
650
  until remaining_wait_time(machine_spec, machine_options) < 0 ||
650
- (vm.guest.toolsRunningStatus == 'guestToolsRunning' && vm.guest.ipAddress && !vm.guest.ipAddress.empty?)
651
- print '.'
651
+ (vm.guest.toolsRunningStatus == "guestToolsRunning" && vm.guest.ipAddress && !vm.guest.ipAddress.empty?)
652
+ print "."
652
653
  sleep 5
653
654
  end
654
655
  action_handler.report_progress "#{machine_spec.name} is now ready"
@@ -658,7 +659,7 @@ module ChefProvisioningVsphere
658
659
 
659
660
  def vm_for(machine_spec)
660
661
  if machine_spec.location
661
- vsphere_helper.find_vm_by_id(machine_spec.location['server_id'])
662
+ vsphere_helper.find_vm_by_id(machine_spec.location["server_id"])
662
663
  end
663
664
  end
664
665
 
@@ -719,7 +720,7 @@ module ChefProvisioningVsphere
719
720
  )
720
721
  strategy = convergence_strategy_for(machine_spec, machine_options)
721
722
 
722
- if machine_spec.location['is_windows']
723
+ if machine_spec.location["is_windows"]
723
724
  Chef::Provisioning::Machine::WindowsMachine.new(
724
725
  machine_spec, transport, strategy
725
726
  )
@@ -732,13 +733,13 @@ module ChefProvisioningVsphere
732
733
 
733
734
  def is_windows?(vm)
734
735
  return false if vm.nil?
735
- vm.config.guestId.start_with?('win')
736
+ vm.config.guestId.start_with?("win")
736
737
  end
737
738
 
738
739
  def convergence_strategy_for(machine_spec, machine_options)
739
- require 'chef/provisioning/convergence_strategy/install_msi'
740
- require 'chef/provisioning/convergence_strategy/install_cached'
741
- require 'chef/provisioning/convergence_strategy/no_converge'
740
+ require "chef/provisioning/convergence_strategy/install_msi"
741
+ require "chef/provisioning/convergence_strategy/install_cached"
742
+ require "chef/provisioning/convergence_strategy/no_converge"
742
743
 
743
744
  mopts = machine_options[:convergence_options].to_hash.dup
744
745
  if mopts[:chef_server]
@@ -752,7 +753,7 @@ module ChefProvisioningVsphere
752
753
  )
753
754
  end
754
755
 
755
- if machine_spec.location['is_windows']
756
+ if machine_spec.location["is_windows"]
756
757
  Chef::Provisioning::ConvergenceStrategy::InstallMsi.new(
757
758
  mopts, config
758
759
  )
@@ -780,7 +781,7 @@ module ChefProvisioningVsphere
780
781
  action_handler.report_progress "waiting for #{machine_spec.name} (#{vm.config.instanceUuid} on #{driver_url}) to be connectable (transport up and running) ..."
781
782
 
782
783
  until remaining_wait_time(machine_spec, machine_options) < 0 || transport.available?
783
- print '.'
784
+ print "."
784
785
  sleep 5
785
786
  end
786
787
 
@@ -797,9 +798,9 @@ module ChefProvisioningVsphere
797
798
  def transport_for(
798
799
  machine_spec,
799
800
  remoting_options,
800
- ip = machine_spec.location['ipaddress']
801
+ ip = machine_spec.location["ipaddress"]
801
802
  )
802
- if machine_spec.location['is_windows']
803
+ if machine_spec.location["is_windows"]
803
804
  create_winrm_transport(ip, remoting_options)
804
805
  else
805
806
  create_ssh_transport(ip, remoting_options)
@@ -811,7 +812,7 @@ module ChefProvisioningVsphere
811
812
  # @param [String] host The host the VM is connecting to
812
813
  # @param [Object] options Options that are required to connect to the host from Chef-Provisioning
813
814
  def create_winrm_transport(host, options)
814
- require 'chef/provisioning/transport/winrm'
815
+ require "chef/provisioning/transport/winrm"
815
816
  winrm_transport = if options[:port] == 5986
816
817
  :ssl
817
818
  else
@@ -820,7 +821,7 @@ module ChefProvisioningVsphere
820
821
  port = options[:port] || vm_helper.port
821
822
  winrm_options = {
822
823
  user: (options[:user]).to_s,
823
- pass: options[:password]
824
+ pass: options[:password],
824
825
  }
825
826
  if options[:winrm_opts].nil?
826
827
  opt = options[:user].include?('\\') ? :disable_sspi : :basic_auth_only
@@ -828,12 +829,12 @@ module ChefProvisioningVsphere
828
829
  else
829
830
  winrm_options.merge!(options[:winrm_opts])
830
831
  end
831
- scheme = winrm_transport == :ssl ? 'https' : 'http'
832
+ scheme = winrm_transport == :ssl ? "https" : "http"
832
833
  endpoint = URI::Generic.build(
833
834
  scheme: scheme,
834
835
  host: host,
835
836
  port: port,
836
- path: '/wsman'
837
+ path: "/wsman"
837
838
  ).to_s
838
839
 
839
840
  Chef::Provisioning::Transport::WinRM.new(
@@ -849,14 +850,14 @@ module ChefProvisioningVsphere
849
850
  # @param [String] host The host the VM is connecting to
850
851
  # @param [Object] options Options that are required to connect to the host from Chef-Provisioning
851
852
  def create_ssh_transport(host, options)
852
- require 'chef/provisioning/transport/ssh'
853
+ require "chef/provisioning/transport/ssh"
853
854
  ssh_user = options[:user]
854
855
  options = options.each_with_object({}) { |(k, v), memo| memo[k.to_sym] = v; }
855
856
  Chef::Provisioning::Transport::SSH.new(
856
857
  host,
857
858
  ssh_user,
858
859
  options.to_hash,
859
- @config[:machine_options][:sudo] ? { prefix: 'sudo ' } : {},
860
+ @config[:machine_options][:sudo] ? { prefix: "sudo " } : {},
860
861
  config
861
862
  )
862
863
  end
@@ -883,7 +884,7 @@ module ChefProvisioningVsphere
883
884
  vm_ip = wait_for_ipv4(bootstrap_ipv4_timeout(bootstrap_options), vm)
884
885
  else
885
886
  until vm_guest_ip?(vm) || Time.now.utc - start_time > timeout
886
- print '.'
887
+ print "."
887
888
  sleep 1
888
889
  end
889
890
  vm_ip = vm.guest.ipAddress
@@ -891,7 +892,7 @@ module ChefProvisioningVsphere
891
892
 
892
893
  # Then check that it is reachable
893
894
  until Time.now.utc - start_time > timeout
894
- print '.'
895
+ print "."
895
896
  return vm_ip.to_s if vm_helper.open_port?(vm_ip, vm_helper.port, 1)
896
897
  sleep 1
897
898
  end
@@ -940,14 +941,14 @@ module ChefProvisioningVsphere
940
941
  end
941
942
  end
942
943
  end
943
- raise 'Timed out waiting for ipv4 address!'
944
+ raise "Timed out waiting for ipv4 address!"
944
945
  end
945
946
 
946
947
  # What is the VM guest IP
947
948
  #
948
949
  # @param [Object] vm The VM object from Chef-Provisioning
949
950
  def vm_guest_ip?(vm)
950
- vm.guest.guestState == 'running' && vm.guest.toolsRunningStatus == 'guestToolsRunning' && !vm.guest.ipAddress.nil?
951
+ vm.guest.guestState == "running" && vm.guest.toolsRunningStatus == "guestToolsRunning" && !vm.guest.ipAddress.nil?
951
952
  end
952
953
  end
953
954
  end