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 2231258

Summary: hammer host list does not print custom parameters even if they are present in the fields list.
Product: Red Hat Satellite Reporter: Vedashree Deshpande <vdeshpan>
Component: HostsAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED NOTABUG QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.11.0CC: aruzicka, ofedoren, rlavi
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-08-29 11:50:18 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 Vedashree Deshpande 2023-08-11 06:37:44 UTC
Description of problem:
hammer host list or hammer --csv host list does not adhere to the fields passed and do not print the correct result. 

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

How reproducible:
every time. Easy. 

Actual results:
# hammer host list --fields 'Name,Subscription Status,OS,Environment,Content View,Registered,Last Checkin'
-------------------------------|--------------------------
NAME                           | CONTENT VIEW
-------------------------------|--------------------------
host.example.com               | Default Organization View

But the below command works: 
# hammer host list --fields 'Id,Name,Operating System,Ip,Global Status,Content View,Lifecycle environment,Security,Bugf
---|--------------------------------|------------------|----------------|---------------|---------------------------|-----------------------|----------|--------|------------
ID | NAME                           | OPERATING SYSTEM | IP             | GLOBAL STATUS | CONTENT VIEW              | LIFECYCLE ENVIRONMENT | SECURITY | BUGFIX | ENHANCEMENT
---|--------------------------------|------------------|----------------|---------------|---------------------------|-----------------------|----------|--------|------------
52 | host.example.com          | RedHat 8.5       | 10.0.2.15      | Warning       | Default Organization View | Library               | 0        | 0      | 0


However, below fails too:

# hammer --csv host list --fields 'Name,Subscription Status,OS,Environment,Content View,Registered,Last Checkin'
Name,Content View
host.example.com,Default Organization View

Expected results:
It should print all the passed parameters with the command. 

Additional info:

Comment 1 Adam Ruzicka 2023-08-15 09:37:22 UTC
> hammer host list --fields 'Name,Subscription Status,OS,Environment,Content View,Registered,Last Checkin'

If you run hammer host list --help, it shows you which fields it can show, and as far as I know only the fields in "Predefined field sets" can be shown.

From my machine
Predefined field sets:                         
  -----------------------|-----|---------|-----
  FIELDS                 | ALL | DEFAULT | THIN 
  -----------------------|-----|---------|-----
  Id                     | x   | x       | x  
  Name                   | x   | x       | x    
  Operating system       | x   | x       |                                                      
  Host group             | x   | x       |               
  Ip                     | x   | x       |     
  Mac                    | x   | x       |                                                      
  Global status          | x   | x       |               
  Organization           | x   |         |    
  Location               | x   |         |                        
  Additional information | x   |         |    
  Content view           | x   | x       |                 
  Lifecycle environment  | x   | x       |     
  Security               | x   |         |    
  Bugfix                 | x   |         |    
  Enhancement            | x   |         |                                        
  Trace status           | x   | x       |    
  -----------------------|-----|---------|-----

Most of the fields you're passing in are not in that list. Yes, you can pass in literally anything, but hammer will not understand you. I don't see us adding support for allowing to show every single possible field anytime soon. If you really need all those details, I'd suggest putting together a report template which, when used to generate a report, would give you all the bits and pieces you might want to see. Would that be an option for you?

> Satellite 6.11 onward

As in this used to work on 6.10 and older?

Comment 2 Adam Ruzicka 2023-08-29 11:50:18 UTC
We talked about this within the team and determined this feature was not intended to be used as it is described in comment #0. I'll go ahead and close this as a NOTABUG, if you feel this is something that should be improved by us, feel free to reopen this as a RFE.