Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1372917 - Getting undefined method `name' for nil:NilClass when trying edit/view a host group
Summary: Getting undefined method `name' for nil:NilClass when trying edit/view a host...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Host Group
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: Unspecified
Assignee: Tomer Brisker
QA Contact:
URL:
Whiteboard:
: 1375672 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-03 19:10 UTC by Paul Dudley
Modified: 2022-03-13 14:06 UTC (History)
15 users (show)

Fixed In Version: katello-3.3.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 16:54:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 17815 0 High Closed Getting undefined method `name' for nil:NilClass when trying edit/view a host group 2020-05-27 05:09:48 UTC

Description Paul Dudley 2016-09-03 19:10:32 UTC
Description of problem:
When trying to view or edit a host group the following error is seen in the webui:
undefined method `name' for nil:NilClass
The entire traceback can be found here: http://pastebin.test.redhat.com/40871


How reproducible:
So far, unable to reproduce.


Steps to Reproduce:
1. Attach properties to host group (puppet modules, kickstarts, etc)
2. Remove property being used in host group
3. Attempt to view/edit group

Actual results:
Removing a property being used by a host group renders the group inaccessible

Expected results:
Removing a property in use by the group should simply remove the property from the group and still be able to be edited.

Comment 3 Brad Buckingham 2016-09-12 20:43:09 UTC
From the description:
2. Remove property being used in host group

Do you mean deleting an actual puppet module, kickstart repo or some other resource from the Satellite?

Or do you mean un-associating the resource from the hostgroup?

Comment 4 scarlet.remilia0 2016-09-14 00:30:18 UTC
Unassociating the resource from the hostgroup, for example, unassociating the operating system. This bug has rendered a parent hostgroup and all its children inaccessible to me, but it has not affected other parents. I suspect the bug may be related to child hostgroups not properly releasing their inheritance.

I can't quite remember what property I unassociated, but I believe it was OS, subnet, or domain. It was not provisioning scripts or puppet modules.

Comment 5 Marc Richter 2016-09-19 16:40:35 UTC
I have a customer who seems to be hitting a very similar problem, with a minor different in the error message. As per the case:

while editing host all host edit host and then change host group -- submit  after hitting submit:- error Oops, we're sorry but something went wrong undefined method `lookup_values' for nil:NilClass

Comment 6 scarlet.remilia0 2016-09-30 14:36:36 UTC
After being affected by this bug I was forced to delete and rebuild all of my hostgroups. Well, I just hit it once again.

This bug is definitely related to the operating system associations of child hostgroups. Here are the steps to reproduce:

1. Create a new host group with no parameters in the operating system section (all blank).
2. Create a child of the above host group and fill in the operating system associations with an architecture, OS, installation media, and partition table.
3. Edit the child host group created in the prior step and unassociate the architecture, OS, media, and partition table (e.g. by setting to inherit from parent).
4. Attempt to edit the child host group again: Oops, we're sorry but something went wrong undefined method `name' for nil:NilClass

The only different between this time and the last, is this time I can still edit the parent host group, just not the child.

If I edit the parent and add an architecture, e.g. x86_64, I once again regain access to the child hostgroup. The problem is the child is attempting to inherit a property that does not exist in the parent.

Comment 7 Shimon Shtein 2016-11-30 17:28:59 UTC
@scarlet.remilia0 Is it still reproducible?
Which version are you using?

Comment 8 scarlet.remilia0 2016-12-01 14:17:27 UTC
Fully up-to-date at the moment, 6.2.4. I am still able to reproduce.

Comment 9 Shimon Shtein 2016-12-05 07:07:09 UTC
Tried to reproduce it on 6.2.5, but was unsuccessful.

What I did:

1. Created a hostgroup hg1 with location and org set to "Default"
2. Created a hostgroup hg1_1 set the parent to hg1, set location, org, Architecture, OS, media, partition table.
3. Edited hg1_1 and set Arch to inherit (OS became disabled), media to inherit, partition table to inherit.
4. Edited hg1_1 again - no problem here.

Even created hosts from this HG in both states without any problem.

If the problem is reproducible via CLI, I would really appreciate if you could paste the commands.
If it's only reproducible in UI, could you capture the relevant screens?

Comment 10 Tomer Brisker 2016-12-21 11:17:05 UTC
I managed to reproduce in Satellite 6.2.6.

1. Create HG with os, arch and content view and save.
2. Edit same HG and remove the arch and os, save.
3. Reopen the HG - it crashes.
If the HG has any children inheriting these attributes they will also fail.

relevant part of the stack trace: 
 | NoMethodError: undefined method `name' for nil:NilClass
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.90/app/models/katello/concerns/redhat_extensions.rb:76:in `distribution_repositories'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.90/app/models/katello/concerns/redhat_extensions.rb:59:in `kickstart_repos'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.90/app/helpers/katello/hosts_and_hostgroups_helper.rb:190:in `kickstart_repository_options'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.90/app/helpers/katello/hosts_and_hostgroups_helper.rb:56:in `kickstart_repository_id'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.90/app/helpers/katello/hosts_and_hostgroups_helper.rb:43:in `use_install_media'
 | /usr/share/foreman/app/views/common/os_selection/_operatingsystem.html.erb:2:in `block in _5e049f3c8b8a59d4b5ba7658ce33472b'

Comment 11 Tomer Brisker 2016-12-21 11:17:38 UTC
*** Bug 1375672 has been marked as a duplicate of this bug. ***

Comment 12 Tomer Brisker 2016-12-21 11:20:21 UTC
Created redmine issue http://projects.theforeman.org/issues/17815 from this bug

Comment 14 Bryan Kearney 2016-12-22 17:18:13 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/17815 has been resolved.

Comment 16 Oleksandr Shtaier 2017-07-26 10:33:17 UTC
Verified both on 6.2.11 and latest 6.3 using test automation script

Steps:
1) Create host group with architecture, operating system, content view and lifecycle parameters
2) Check that all parameters were really assigned to host group
3) Remove Operating system and architecture for host group
4) Open host group and check that no error raised and that parameters were really removed
5) Re-assign architecture to hostgroup
6) Check that arhitecture is present in hostgroup

Comment 19 Satellite Program 2018-02-21 16:54:17 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-2018:0336


Note You need to log in before you can comment on or make changes to this bug.