class Chef::Knife::VsphereVmMarkastemplate

Clone an existing template into a new VM, optionally applying a customization specification. usage: knife vsphere vm markastemplate MyVM –folder /templates Vspherevmmarkastemplate extends the Basevspherecommand

Public Instance Methods

run() click to toggle source

The main run method for vm_markastemplate

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

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

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

  puts "Marking VM #{vmname} as template"
  vm.MarkAsTemplate()
  puts "Finished marking VM #{vmname} as template"
end