我正在尝试使用自定义刀插件中的knife vsphere插件,如下所示:
Chef::Knife::VsphereVmClone.load_deps
Chef::Knife::Bootstrap.load_deps
require 'chef/knife/base_vsphere_command'
require 'chef/knife/vsphere_vm_clone.rb'
require 'rbvmomi'
require 'netaddr'
def self.create_instance()
createinstance = Chef::Knife::VsphereVmClone.new
createinstance.config['dest_folder'] = "xxxxxx"
createinstance.config['resource_pool'] = "xxxxx"
createinstance.config['source_vm'] = "xxxxx"
createinstance.config['chef_node_name'] = "xxxx"
createinstance.config['folder'] = "xxxxxx"
Chef::Config[:knife]['dest_folder'] = "xxxxxx"
Chef::Config[:knife]['resource_pool'] = "xxxxxxx"
createinstance.run
end
当我尝试调用此方法时,它会因以下错误而失败,并开始显示该命令的完整帮助。
You must supply --template TEMPLATE!
knife vsphere vm clone VMNAME (options)
我无法正确实例化VsphereVmClone
的对象并设置所需的值。
提供的任何指针都会有很大的帮助。