class Chef::Knife::VsphereVmWaitSysprep

Wait for vm finishing Sysprep. usage: knife vsphere vm wait sysprep somemachine –sleep 30 \

--timeout 600

Public Instance Methods

run() click to toggle source

The main run method for vm_wait_sysprep.

# File lib/chef/knife/vsphere_vm_wait_sysprep.rb, line 41
def run
  $stdout.sync = true

  vmname = @name_args[0]
  if vmname.nil?
    show_usage
    fatal_exit("You must specify a virtual machine name")
  end

  sleep_time = get_config(:sleep).to_i
  sleep_timeout = get_config(:timeout).to_i

  vim = vim_connection
  vm = get_vm_by_name(vmname, get_config(:folder)) || fatal_exit("Could not find #{vmname}")

  CustomizationHelper.wait_for_sysprep(vm, vim, sleep_timeout, sleep_time)
end