chef-provisioning-vsphere 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4e71e31626651f823006e5840334c2657d737a5
4
- data.tar.gz: f681531d8693a2cf0339c56fb9dd79345eba07fc
3
+ metadata.gz: db6d5c3d59108b03b2a029d28ea964177b662d3f
4
+ data.tar.gz: 002c4faa621c11d98ac61aa0520cf01beda33f5e
5
5
  SHA512:
6
- metadata.gz: 46304efbe3b4c6601a4ffd873db3aa53ed7c9ce565ea62e113161b11694ae1d723283bea0dd12f5d1c62d8281bec717570e4f0c90b3cc0df8072049634ea8011
7
- data.tar.gz: 6b06cea303a50af9937253ffeb72564df58fe9e76540596d5116374b404258dfc7baa0e2eae3cff009a14d895d9cdc98b92261607818b78d0e9e59ab6cb9e03b
6
+ metadata.gz: 19483a0d6ce2f112ddaa71021f01bb5e6bb01079d7ca48e060201fe167666e004b4476154d07b709be62fb02ad6e76ec0c0730c35566e4b7fa7d23ddc40c69fd
7
+ data.tar.gz: bd2984e7b7daf67e1acf20d03969346cb949c423566adce6a45bf70f663da1d5aa14591b166b0846fa7e59bef2ea1a0667e28f0bc3a65430b44992c08e840d49
data/.gitignore CHANGED
@@ -7,4 +7,5 @@ Gemfile.lock
7
7
  my_cookbook
8
8
  .DS_Store
9
9
  doc/
10
- .yardoc/
10
+ .yardoc/
11
+ .kitchen/
data/CHANGELOG.md CHANGED
@@ -1,7 +1,19 @@
1
1
  # Change Log
2
2
 
3
- ## [2.0.4](https://github.com/chef-partners/chef-provisioning-vsphere/tree/2.0.4) (2017-05-24)
4
- [Full Changelog](https://github.com/chef-partners/chef-provisioning-vsphere/compare/v2.0.3...2.0.4)
3
+ ## [2.0.5](https://github.com/chef-partners/chef-provisioning-vsphere/tree/2.0.5) (2017-06-06)
4
+ [Full Changelog](https://github.com/chef-partners/chef-provisioning-vsphere/compare/v2.0.4...2.0.5)
5
+
6
+ **Closed issues:**
7
+
8
+ - kitchen destroy not destroying machines [\#37](https://github.com/chef-partners/chef-provisioning-vsphere/issues/37)
9
+
10
+ **Merged pull requests:**
11
+
12
+ - @vm\_helper.ip is this global structure, which gets set to the current… [\#41](https://github.com/chef-partners/chef-provisioning-vsphere/pull/41) ([jjlimepoint](https://github.com/jjlimepoint))
13
+ - Handle blank guest IP address that generates multiple different errors. [\#38](https://github.com/chef-partners/chef-provisioning-vsphere/pull/38) ([Belogix](https://github.com/Belogix))
14
+
15
+ ## [v2.0.4](https://github.com/chef-partners/chef-provisioning-vsphere/tree/v2.0.4) (2017-05-24)
16
+ [Full Changelog](https://github.com/chef-partners/chef-provisioning-vsphere/compare/v2.0.3...v2.0.4)
5
17
 
6
18
  **Merged pull requests:**
7
19
 
@@ -283,14 +283,14 @@ module ChefProvisioningVsphere
283
283
 
284
284
  machine = machine_for(machine_spec, machine_options)
285
285
 
286
- setup_extra_nics(action_handler, bootstrap_options, vm, machine)
286
+ setup_extra_nics(action_handler, bootstrap_options, vm, machine, machine_spec)
287
287
 
288
288
  if has_static_ip(bootstrap_options) && !is_windows?(vm)
289
289
  setup_ubuntu_dns(machine, bootstrap_options, machine_spec)
290
290
  end
291
291
 
292
292
  ## Check if true available after added nic
293
- @vm_helper.open_port?(@vm_helper.ip, @vm_helper.port) unless @vm_helper.ip.nil?
293
+ @vm_helper.open_port?(machine_spec.location["ipaddress"], @vm_helper.port) unless machine_spec.location["ipaddress"].nil?
294
294
  machine
295
295
  end
296
296
 
@@ -300,7 +300,7 @@ module ChefProvisioningVsphere
300
300
  # @param [Object] bootstrap_options taken from Chef provisioning for all the bootstrap options.
301
301
  # @param [Object] vm The VM object.
302
302
  # @param [Object] machine The machine object.
303
- def setup_extra_nics(action_handler, bootstrap_options, vm, machine)
303
+ def setup_extra_nics(action_handler, bootstrap_options, vm, machine, machine_spec)
304
304
  networks = bootstrap_options[:network_name]
305
305
  networks = [networks] if networks.is_a?(String)
306
306
  return if networks.nil? || networks.count < 2
@@ -311,7 +311,7 @@ module ChefProvisioningVsphere
311
311
  bootstrap_options,
312
312
  vm
313
313
  )
314
- if is_windows?(vm) && !new_nics.nil? && @vm_helper.open_port?(@vm_helper.ip, @vm_helper.port)
314
+ if is_windows?(vm) && !new_nics.nil? && @vm_helper.open_port?(machine_spec.location["ipaddress"], @vm_helper.port)
315
315
  new_nics.each do |nic|
316
316
  nic_label = nic.device.deviceInfo.label
317
317
  machine.execute_always(
@@ -346,6 +346,7 @@ module ChefProvisioningVsphere
346
346
  # or the ip reported back by the vm if using dhcp
347
347
  # it *may* be nil if just cloned
348
348
  vm_ip = ip_to_bootstrap(bootstrap_options, vm) || vm.guest.ipAddress
349
+ machine_spec.location["ipaddress"] = vm_ip
349
350
  transport = nil
350
351
  unless vm_ip.nil?
351
352
  transport = transport_for(machine_spec, bootstrap_options[:ssh], vm_ip)
@@ -356,7 +357,7 @@ module ChefProvisioningVsphere
356
357
  end
357
358
  machine_spec.location["ipaddress"] = vm_ip # vm.guest.ipAddress vmWare ip_address here can be 0.0.0.0
358
359
  action_handler.report_progress(
359
- "IP address obtained: #{machine_spec.location['ipaddress']}"
360
+ "IP address obtained: #{machine_spec.location["ipaddress"]}"
360
361
  )
361
362
  end
362
363
 
@@ -390,6 +391,7 @@ module ChefProvisioningVsphere
390
391
  # @param [Object] machine_spec The spec required to talk to the VM.
391
392
  def attempt_ip(machine_options, action_handler, vm, machine_spec)
392
393
  vm_ip = ip_to_bootstrap(machine_options[:bootstrap_options], vm)
394
+ machine_spec.location["ipaddress"] = vm_ip
393
395
 
394
396
  wait_for_ip(vm, machine_options, machine_spec, action_handler)
395
397
 
@@ -457,11 +459,12 @@ module ChefProvisioningVsphere
457
459
  ip_to_bootstrap(bootstrap_options, vm)
458
460
  ready_timeout = machine_options[:ready_timeout] || 300
459
461
  msg1 = "waiting up to #{ready_timeout} seconds for customization"
460
- msg2 = " and find #{@vm_helper.ip}" if @vm_helper.ip? # unless vm_ip == vm.guest.ipAddress # RuntimeError: can't modify frozen String
462
+ 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
461
463
  msg = [msg1, msg2].join
462
464
  action_handler.report_progress msg
463
465
 
464
466
  vm_ip = ip_to_bootstrap(bootstrap_options, vm) || vm.guest.ipAddress
467
+ machine_spec.location["ipaddress"] = vm_ip
465
468
  until transport_for(
466
469
  machine_spec,
467
470
  machine_options[:bootstrap_options][:ssh],
@@ -471,6 +474,7 @@ module ChefProvisioningVsphere
471
474
  "IP addresses found: #{all_ips_for(vm)}"
472
475
  )
473
476
  vm_ip = ip_to_bootstrap(bootstrap_options, vm) || vm.guest.ipAddress
477
+ machine_spec.location["ipaddress"] = vm_ip
474
478
  if has_ip?(vm_ip, vm)
475
479
  transport_for(
476
480
  machine_spec,
@@ -869,24 +873,25 @@ module ChefProvisioningVsphere
869
873
  # @param [Object] vm The VM object from Chef-Provisioning
870
874
  def ip_to_bootstrap(bootstrap_options, vm)
871
875
  @vm_helper.find_port?(vm, bootstrap_options) unless vm_helper.port?
876
+ vm_ip = nil
872
877
  if has_static_ip(bootstrap_options)
873
878
  if bootstrap_options[:customization_spec].is_a?(String)
874
879
  spec = vsphere_helper.find_customization_spec(bootstrap_options[:customization_spec])
875
- @vm_helper.ip = spec.nicSettingMap[0].adapter.ip.ipAddress
880
+ vm_ip = spec.nicSettingMap[0].adapter.ip.ipAddress
876
881
  else
877
882
  ## Check if true available
878
- @vm_helper.ip = bootstrap_options[:customization_spec][:ipsettings][:ip] unless vm_helper.ip?
879
- print "." until @vm_helper.open_port?(@vm_helper.ip, @vm_helper.port, 1)
883
+ vm_ip = bootstrap_options[:customization_spec][:ipsettings][:ip] unless vm_helper.ip?
884
+ print "." until @vm_helper.open_port?(vm_ip, @vm_helper.port, 1)
880
885
  end
881
886
  else
882
887
  if use_ipv4_during_bootstrap?(bootstrap_options)
883
- until @vm_helper.open_port?(@vm_helper.ip, @vm_helper.port, 1)
888
+ until @vm_helper.open_port?(vm_ip, @vm_helper.port, 1)
884
889
  wait_for_ipv4(bootstrap_ip_timeout(bootstrap_options), vm)
885
890
  end
886
891
  end
887
- @vm_helper.ip = vm.guest.ipAddress until vm_guest_ip?(vm) && @vm_helper.open_port?(@vm_helper.ip, @vm_helper.port, 1) # Don't set empty ip
892
+ vm_ip = vm.guest.ipAddress until vm_guest_ip?(vm) && @vm_helper.open_port?(vm_ip, @vm_helper.port, 1) # Don't set empty ip
888
893
  end
889
- @vm_helper.ip.to_s
894
+ vm_ip.to_s
890
895
  end
891
896
 
892
897
  # Force IPv4 a bootstrap, default: false
@@ -922,10 +927,10 @@ module ChefProvisioningVsphere
922
927
  while start_search_ip && (tries += 1) <= max_tries
923
928
  print "."
924
929
  sleep sleep_time
925
- @vm_helper.ip = vm.guest.ipAddress if vm_guest_ip?(vm)
926
- start_search_ip = false if @vm_helper.open_port?(@vm_helper.ip, @vm_helper.port, 1)
930
+ vm_ip = vm.guest.ipAddress if vm_guest_ip?(vm)
931
+ start_search_ip = false if @vm_helper.open_port?(vm_ip, @vm_helper.port, 1)
927
932
  end
928
- raise "Timed out waiting for ipv4 address!" if tries > max_tries && !IPAddr.new(vm.guest.ipAddress).ipv4?
933
+ raise "Timed out waiting for ipv4 address!" if tries > max_tries
929
934
  puts "Found ipv4 address!"
930
935
  true
931
936
  end
@@ -2,5 +2,5 @@
2
2
  # Provisions machines in vSphere.
3
3
  module ChefProvisioningVsphere
4
4
  # The version of this awesome Gem. BOOM.
5
- VERSION = "2.0.4".freeze
5
+ VERSION = "2.0.5".freeze
6
6
  end
@@ -57,6 +57,7 @@ module ChefProvisioningVsphere
57
57
  # @param [Integer] timeout The number of seconds before timeout.
58
58
  # @return [true] Returns true when the socket is available to connect.
59
59
  def open_port?(host, port, timeout = 5)
60
+ return false if host.to_s.empty?
60
61
  true if ::Socket.tcp(host, port, connect_timeout: timeout)
61
62
  rescue *RESCUE_EXCEPTIONS_ON_ESTABLISH
62
63
  false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-provisioning-vsphere
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - CenturyLink Cloud
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-05-24 00:00:00.000000000 Z
12
+ date: 2017-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rbvmomi