Bug 1719509 - [RFE] "hammer host list" including erratas information
Summary: [RFE] "hammer host list" including erratas information
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hosts - Content
Version: 6.4.2
Hardware: All
OS: All
unspecified
high
Target Milestone: 6.8.0
Assignee: Waldirio M Pinheiro
QA Contact: Stephen Wadeley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-06-12 00:41 UTC by Waldirio M Pinheiro
Modified: 2020-10-27 12:58 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-10-27 12:58:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 27094 0 Normal Closed [RFE] "hammer host list" including erratas information 2021-01-29 13:53:39 UTC
Red Hat Product Errata RHSA-2020:4366 0 None None None 2020-10-27 12:58:53 UTC

Description Waldirio M Pinheiro 2019-06-12 00:41:22 UTC
Description of problem:
The customer would like to add the field related to errata on "hammer host list"

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

How reproducible:
100%

Steps to Reproduce:
1. Install an errata or update a bulk of content hosts
2. Generate a report about those servers


Actual results:
We don't have a way to do that.

Expected results:
"hammer host list" showing errata info

Additional info:

Comment 3 Waldirio M Pinheiro 2019-06-12 00:44:36 UTC
Hello all

Below a great workaround

// The command based on host-collection
---
for b in $(hammer --csv host-collection hosts --name "rh_test" --organization ACME | grep -v ^ID | cut -d, -f2); do name=$b; count=$(hammer --csv host errata list --host $b | grep -v ^ID | wc -l); echo "$name,$count"; done
---

// Example Output
---
# for b in $(hammer --csv host-collection hosts --name "rh_test" --organization ACME | grep -v ^ID | cut -d, -f2); do name=$b; count=$(hammer --csv host errata list --host $b | grep -v ^ID | wc -l); echo "$name,$count"; done
kate-piedra.local.domain,0
---

// The command based on ALL hosts registered on Satellite
---
for b in $(hammer --csv host list --organization ACME | grep -v -E '(^Id|virt-who)' | cut -d, -f2); do name=$b; count=$(hammer --csv host errata list --host $b | grep -v ^ID | wc -l); echo "$name,$count"; done | tee /tmp/server_list.log

// Example Output
---
# for b in $(hammer --csv host list --organization ACME | grep -v -E '(^Id|virt-who)' | cut -d, -f2); do name=$b; count=$(hammer --csv host errata list --host $b | grep -v ^ID | wc -l); echo "$name,$count"; done | tee /tmp/server_list.log
heath-derion.local.domain,344
kate-piedra.local.domain,0
---


Best Regards
-- 
Waldirio M Pinheiro | Senior Software Maintenance Engineer

Comment 4 Bryan Kearney 2019-06-20 17:12:06 UTC
Please use the reporting tools which were delivered with 6.5.

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

Comment 7 Roman Plevka 2020-01-27 17:44:23 UTC
The predefined field group names should be case-insensitive (I used --fields all and then spent ~20mins trying to figure out, what's the proper usage, as this was giving me an empty result).

If the predefined sets are not going to change, added, etc. i see no reason why not including their names directly inside --fields option help message:
"
--fields FIELDS|ALL|THIN
"

Overall, I like this enhancement and i'd probably make it global (for other sub-commands too).

Comment 8 Brad Buckingham 2020-02-12 19:50:43 UTC
Hi Roman,

I don't believe this one should be failedQA. 

The enhancement that Waldirio provided was to expand the output of the 'host list' command to include errata counts.  

The failure raised is on the --fields parameter which is a separate feature that applies to all hammer commands (as far as I can tell).  The concern raised in comment 7 is valid; however, it should be captured in a separate bugzilla on the hammer component.

Do you agree?

Comment 9 Roman Plevka 2020-02-17 08:55:45 UTC
(In reply to Brad Buckingham from comment #8)
> Hi Roman,
> 
> I don't believe this one should be failedQA. 
> 
> The enhancement that Waldirio provided was to expand the output of the 'host
> list' command to include errata counts.  
> 
> The failure raised is on the --fields parameter which is a separate feature
> that applies to all hammer commands (as far as I can tell).  The concern
> raised in comment 7 is valid; however, it should be captured in a separate
> bugzilla on the hammer component.
> 
> Do you agree?

I see.
In that case the FailedQA stands even stronger, as by default there are no such fields in the `hammer host list` output:

```
# hammer host list
---|------------------------------------|------------------|------------|------------|-------------------|---------------|---------------------------|----------------------
ID | NAME                               | OPERATING SYSTEM | HOST GROUP | IP         | MAC               | GLOBAL STATUS | CONTENT VIEW              | LIFECYCLE ENVIRONMENT
---|------------------------------------|------------------|------------|------------|-------------------|---------------|---------------------------|----------------------
3  | demo1.rplevka.com                  | RedHat 7.7       | hg1        | 10.1.4.13  | 56:6f:0d:72:05:9a | OK            | Default Organization View | Library              
1  | dhcp-2-20.vms.sat.rdu2.redhat.com  | RedHat 7.7       |            | 10.1.2.20  | 56:6f:0d:72:05:54 | Warning       |                           |                      
2  | dhcp-3-218.vms.sat.rdu2.redhat.com | RedHat 7.7       |            | 10.1.3.218 | 56:6f:0d:72:05:cb | OK            |                           |                      
---|------------------------------------|------------------|------------|------------|-------------------|---------------|---------------------------|----------------------
```

it was the `--fields` option which added the expanded output:
```
# hammer host list --fields ALL
---|------------------------------------|------------------|------------|------------|-------------------|---------------|----------------------|------------------|------------------------|---------------------------|-----------------------|----------|--------|------------
ID | NAME                               | OPERATING SYSTEM | HOST GROUP | IP         | MAC               | GLOBAL STATUS | ORGANIZATION         | LOCATION         | ADDITIONAL INFORMATION | CONTENT VIEW              | LIFECYCLE ENVIRONMENT | SECURITY | BUGFIX | ENHANCEMENT
---|------------------------------------|------------------|------------|------------|-------------------|---------------|----------------------|------------------|------------------------|---------------------------|-----------------------|----------|--------|------------
3  | demo1.rplevka.com                  | RedHat 7.7       | hg1        | 10.1.4.13  | 56:6f:0d:72:05:9a | OK            | nH0ONj               | Default Location |                        | Default Organization View | Library               | 0        | 0      | 0          
1  | dhcp-2-20.vms.sat.rdu2.redhat.com  | RedHat 7.7       |            | 10.1.2.20  | 56:6f:0d:72:05:54 | Warning       | Default Organization | Default Location |                        |                           |                       |          |        |            
2  | dhcp-3-218.vms.sat.rdu2.redhat.com | RedHat 7.7       |            | 10.1.3.218 | 56:6f:0d:72:05:cb | OK            | Default Organization | Default Location |                        |                           |                       |          |        |            
---|------------------------------------|------------------|------------|------------|-------------------|---------------|----------------------|------------------|------------------------|---------------------------|-----------------------|----------|--------|------------

```

Comment 10 Waldirio M Pinheiro 2020-02-19 01:01:32 UTC
Hello

On Satellite 6.7 beta, I can see the description as below on "hammer host list --help"

---
[root@wallsat67 ~]# hammer host list --help
Usage:
    hammer host list [OPTIONS]

Options:
 --environment ENVIRONMENT_NAME                Environment name (--environment is deprecated: Use --puppet-environment instead)
 --environment-id ENVIRONMENT_ID               (--environment-id is deprecated: Use --puppet-environment-id instead)
 --fields FIELDS                               Show specified fileds or predefined filed sets only. (See below)
                                               Comma separated list of values. Values containing comma should be quoted or escaped with backslash.
                                               JSON is acceptable and preferred way for complex parameters
 --hostgroup HOSTGROUP_NAME                    Hostgroup name
 --hostgroup-id HOSTGROUP_ID                    
 --hostgroup-title HOSTGROUP_TITLE             Hostgroup title
 --location LOCATION_NAME                      Location name
 --location-id LOCATION_ID                      
 --location-title LOCATION_TITLE               Location title
 --order ORDER                                 Sort field and order, eg. ‘id DESC’
 --organization ORGANIZATION_NAME              Organization name
 --organization-id ORGANIZATION_ID             Organization ID
 --organization-title ORGANIZATION_TITLE       Organization title
 --page PAGE                                   Page number, starting at 1
 --per-page PER_PAGE                           Number of results per page to return
 --puppet-environment PUPPET_ENVIRONMENT_NAME  Puppet environment name
 --puppet-environment-id PUPPET_ENVIRONMENT_ID  
 --search SEARCH                               Filter results
 --thin THIN                                   Only list ID and name of hosts
                                               One of true/false, yes/no, 1/0.
 -h, --help                                    Print help

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   |         |
  -----------------------|-----|---------|-----
---

which explains which field should be visible when using --fields flag.


Please, let us know if it makes sense to you.

Waldirio

Comment 12 Bryan Kearney 2020-05-11 16:04:27 UTC
Upstream bug assigned to wpinheir

Comment 14 Stephen Wadeley 2020-06-17 15:24:13 UTC
(In reply to Brad Buckingham from comment #8)
> Hi Roman,
> 
> I don't believe this one should be failedQA. 
> 
> The enhancement that Waldirio provided was to expand the output of the 'host
> list' command to include errata counts.  
> 
> The failure raised is on the --fields parameter which is a separate feature
> that applies to all hammer commands (as far as I can tell).  The concern
> raised in comment 7 is valid; however, it should be captured in a separate
> bugzilla on the hammer component.
> 

Hello 

I had some issues testing with --fields
Bug 1836391 - hammer erratum list --fields does not work for all fields 
but was referred to:
Bug 1829701 - update the help description of hammer subscription list command for the --fields option to be more explicit

Comment 18 errata-xmlrpc 2020-10-27 12:58:39 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 (Important: Satellite 6.8 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-2020:4366


Note You need to log in before you can comment on or make changes to this bug.