Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1851415

Summary: hammer hostgroup update does not respect ansible-roles argument
Product: Red Hat Satellite Reporter: Stefan Nemeth <snemeth>
Component: Ansible - Configuration ManagementAssignee: Oleh Fedorenko <ofedoren>
Status: CLOSED ERRATA QA Contact: Danny Synk <dsynk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.7.0CC: apatel, kgaikwad, ofedoren, rabajaj, roarora
Target Milestone: 6.10.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-16 14:09:12 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 Stefan Nemeth 2020-06-26 13:17:04 UTC
Description of problem:

updating ansible roles in hostgroup with hammer does not respect argument

hammer hostgroup update --id 17  --ansible-roles anystring

results in adding all available roles into hostgroup

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

6.7.1

How reproducible:

100%

Steps to Reproduce:
1.create hostgroup
2.import some ansible roles to satellite
3.#hammer hostgroup update --id 17  --ansible-roles rolename

Actual results:

all available roles added to hostroup

Expected results:

only roles with names matching argument string added to hostgroup

Additional info:

Comment 1 Oleh Fedorenko 2020-06-26 19:04:06 UTC
Seems like the problem appears only if hammer-cli-katello plugin is installed, since it changes name to id resolving. I suggest to improve hammer-cli-foreman-ansible plugin, so it works with/out hammer-cli-katello being installed.

Comment 2 Oleh Fedorenko 2020-06-26 19:06:01 UTC
Created redmine issue https://projects.theforeman.org/issues/30226 from this bug

Comment 3 Bryan Kearney 2020-06-26 20:00:40 UTC
Upstream bug assigned to ofedoren

Comment 4 Bryan Kearney 2020-06-26 20:00:42 UTC
Upstream bug assigned to ofedoren

Comment 5 Bryan Kearney 2020-06-29 16:00:42 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/30226 has been resolved.

Comment 8 Tomer Brisker 2021-06-08 09:53:33 UTC
*** Bug 1740414 has been marked as a duplicate of this bug. ***

Comment 9 Danny Synk 2021-06-24 20:50:01 UTC
Steps to Test:

1. Import Ansible roles to Satellite 6.10, snap 5.
2. Create a host group.
3. Attempt to update the hostgroup using hammer with an arbitrary string as the value of the `--ansible-roles` option:
4. Attempt to update the hostgroup using hammer with one of the imported Ansible roles as the value of the `--ansible-roles` option:


Expected Results:
Using an arbitrary string as the value of the `--ansible-roles` option makes no changes to the Ansible roles assigned to the hostgroup. Using one or more imported roles as the value of the `--ansible-roles` option assigns those roles to the hostgroup.


Actual Results: 
Using an arbitrary string as the value of the `--ansible-roles` option makes no changes to the Ansible roles assigned to the hostgroup:

  # hammer hostgroup update --id 1 --ansible-roles testingfailure
  Could not update the hostgroup:
    Error: one of ansible_roles not found.

Using one or more imported roles as the value of the `--ansible-roles` option assigns those roles to the hostgroup:

  # hammer hostgroup update --id 1 --ansible-roles  ovirt.ovirt.infra
  Hostgroup updated.


Verified on Satellite 6.10, snap 5 (tfm-rubygem-hammer_cli_foreman_ansible-0.3.3-2.el7sat.noarch).

Comment 12 errata-xmlrpc 2021-11-16 14:09:12 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 (Moderate: Satellite 6.10 Release), 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-2021:4702