Bug 1697303

Summary: Editing Compute Resource fails with error "ActionView::Template::Error: undefined method `[]=' for #<ActiveModel::Errors:0x000000000a3f1308>"
Product: Red Hat Satellite Reporter: shisingh
Component: Compute Resources - VMWareAssignee: Chris Roberts <chrobert>
Status: CLOSED ERRATA QA Contact: Jitendra Yejare <jyejare>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4.2CC: aeladawy, chrobert, hmore, jpasqual, kuemmer, mhulan, oprazak, saydas
Target Milestone: ReleasedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-14 19:57:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description shisingh 2019-04-08 10:32:01 UTC
Description of problem: Not able to Edit the Vmware Compute Resource and host associated with the Compute Resource.

Error message while trying to Edit Compute Resource:

==============================
2019-04-05T14:15:20 [I|app|] Started GET "/compute_resources/1-vcenter-intern/edit" for 192.168.255.8 at 2019-04-05 14:15:20 +0200
2019-04-05T14:15:20 [I|app|4ce60] Processing by ComputeResourcesController#edit as HTML
2019-04-05T14:15:20 [I|app|4ce60]   Parameters: {"id"=>"1-vcenter-intern"}
2019-04-05T14:15:20 [I|app|4ce60] Current user: externer.dl.kuemmer (administrator)
2019-04-05T14:15:20 [I|app|4ce60]   Rendering compute_resources/edit.html.erb within layouts/application
2019-04-05T14:15:20 [I|app|4ce60]   Rendered compute_resources/form/_vmware.html.erb (15.8ms)
2019-04-05T14:15:20 [I|app|4ce60]   Rendered compute_resources/_form.html.erb (20.3ms)
2019-04-05T14:15:20 [I|app|4ce60]   Rendered compute_resources/edit.html.erb within layouts/application (21.6ms)
2019-04-05T14:15:20 [W|app|4ce60] Action failed
ActionView::Template::Error: undefined method `[]=' for #<ActiveModel::Errors:0x000000000a3f1308>
Did you mean?  []
/usr/share/foreman/app/helpers/compute_resources_helper.rb:70:in `rescue in list_datacenters'
/usr/share/foreman/app/helpers/compute_resources_helper.rb:66:in `list_datacenters'
/usr/share/foreman/app/views/compute_resources/form/_vmware.html.erb:4:in `_6e9b52025edf8d188f2fb9a2caec1057'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionview-5.1.6/lib/action_view/template.rb:157:in `block in render'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/notifications.rb:168:in `instrument'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionview-5.1.6/lib/action_view/template.rb:352:in `instrument_render_template'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/actionview-5.1.6/lib/action_view/template.rb:155:in `render'
==========================

Error message while trying to Edit Host associated with Compute Resource:

==========================
Oops, we're sorry but something went wrong ERF56-4248 [Foreman::FingerprintException]: The remote system presented a public key with hash 574e3795d870c42d1c04d399198d1258c0621b4721b4e67362a398dcf08e1630 but we're expecting a different hash. If you are sure the remote system is authentic, go to the compute resource edit page, press the 'Test Connection' or 'Load Datacenters' button and submit.
==========================

Version-Release number of selected component (if applicable):
Red Hat Satellite 6.4.2

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results: Unable to edit Compute resource or Hosts associated with Compute Resource.

Expected results: It should allow us to edit Compute resource or Hosts associated with Compute Resource.


Additional info: Upstream Bug Found:

https://projects.theforeman.org/issues/24526

Comment 4 Jitendra Yejare 2019-04-10 13:29:21 UTC
Verified !

@ Satellite 6.5 snap 23


Steps:
----------

1. Create VMWare Compute Resource in Satellite.
2. Update the PubKet from Foreman console as mentioned in comment 3.
3. Attempt to edit the VMWare Compute Resource and submit the updates.


Behavior(Expected):
---------------------

1. The updates to the VMWare CR are sent successfully
2. No errors observed


Success Logs:
------------------

Processing by ComputeResourcesController#update as HTML
2019-04-10T08:19:54 [I|app|c3d3d9c3]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"pewVGizQGUE02eb0biZc6kBpxPyyVMfXG1D0DA+WWoPj4BHAAvNb8b9SpoSimxZdmqJSeG87cC2UH9sizBb13w==", "compute_resource"=>{"name"=>"VMware", "provider"=>"Vmware", "description"=>"", "server"=>"vcenter.satellite.com", "user"=>"sateng", "datacenter"=>"RH_Engineering", "display_type"=>"vmrc", "set_console_password"=>"[FILTERED]", "caching_enabled"=>"0", "pubkey_hash"=>"bla", "location_ids"=>["2", "", "11"], "organization_ids"=>["1", "", "4"]}, "commit"=>"Submit", "id"=>"1-VMware"}
2019-04-10T08:19:54 [I|app|c3d3d9c3] Current user set to admin (admin)
2019-04-10T08:19:54 [I|aud|c3d3d9c3] ComputeResource (1) update event on caching_enabled true, false
2019-04-10T08:19:54 [I|aud|c3d3d9c3] ComputeResource (1) update event on organization_ids 1, 1, 4
2019-04-10T08:19:54 [I|aud|c3d3d9c3] ComputeResource (1) update event on location_ids 2, 2, 11
2019-04-10T08:19:54 [I|app|c3d3d9c3] Redirected to https://satellite.com/compute_resources
2019-04-10T08:19:54 [I|app|c3d3d9c3] Completed 302 Found in 150ms (ActiveRecord: 37.1ms)
2019-04-10T08:19:55 [I|app|] Started GET "/compute_resources" for 10.65.223.56 at 2019-04-10 08:19:55 -0400
2019-04-10T08:19:55 [I|app|635eb425] Processing by ComputeResourcesController#index as HTML
2019-04-10T08:19:55 [I|app|635eb425] Current user set to admin (admin)
2019-04-10T08:19:55 [I|app|635eb425]   Rendering compute_resources/index.html.erb within layouts/application
2019-04-10T08:19:55 [I|app|635eb425]   Rendered common/_pagination.html.erb (0.6ms)
2019-04-10T08:19:55 [I|app|635eb425]   Rendered compute_resources/index.html.erb within layouts/application (12.2ms)
2019-04-10T08:19:55 [I|app|635eb425]   Rendered common/_searchbar.html.erb (0.6ms)
2019-04-10T08:19:55 [I|app|635eb425]   Rendered layouts/_application_content.html.erb (1.8ms)
2019-04-10T08:19:55 [I|app|635eb425]   Rendering layouts/base.html.erb
2019-04-10T08:19:55 [I|app|635eb425]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_theme_satellite-3.0.1.11/app/views/foreman_theme_satellite/_theme_client_side_branding.js.erb (0.6ms)
2019-04-10T08:19:55 [I|app|635eb425]   Rendered layouts/base.html.erb (56.8ms)
2019-04-10T08:19:55 [I|app|635eb425] Completed 200 OK in 100ms (Views: 70.7ms | ActiveRecord: 6.9ms)
2019-04-10T08:19:56 [I|app|] Started GET "/notification_recipients" for 10.65.223.56 at 2019-04-10 08:19:56 -0400
2019-04-10T08:19:56 [I|app|8d374714] Processing by NotificationRecipientsController#index as JSON
2019-04-10T08:19:56 [I|app|8d374714] Current user set to admin (admin)
2019-04-10T08:19:56 [I|app|8d374714] Completed 200 OK in 10ms (Views: 0.2ms | ActiveRecord: 1.3ms)
2019-04-10T08:20:07 [I|app|] Started GET "/notification_recipients" for 10.65.223.56 at 2019-04-10 08:20:07 -0400
2019-04-10T08:20:07 [I|app|84b0810b] Processing by NotificationRecipientsController#index as JSON
2019-04-10T08:20:07 [I|app|84b0810b] Current user set to admin (admin)
2019-04-10T08:20:07 [I|app|84b0810b] Completed 200 OK in 10ms (Views: 0.1ms | ActiveRecord: 1.5ms)

Comment 5 Jitendra Yejare 2019-04-10 13:30:23 UTC
The updates to the Host also sent successfully. Cant put logs here as I dont see pubkey key in logs for host update. But it worked.

Comment 8 Bryan Kearney 2019-05-14 19:57:27 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:1222