Bug 1254102

Summary: Discovery rules page "undefined method `name' for nil:NilClass" in case hostgroup was deleted
Product: Red Hat Satellite Reporter: Alexander Braverman <abraverm>
Component: Discovery PluginAssignee: Lukas Zapletal <lzap>
Status: CLOSED ERRATA QA Contact: Stephen Benjamin <stbenjam>
Severity: high Docs Contact:
Priority: high    
Version: 6.1.0CC: abalakht, bbuckingham, bkearney, lzap, mmccune, pmutha, sghai, stbenjam, szadok, xdmoon
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/11574
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 09:17:52 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: 1338516    
Attachments:
Description Flags
Foreman debug none

Description Alexander Braverman 2015-08-17 07:42:19 UTC
Created attachment 1063664 [details]
Foreman debug

Description of problem:
Opening 'Discovery Rules' page results with an error:
undefined method `name' for nil:NilClass


Version-Release number of selected component (if applicable):
6.1.1

How reproducible:
Open 'Discovery Rules'

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
Satellite was upgraded from 6.1.0 to 6.1.1

Comment 2 Shlomi Zadok 2015-08-17 11:53:40 UTC
Upstream seems to solve this issue at https://github.com/theforeman/foreman_discovery/blob/develop/app/views/discovery_rules/index.html.erb#L19
Can this be cherry-picked?

Comment 3 Lukas Zapletal 2015-08-17 11:56:22 UTC
Which commit sha is that? Can you please prepare cherry pick request for that?

Comment 5 Sachin Ghai 2015-08-17 12:21:07 UTC
Reproduced. If we delete Hostgroup after associating it to Discovery Rule.

Comment 8 Lukas Zapletal 2015-08-26 13:11:48 UTC
The above commit only masks the fact a rule does not have a hostgroup.

Comment 9 Lukas Zapletal 2015-08-26 13:17:54 UTC
Upstream patch done: https://github.com/theforeman/foreman_discovery/pull/212

Cherry pick the UI patch as well ^^^

Comment 15 Bryan Kearney 2016-01-04 21:34:51 UTC
Upstream bug assigned to lzap

Comment 16 Bryan Kearney 2016-02-16 09:09:12 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/11574 has been closed
-------------
Anonymous
Applied in changeset commit:foreman_discovery|82d93bfb7748482ca32ab293d8c0b47c38c4c018.

Comment 18 Stephen Benjamin 2016-03-24 17:01:18 UTC
Created hostgroup Foo, with discovery rule Bar.  Tried to delete hostgroup Foo, it's no longer possible: "Cannot delete record because dependent discovery rules exist"

Comment 21 errata-xmlrpc 2016-07-27 09:17:52 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/RHBA-2016:1501