Skip to content

Commit

Permalink
Merge pull request CenturyLinkCloud#90 from josh-barker/improve-logging
Browse files Browse the repository at this point in the history
Improve logging for optional settings
  • Loading branch information
JJ Asghar authored Jul 9, 2018
2 parents 7ebf75f + 84c4215 commit 5797dc4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/chef/provisioning/vsphere_driver/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions lib/chef/provisioning/vsphere_driver/vsphere_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand All @@ -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
Expand All @@ -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)

Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 5797dc4

Please sign in to comment.