Bug 1193485

Summary: AJAX call returns 500 when discovery provisioning is finished
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: WebUIAssignee: orabin
WebUI sub component: Foreman QA Contact: Sachin Ghai <sghai>
Status: CLOSED CURRENTRELEASE Docs Contact:
Severity: high    
Priority: low CC: bkearney, jmontleo, lzap, mhulan, mmccune
Version: 6.1.0Keywords: Triaged
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/9424
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 13:56:31 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:
Bug Depends On:    
Bug Blocks: 1193977    
Attachments:
Description Flags
UI raises 500 Internal Server Error on provisioning a discovered host
none
undefined method `managed?' for nil:NilClass on accessing the https://<host_name>/discovered_hosts/mac525400df80c8/edit
none
no error in firebug when discovered host submitted for provisioning none

Description Sachin Ghai 2015-02-17 12:59:39 UTC
Created attachment 992654 [details]
UI raises 500 Internal Server Error on provisioning a discovered host

Description of problem:
I was trying to provision a discovered host manually. And I click on 'provision' from discovered_host page. I filled all details and submit it.

On submitting the form UI raises following error in firebug:

"NetworkError: 500 Internal Server Error - https://dhcp201-167.englab.pnq.redhat.com/discovered_hosts/mac525400df80c8/edit"

production.log contains:

Processing by HostsController#resources as HTML
  Parameters: {"range"=>"7", "id"=>"mac525400df80c8.englab.pnq.redhat.com"}
  Rendered hosts/_resources.html.erb (4.8ms)
Completed 200 OK in 27ms (Views: 8.0ms | ActiveRecord: 2.7ms)
Processing by DiscoveredHostsController#edit as */*
  Parameters: {"id"=>"mac525400df80c8"}
  Rendered hosts/edit.html.erb within layouts/application (1.6ms)
Operation FAILED: undefined method `managed?' for nil:NilClass
  Rendered common/500.html.erb (8.3ms)
Completed 500 Internal Server Error in 51ms (Views: 21.5ms | ActiveRecord: 0.0ms)


Please note provisioning succeed.

Version-Release number of selected component (if applicable):
Satellite-6.1.0-RHEL-6-20150210.0
Sat6.1.0 beta snap2

How reproducible:
always

Steps to Reproduce:
1. pxe boot a host
2. once node is registered with sat6
3. go to Hosts --> Discovered host -> provision

Actual results:
provisioning succeed, but UI raises following error in firebug:

"NetworkError: 500 Internal Server Error - https://dhcp201-167.englab.pnq.redhat.com/discovered_hosts/mac525400df80c8/edit"

production.log contains:

Processing by HostsController#resources as HTML
  Parameters: {"range"=>"7", "id"=>"mac525400df80c8.englab.pnq.redhat.com"}
  Rendered hosts/_resources.html.erb (4.8ms)
Completed 200 OK in 27ms (Views: 8.0ms | ActiveRecord: 2.7ms)
Processing by DiscoveredHostsController#edit as */*
  Parameters: {"id"=>"mac525400df80c8"}
  Rendered hosts/edit.html.erb within layouts/application (1.6ms)
Operation FAILED: undefined method `managed?' for nil:NilClass
  Rendered common/500.html.erb (8.3ms)
Completed 500 Internal Server Error in 51ms (Views: 21.5ms | ActiveRecord: 0.0ms)


Expected results:
No error should be raised.

Additional info:
I manually installed foreman discovery plugin on sat6.1 beta snap2 as it was not installed by default and restarted katello-service.

Comment 1 Sachin Ghai 2015-02-17 13:02:24 UTC
Created attachment 992656 [details]
undefined method `managed?' for nil:NilClass on accessing the https://<host_name>/discovered_hosts/mac525400df80c8/edit

Comment 3 Lukas Zapletal 2015-02-18 08:31:47 UTC
Setting low priority as it has zero effects on functionality. I've already seen that before with upstream. We need to fix this later on.

Comment 5 Lukas Zapletal 2015-02-18 12:16:47 UTC
Note for myself: Not yet sure if the upstream issue is correct. Need to investigate.

Comment 6 Bryan Kearney 2015-02-18 13:06:02 UTC
Upstream bug assigned to gsutclif

Comment 7 Lukas Zapletal 2015-02-18 16:38:09 UTC
Sachin, out of my curiousity, when you simply create new Host on a Satellite 6.0 instance, won't you get the very same error? Maybe this is not Discovery related at all.

Comment 8 Bryan Kearney 2015-02-26 13:05:17 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/9147 has been closed
-------------
Greg Sutcliffe
Applied in changeset commit:5440d482b0087fe29b3fb4567e0ca73f2d3af221.

Comment 10 Bryan Kearney 2015-03-13 18:04:58 UTC
Upstream bug assigned to gsutclif

Comment 11 Lukas Zapletal 2015-03-16 10:42:54 UTC
Assigned to Marek who actually rewrote Gregs patch upstream.

Comment 12 Bryan Kearney 2015-03-16 12:05:05 UTC
Upstream bug assigned to gsutclif

Comment 13 Marek Hulan 2015-03-16 14:31:00 UTC
I think you should reassign upstream bug, otherwise it's always reassigned. But I don't think it's related to that upstream bug as it was reported after new nic change. This seems to me like something in discovery.

Comment 14 Lukas Zapletal 2015-03-16 15:02:48 UTC
Will merge that manually.

Comment 15 Bryan Kearney 2015-03-16 16:05:37 UTC
Upstream bug assigned to gsutclif

Comment 17 Lukas Zapletal 2015-03-18 09:38:13 UTC
Ok after discussion with Marek I am putting the link back to the original upstream bug and giving it to Ori.

Ori can you please re-test this bug with 2.0.1 rebased version of discovery? We might be fixing this, I think I saw it during our bunch of bugfixes.

Comment 18 Sachin Ghai 2015-03-19 05:06:54 UTC
I think anything related to 500 ISE should be on higher priority. This error looks ugly in all aspects. We really need to get this fixed by beta only. Setting the blocker flag to get into beta.

Comment 19 Lukas Zapletal 2015-03-19 09:47:52 UTC
When you see 500 in the UI that's totally blocker, but in this case we only see 500 only in the production.log. Satellite 6 operates well. For this reason I gave it lower prio.

Comment 20 Lukas Zapletal 2015-03-23 08:52:11 UTC
We do not see this anymore with https://gitlab.sat.lab.tlv.redhat.com/satellite6/foreman_discovery/merge_requests/2 merged, please retest.

Comment 22 Sachin Ghai 2015-05-08 13:28:19 UTC
Reproducible with sat6 GA snap3 compose2 


2015-05-08 18:49:01 [I] Processing by DiscoveredHostsController#edit as */*
2015-05-08 18:49:01 [I]   Parameters: {"id"=>"mac525400d5d951"}
2015-05-08 18:49:01 [I]   Rendered hosts/edit.html.erb within layouts/application (2.2ms)
2015-05-08 18:49:01 [W] Operation FAILED: undefined method `managed?' for nil:NilClass
2015-05-08 18:49:01 [I]   Rendered common/500.html.erb (13.0ms)
2015-05-08 18:49:01 [I] Completed 500 Internal Server Error in 73ms (Views: 17.6ms | ActiveRecord: 0.1ms)
20

Comment 23 orabin 2015-05-26 14:23:40 UTC
upstream issue is closed

Comment 27 Sachin Ghai 2015-06-05 12:15:11 UTC
Verified with sat6.1 GA snap7. The reported issue has been fixed. please see screenshot for verification.

Comment 28 Sachin Ghai 2015-06-05 12:17:41 UTC
Created attachment 1035203 [details]
no error in firebug when discovered host submitted for provisioning

Comment 29 Bryan Kearney 2015-08-11 13:30:17 UTC
This bug is slated to be released with Satellite 6.1.

Comment 30 Bryan Kearney 2015-08-12 13:56:31 UTC
This bug was fixed in version 6.1.1 of Satellite which was released on 12 August, 2015.