Bug #23342
closedvsphere - failed to create resource - undefined method first
Description
After upgrading to version 1.17 of foreman via ubuntu package, provisioning to vsphere no longer functions.
Here is the output from the console.
Here is the code that fails in /usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb
# === Power on # # Foreman will try and start this vm after clone in a seperate request. # def clone_vm(raw_args) args = parse_args(raw_args) opts = { "datacenter" => datacenter, "template_path" => args[:image_id], "dest_folder" => args[:path], "power_on" => false, "start" => args[:start], "name" => args[:name], "numCPUs" => args[:cpus], "numCoresPerSocket" => args[:corespersocket], "memoryMB" => args[:memory_mb], "datastore" => args[:volumes].first[:datastore], "storage_pod" => args[:volumes].first[:storage_pod], "resource_pool" => [args[:cluster], args[:resource_pool]], "boot_order" => [:disk], }
Line 498 is the line that fails which is the datastore line. I think this indicates that args[:volumes] is returning as undef. So runtime indicates that functions cannot be run from undef.
The problem is the args[:volumes] is not getting populated, although in the web ui, volumes is populated with a pull down list. I have selected the same volume as I have in previous versions of foreman which all have worked.
Foreman OS: Ubuntu 16.04
hypervisor: VMware ESXi, 6.0.0, 4600944
Files
Updated by Timo Goebel over 6 years ago
Michael, can you try if the patch from #23335 works for you? I believe (though have not tested it myself) that the issues have the same root cause.
Updated by Timo Goebel over 6 years ago
- Related to Bug #23335: Cannot create VM in a vCenter. NoMethodError. added
Updated by Michael Speth over 6 years ago
I tried to apply https://patch-diff.githubusercontent.com/raw/theforeman/foreman/pull/5475.patch
I didn't read far enough down, that this patch wouldn't work. So I then tried to apply https://gist.github.com/timogoebel/783d746a524964d8d81a8b7a828969a0
Now my system has failed:
We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it shortly.
This is the only line repeated in production.log
2018-04-23T10:08:48 [app] [I] Current user: foreman_admin (administrator)
Updated by Timo Goebel over 6 years ago
Michael, we have updated the patch.
Can you please test with this patch again?
https://github.com/theforeman/foreman/pull/5481.patch
Make sure to revert the hold patch (with patch -R) before and restart httpd after applying the patch. Thanks.
Updated by Michael Speth over 6 years ago
Timo Goebel wrote:
Michael, we have updated the patch.
Can you please test with this patch again?https://github.com/theforeman/foreman/pull/5481.patch
Make sure to revert the hold patch (with patch -R) before and restart httpd after applying the patch. Thanks.
This worked!