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 2187967 - API and WebUI provides different results for Hostgroup Ansible roles association
Summary: API and WebUI provides different results for Hostgroup Ansible roles association
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Ansible - Configuration Management
Version: 6.12.3
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.14.0
Assignee: satellite6-bugs
QA Contact: addubey
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-04-19 09:37 UTC by Pavel Moravec
Modified: 2024-03-22 11:03 UTC (History)
8 users (show)

Fixed In Version: rubygem-foreman_ansible-12.0.5
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-08 14:19:16 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 36568 0 Normal Ready For Testing Hostgroup API controller also returns roles assigned to hosts in a host group 2023-07-05 01:57:18 UTC
Red Hat Issue Tracker SAT-18630 0 None None None 2023-06-27 01:25:41 UTC
Red Hat Knowledge Base (Solution) 7008748 0 None None None 2023-04-20 10:38:14 UTC
Red Hat Product Errata RHSA-2023:6818 0 None None None 2023-11-08 14:19:41 UTC

Description Pavel Moravec 2023-04-19 09:37:54 UTC
Description of problem:
API query

/api/hostgroups/HOSTGROUPID/ansible_roles

does provide different output that WebUI editing the same HostGroup in some cases. Esp. when:
- an Ansible Role (AR) is *not* associated with the HG (neither with its parents),
- the AR is associated to a Host
- the Host is associated with the HG

Then API call follows https://github.com/theforeman/foreman_ansible/blob/master/app/models/concerns/foreman_ansible/hostgroup_extensions.rb#L37-L43 and adds that AR to its response.

Contrary to that, WebUI uses https://github.com/theforeman/foreman_ansible/blob/master/app/helpers/foreman_ansible/ansible_roles_helper.rb#L38-L49 method that counts with ARs associated to the HG and/or its parents - only.


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


How reproducible:
100%


Steps to Reproduce:
1. Have 2 Ansible Roles, one assigned to a HG, another to a Host
2. Assign the Host to the HostGroup
3. In WebUI, edit the HostGroup -> Ansible Roles tab
4. call /api/hostgroups/HOSTGROUPID/ansible_roles (i.e. "curl -s -u admin:password https://$(hostname -f)/api/hostgroups/1/ansible_roles")


Actual results:
3. shows just the one AG assigned to the HG
4. shows *two* AGs "assigned" to the HG: the right one and also the one assigned "just" to the Host


Expected results:
Align the results - I think API response should be corrected and should not output ARs assigned to Hosts (associated with the HG). Since those AGs are not (directly) associated with the HG.


Additional info:

Comment 2 Bryan Kearney 2023-07-25 16:02:56 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36568 has been resolved.

Comment 8 errata-xmlrpc 2023-11-08 14:19:16 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 (Important: Satellite 6.14 security and bug fix update), 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-2023:6818


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