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
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
Removing a property being used by a host group renders the group inaccessible
Removing a property in use by the group should simply remove the property from the group and still be able to be edited.
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?
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.
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
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.
@firstname.lastname@example.org Is it still reproducible?
Which version are you using?
Fully up-to-date at the moment, 6.2.4. I am still able to reproduce.
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?
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-188.8.131.52/app/models/katello/concerns/redhat_extensions.rb:76:in `distribution_repositories'
| /opt/theforeman/tfm/root/usr/share/gems/gems/katello-184.108.40.206/app/models/katello/concerns/redhat_extensions.rb:59:in `kickstart_repos'
| /opt/theforeman/tfm/root/usr/share/gems/gems/katello-220.127.116.11/app/helpers/katello/hosts_and_hostgroups_helper.rb:190:in `kickstart_repository_options'
| /opt/theforeman/tfm/root/usr/share/gems/gems/katello-18.104.22.168/app/helpers/katello/hosts_and_hostgroups_helper.rb:56:in `kickstart_repository_id'
| /opt/theforeman/tfm/root/usr/share/gems/gems/katello-22.214.171.124/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'
*** Bug 1375672 has been marked as a duplicate of this bug. ***
Created redmine issue http://projects.theforeman.org/issues/17815 from this bug
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/17815 has been resolved.
Verified both on 6.2.11 and latest 6.3 using test automation script
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
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.