vmware-archive / vcloud-rest

Unofficial ruby bindings for VMware vCloud Director®
Apache License 2.0
29 stars 37 forks source link

Cannot change IP Allocation Mode and set static IP to VM when ip_allocation_mode is DHCP #51

Open cpumanaz opened 7 years ago

cpumanaz commented 7 years ago

When setting the ip for the network, the current state is checked. If there is no IP, the .first does not return a value and node is null leading to the error below. It's reasonable to expect that someone would want to use the API to change the allocation method to MANUAL, and then assign the IP address. Changing these two attributes results in the error as IP is null.

It is possible to do this in the web UI, but prevents automation with VMWare when compared to competing clouds like MS Azure or AWS.

Please update to allow changing to/from DHCP.

connection.rb lines 158-161

if config[:ip] node = picked_network.css('IpAddress').first node.content = config[:ip] end

/Ruby24-x64/lib/ruby/gems/2.4.0/gems/vcloud-rest-1.4.0/lib/vcloud-rest/vcloud/vm.rb:160:in edit_vm_network': undefined methodcontent=' for nil:NilClass (NoMethodError) from ./VMWareNicTest.rb:47:in `

'