Bug #36568
closedHostgroup API controller also returns roles assigned to hosts in a host group
Description
copied from BZ 2187967
API query
/api/hostgroups/HOSTGROUPID/ansible_roles
does provide different output that WebUI editing the same HostGroup in some cases. Esp. when there is a host is associated with the HG
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.