Bug 2070494 - View/edit child hostgroups sharing the same parent failed with GUI error undefined method `name' for nil:NilClass after upgrading to 6.10.3 [NEEDINFO]
Summary: View/edit child hostgroups sharing the same parent failed with GUI error unde...
Keywords:
Status: NEW
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Ansible
Version: 6.10.3
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Satellite QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-03-31 09:39 UTC by Ahmed Eladawy
Modified: 2023-08-15 12:13 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:
momran: needinfo? (satellite6-bugs)


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 6958325 0 None None None 2022-05-16 07:24:07 UTC

Description Ahmed Eladawy 2022-03-31 09:39:07 UTC
Description of problem:

When opening 4 child hostgroups (sharing the same parent) from the GUI , an error occurs :

undefined method `name' for nil:NilClass
2022-03-24T15:05:47 [I|app|2b5772f9] Backtrace for 'undefined method `name' for nil:NilClass' error (ActionView::Template::Error): undefined method `name' for nil:NilClass
 2b5772f9 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_ansible-6.3.4.1/app/helpers/foreman_ansible/ansible_roles_helper.rb:58:in `block in model_roles_attrs'
 2b5772f9 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_ansible-6.3.4.1/app/helpers/foreman_ansible/ansible_roles_helper.rb:58:in `map'
 2b5772f9 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_ansible-6.3.4.1/app/helpers/foreman_ansible/ansible_roles_helper.rb:58:in `model_roles_attrs'
 2b5772f9 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_ansible-6.3.4.1/app/helpers/foreman_ansible/ansible_roles_helper.rb:47:in `role_attributes_for_roles_switcher'


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

satellite 6.10.3

How reproducible:

Could be reproduced.

Steps to Reproduce:
1. Navigating to hostgroup page on the satellite


Actual results:

Error undefined method `name' for nil:NilClass 

Expected results:

Viewing/editing hostgroup

Additional info:

- The issue is only with 4 hostgroups sharing the same parent.
- New hostgroups with the same parent work without issue.
- The issue started after upgrading from 6.9.8 to 6.10.3
- Removing current assigned Ansible roles to the hostgroup using hammer did not fix the issue.
- The full trace of the error will be on the first comment.

Comment 2 Brad Buckingham 2022-03-31 14:10:13 UTC
Does the same error occur if viewing the child hostgroup from hammer?

Comment 3 Ahmed Eladawy 2022-04-01 08:17:36 UTC
(In reply to Brad Buckingham from comment #2)
> Does the same error occur if viewing the child hostgroup from hammer?

No, from hammer , the hostgroup can be viewed and edited without issues.

Comment 4 momran 2022-04-13 08:34:11 UTC
A similar error is encountered when editing hosts in Satellite's 6.10.3 web UI.

As a test, we tried the 'hammer host ansible-roles assign' command as per [1], and it worked fine.

[1] https://access.redhat.com/documentation/en-us/red_hat_satellite/6.10/html-single/hammer_cli_guide/index#hammer-host-ansible-roles-assign

Comment 7 Pavel Moravec 2022-05-12 12:48:10 UTC
Reproducer: add an ansible role to a HostGroup while removing the same ansible role. Then editing the HG fails with above backtrace.

Detailed reproducer in WebUI:

- Edit a HostGroup and navigate to Ansible Roles pane
- Add an Ansible Role from the Available Roles - do NOT click to Submit button yet!
- Meanwhile, open Ansible Roles page and delete the role you are about to add to the HG
- Now, Submit the HG change
- Edit the same HG

It seems we need to validate list of ansible role IDs at the time of submitting a HostGroup change?


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