Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Rubygems rbvmomi extraConfig更新失败,属性名为“意外”`_Rubygems_Vmware_Vsphere_Vmware Tools_Rbvmomi - Fatal编程技术网

Rubygems rbvmomi extraConfig更新失败,属性名为“意外”`

Rubygems rbvmomi extraConfig更新失败,属性名为“意外”`,rubygems,vmware,vsphere,vmware-tools,rbvmomi,Rubygems,Vmware,Vsphere,Vmware Tools,Rbvmomi,我正在使用vmomi gem来使用vsphere api。 以下是我所做的:- .... new_extra_config = [{"softPowerOff"=>"true"}] vm.ReconfigVM_Task(:spec => RbVmomi::VIM.VirtualMachineConfigSpec(:extraConfig => new_extra_config)).wait_for_completion .... 这会引发错误:- root/usr/local

我正在使用vmomi gem来使用vsphere api。 以下是我所做的:-

....
new_extra_config = [{"softPowerOff"=>"true"}]
vm.ReconfigVM_Task(:spec => RbVmomi::VIM.VirtualMachineConfigSpec(:extraConfig => new_extra_config)).wait_for_completion
....
这会引发错误:-

root/usr/local/share/gems/gems/rbvmomi-1.8.2/lib/rbvmomi/basic_types.rb:105:in `block in initialize': unexpected property name softPowerOff (RuntimeError)

有人能帮忙吗?

我还没有测试过这个,但我在其他数据类型中也看到类似的错误,我的解决方案是使用文档中定义的数据类型。在这种情况下,extraConfig应该是OptionValue对象。尝试:

new_extra_config = [RbVmomi::VIM::OptionValue.new(key: 'softPowerOff', value: 'true')]
参考资料:


我还没有对此进行测试,但我发现其他数据类型也存在类似的错误,我的解决方案是使用文档中定义的数据类型。在这种情况下,extraConfig应该是OptionValue对象。尝试:

new_extra_config = [RbVmomi::VIM::OptionValue.new(key: 'softPowerOff', value: 'true')]
参考资料: