From 84c4215b8ae31faac9e7157dab7e99d085deae09 Mon Sep 17 00:00:00 2001 From: Josh Barker Date: Fri, 6 Jul 2018 18:53:31 +1000 Subject: [PATCH] Improve logging for optional settings Signed-off-by: Josh Barker --- lib/chef/provisioning/vsphere_driver/driver.rb | 2 +- lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/chef/provisioning/vsphere_driver/driver.rb b/lib/chef/provisioning/vsphere_driver/driver.rb index b45458e..6140615 100644 --- a/lib/chef/provisioning/vsphere_driver/driver.rb +++ b/lib/chef/provisioning/vsphere_driver/driver.rb @@ -683,7 +683,7 @@ def clone_vm(action_handler, bootstrap_options, machine_spec) last_progress = progress end end - print "\n#{machine_name} done!" + print "\n#{machine_name} done!\n\n" vm = vsphere_helper.find_vm(vm_folder, machine_name) add_machine_spec_location(vm, machine_spec) diff --git a/lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb b/lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb index b63a320..d19ded0 100644 --- a/lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb +++ b/lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb @@ -265,6 +265,8 @@ def set_additional_disks_for(vm, datastore, additional_disk_size_gb) size = size.to_i next if size <= 0 + puts "Creating disk with #{size} GB" + task = vm.ReconfigVM_Task( spec: RbVmomi::VIM.VirtualMachineConfigSpec( deviceChange: [ @@ -278,6 +280,8 @@ def set_additional_disks_for(vm, datastore, additional_disk_size_gb) ) task.wait_for_completion end + + puts nil unless Array(additional_disk_size_gb).empty? end # Mounts the an iso on the first virtual CD ROm @@ -287,6 +291,8 @@ def set_additional_disks_for(vm, datastore, additional_disk_size_gb) def set_initial_iso(vm, initial_iso_image) return unless initial_iso_image + puts "Mounting #{initial_iso_image} on first virtual CD ROM", nil + d_obj = vm.config.hardware.device.select { |hw| hw.class == RbVmomi::VIM::VirtualCdrom }.first backing = RbVmomi::VIM::VirtualCdromIsoBackingInfo(fileName: initial_iso_image) @@ -327,6 +333,9 @@ def update_main_disk_size_for(vm, size_gb) end return false end + + puts "Changing main disk to #{size_gb} GB", nil + disk.capacityInKB = size_kb vm.ReconfigVM_Task( spec: RbVmomi::VIM.VirtualMachineConfigSpec(