rbvmomi extraConfig update fails with `unexpected property name`

120 views Asked by At

I am using vmomi gem for using vsphere api. Here is what I did :-

....
new_extra_config = [{"softPowerOff"=>"true"}]
vm.ReconfigVM_Task(:spec => RbVmomi::VIM.VirtualMachineConfigSpec(:extraConfig => new_extra_config)).wait_for_completion
....

This throws error :-

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)

Can someone help ?

1

There are 1 answers

0
jsmartt On

I haven't tested this, but I have seen similar errors with other data types, and the solution for me was to use the data types defined in the docs. In this case, extraConfig should be an OptionValue object. Try:

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

References: