Bug #10872
openCannot associate existing VM
Description
When attempting to associate an existing virtual machine on a VMWare host I get the following error when I click the "Associate VM" button:
undefined method `name' for nil:NilClass
Stacktrace:
NoMethodError
undefined method `name' for nil:NilClass
app/models/compute_resources/foreman/model/vmware.rb:423:in `associated_host'
app/controllers/compute_resources_vms_controller.rb:38:in `associate'
app/controllers/concerns/application_shared.rb:13:in `set_timezone'
app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'
And the log output:
Started PUT "/compute_resources/2-10-85-60-15/vms/52c2df5f-a663-b97e-21e4-1f2cd623de16/associate" for XXX.XXX.XXX.2 at 2015-06-18 14:43:29 -0400
2015-06-18 14:43:29 [I] Processing by ComputeResourcesVmsController#associate as HTML
2015-06-18 14:43:29 [I] Parameters: {"authenticity_token"=>"******************************", "compute_resource_id"=>"2-10-85-60-15", "id"=>"52c2df5f-a663-b97e-21e4-1f2cd623de16"}
2015-06-18 14:43:29 [I] Successfully decrypted field for Foreman::Model::Vmware XXX.XXX.XXX.15
2015-06-18 14:43:29 [W] Operation FAILED: undefined method `name' for nil:NilClass
2015-06-18 14:43:29 [I] Rendered common/500.html.erb within layouts/application (4.8ms)
2015-06-18 14:43:29 [I] Rendered layouts/base.html.erb (1.2ms)
2015-06-18 14:43:29 [I] Completed 500 Internal Server Error in 379ms (Views: 8.7ms | ActiveRecord: 5.0ms)