Bug 1740414

Summary: hammer host [create or update] --ansible-roles "role-name" assigns all roles available in satellite
Product: Red Hat Satellite Reporter: roarora
Component: Ansible - Configuration ManagementAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Danny Synk <dsynk>
Severity: medium Docs Contact:
Priority: high    
Version: 6.4CC: dsynk, oprazak, tbrisker
Target Milestone: UnspecifiedKeywords: Triaged, UserExperience
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-06-08 09:53:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description roarora 2019-08-12 21:30:52 UTC
Description of problem:

When assigning ansible roles while creating a host via hammer with "--ansible-roles" option, all available roles in satellite are assigned to the system


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

How reproducible:
Always

Steps to Reproduce:

1. Import some ansible roles in satellite and assign while creating a host with 
hammer

# hammer host create --ansible-roles test --name client --hostgroup RHEL7 --location city --organization Example
 
In background, it calls following API to get role IDs but it gives result containing all ansible roles :
---------------------------------
/ansible/api/ansible_roles?name=test"
---------------------------------

API SHould have been : 

---------------------------------
/ansible/api/ansible_roles?search=name=test"
---------------------------------


Actual results:
All roles in satellite are assigned to the system

Expected results:

Only roles which are passed in the hammer command should be assigned

Additional info:

Behaviour is same with "hammer host update --ansible-roles" also

Comment 3 Ondřej Pražák 2019-11-19 10:01:43 UTC
Created redmine issue https://projects.theforeman.org/issues/28298 from this bug

Comment 4 Bryan Kearney 2021-06-07 15:44:36 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/28298 has been resolved.

Comment 5 Tomer Brisker 2021-06-08 09:53:33 UTC

*** This bug has been marked as a duplicate of bug 1851415 ***