Bug 1933353

Summary: 'hammer host subscription product-content' Cannot Show 'Default Enabled?' Field
Product: Red Hat Satellite Reporter: Bernie Hoefer <bhoefer>
Component: HammerAssignee: Oleh Fedorenko <ofedoren>
Status: CLOSED ERRATA QA Contact: Shweta Singh <shwsingh>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.8.0CC: apatel, gtalreja, kgaikwad, ofedoren, rabajaj, tbrisker, vijsingh
Target Milestone: 6.10.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-hammer_cli-2.5.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-16 14:39:05 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 Bernie Hoefer 2021-02-26 19:12:48 UTC
Description of problem:

According to 'hammer host subscription product-content --help', I should be able to restrict the output fields.  I cannot do that for the "Default Enabled?" field.


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

tfm-rubygem-hammer_cli-2.1.2-1.el7sat.noarch


How reproducible:

# hammer host subscription product-content --host contenthost.localdomain --fields="label,default enabled?,override"


Actual results:

---------------------------------------|----------
LABEL                                  | OVERRIDE 
---------------------------------------|----------
rhel-7-server-rpms                     | enabled:0
rhel-7-server-eus-rpms                 |          
rhel-7-server-extras-rpms              |          
rhel-8-for-x86_64-appstream-rpms       |          
rhel-8-for-x86_64-appstream-eus-rpms   |          
rhel-8-for-x86_64-baseos-rpms          |          
rhel-8-for-x86_64-baseos-eus-rpms      |          
rhel-7-server-satellite-tools-6.8-rpms |          
---------------------------------------|----------


Expected results:

---------------------------------------|------------------|----------
LABEL                                  | DEFAULT ENABLED? | OVERRIDE 
---------------------------------------|------------------|----------
rhel-7-server-rpms                     | yes              | enabled:0
rhel-7-server-eus-rpms                 | no               |          
rhel-7-server-extras-rpms              | no               |          
rhel-8-for-x86_64-appstream-rpms       | yes              |          
rhel-8-for-x86_64-appstream-eus-rpms   | no               |          
rhel-8-for-x86_64-baseos-rpms          | yes              |          
rhel-8-for-x86_64-baseos-eus-rpms      | no               |          
rhel-7-server-satellite-tools-6.8-rpms | no               |          
---------------------------------------|------------------|----------


Additional info:

I'm sure it is the question mark that is that is throwing my --fields option off.  I've tried escaping it, leaving it off and about 10 other variations to no success.

Not sure if this is an actual bug with the hammer program or a documentation issue.  (The documentation could definitely be improved, as the --help output shows:

  -----------------|-----|---------|-----
  FIELDS           | ALL | DEFAULT | THIN
  -----------------|-----|---------|-----
  ID               | x   | x       | x
  Name             | x   | x       | x
  Type             | x   | x       |
  URL              | x   | x       |
  GPG Key          | x   | x       |
  Label            | x   | x       |
  Default Enabled? | x   | x       |
  Override         | x   | x       |
  -----------------|-----|---------|-----

...yet trying to use --fields="ID" just shows blank lines.  One has to use "Id" or "id".

Comment 1 Oleh Fedorenko 2021-03-01 17:53:21 UTC
This is actually a bug in hammer core. --fields option doesn't work if a label contains question mark (it interprets that as regexp).

Comment 2 Oleh Fedorenko 2021-03-01 18:24:13 UTC
Created redmine issue https://projects.theforeman.org/issues/31984 from this bug

Comment 3 Bryan Kearney 2021-03-01 20:05:41 UTC
Upstream bug assigned to ofedoren

Comment 4 Bryan Kearney 2021-03-01 20:05:45 UTC
Upstream bug assigned to ofedoren

Comment 6 Bryan Kearney 2021-05-11 12:06:03 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/31984 has been resolved.

Comment 7 Shweta Singh 2021-06-24 08:14:57 UTC
Verified. 

Version Tested : Satellite 6.10 Snap 4

Steps followed: 
1. Create host on satellite                                                                                                                                                                                                                         
2. Add Redhat repositories on satellite
3. Execute hammer command to restrict the output fields using command "hammer host subscription product-content --host host1.localdomain --fields="label,default enabled?,override""

Observation:
hammer host subscription product-content --help gives option to restrict output fields.
 
Trace:

hammer host subscription product-content --host host1.localdomain --fields="label,default enabled?,override"
----------------------------------|------------------|---------
LABEL                             | DEFAULT ENABLED? | OVERRIDE
----------------------------------|------------------|---------
rhel-7-server-ansible-2.9-rpms    | no               |         
rh-sso-7.4-for-rhel-7-server-rpms | no               |         
----------------------------------|------------------|---------

hammer host subscription product-content --host host1.localdomain --fields="label,default enabled?,override,id"
-----|-----------------------------------|------------------|---------
ID   | LABEL                             | DEFAULT ENABLED? | OVERRIDE
-----|-----------------------------------|------------------|---------
628  | rhel-7-server-ansible-2.9-rpms    | no               |         
5990 | rh-sso-7.4-for-rhel-7-server-rpms | no               |         
-----|-----------------------------------|------------------|---------

Comment 10 errata-xmlrpc 2021-11-16 14:39:05 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 (Satellite 6.10 Satellite Tools 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/RHBA-2021:4701