Provisioning VM via foreman-vmware compute resource results in "Mac not set" even when provided and then "undefined method `merge' for nil:NilClass" when submitting a second time.
Attached log extract on exact error.
Steps to reproduce:
- Create a VMware compute resource.
- Create a new vm with default options except for resource pool and host password.
- On first submit it will say mac not set (regardless if you set it or not, see attached photo)
- On second submit the merge issue appears (see the second attached photo)
About the setup:
Foreman is standalone and not joined to a domain, neither is the VMware host.
OS is Ubuntu 16.04 kernel 4.4.0-81-generic
Ruby Version: 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
Goal: Setup auto provision of VM's from Foreman to Vmware.
Fixes #20118 - return error message
- Fixes #20118 - display error instead of NilClass
In some scenarios when editing a host in Foreman, the VM may not
exist in VMware anymore, e.g. was deleted or uuid is missing.
The host is handled as a new VM, but cannot be saved.
In this case, an error message should be shown.
- display failure message in case `compute_attributes` are missing
- add unit tests to check `setCompute`
- add integration test to check alert is displayed
- Fixes #20118 - return not found in ajax method
Instead of a NilClass error a not found status
is returned in case no compute resource is found
in the Ajax method `compute_resource_selected`.
- increase rubocop class length warning (unfortunately)