Bug 1387817

Summary: hammer do not sort content host by installable errata
Product: Red Hat Satellite Reporter: Mahesh Taru <mtaru>
Component: Hammer - ContentAssignee: Andrew Kofink <akofink>
Status: CLOSED ERRATA QA Contact: Kavita <kgaikwad>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.2CC: akofink, bbuckingham, jcallaha, kgaikwad, tstrachota
Target Milestone: UnspecifiedKeywords: Reopened, 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: 2018-02-21 16:49:54 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:
Attachments:
Description Flags
hosts are ordered by name using --order none

Description Mahesh Taru 2016-10-22 03:50:58 UTC
Description of problem:
When running hammer content-host list with the --by option to sort by INSTALLABLE ERRATA it doesn't.

Version-Release number of selected component (if applicable):
tfm-rubygem-hammer_cli-0.5.1.11-4.el7sat.noarch

How reproducible:
Always

Steps to Reproduce:
On satellite 6.2 try to list content-host with --by option tp sort by 'INSTALLABLE ERRATA'.

# hammer -u admin -p password content-host list --organization-id <id> --content-view <content-view-name. --lifecycle-environment <lifecycle environment name> --by 'INSTALLABLE ERRATA'

Actual results:
Do not sort list as per installable errata.
For ex:
-------------------------------------|---------------|-------------------
ID                                   | NAME          | INSTALLABLE ERRATA
-------------------------------------|---------------|-------------------
6f0373b3-05b1-47dd-b3bf-xxxxxxxxxxxx | system01      | 0
8b8b8ff7-2d01-444b-97ae-xxxxxxxxxxxx | system02      | 6
a398c2a6-514c-4904-a737-xxxxxxxxxxxx | system03      | 0
c511e4e7-63a8-4f8b-b667-xxxxxxxxxxxx | system04      | 30

Expected results:
Should list content-hosts as per installable errata.
For ex:
-------------------------------------|---------------|-------------------
ID                                   | NAME          | INSTALLABLE ERRATA
-------------------------------------|---------------|-------------------
c511e4e7-63a8-4f8b-b667-xxxxxxxxxxxx | system04      | 30
8b8b8ff7-2d01-444b-97ae-xxxxxxxxxxxx | system02      | 6
6f0373b3-05b1-47dd-b3bf-xxxxxxxxxxxx | system01      | 0
a398c2a6-514c-4904-a737-xxxxxxxxxxxx | system03      | 0

Additional info:

Comment 2 Andrew Kofink 2016-12-09 14:53:53 UTC
In 6.3.0, the `--by` option is removed and replaced with the `--order` option. The query above would be changed like so:

```
# Before
hammer -u admin -p password content-host list --organization-id <id> --content-view <content-view-name> --lifecycle-environment <lifecycle environment name> --by 'INSTALLABLE ERRATA'

# After
hammer -u admin -p password content-host list --organization-id <id> --content-view <content-view-name> --lifecycle-environment <lifecycle environment name> --order 'installable_errata [desc]'
```

Comment 3 Kavita 2017-08-09 12:22:25 UTC
Verified.
Version Tested: Satellite-6.3 Snap 10.
CLI output screen-shots attached.

** RPM package versions:

satellite-6.3.0-16.0.beta.el7sat.noarch
foreman-1.15.2-1.el7sat.noarch
katello-3.4.4-2.el7sat.noarch
tfm-rubygem-hammer_cli-0.10.2-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman-0.10.2-1.el7sat.noarch


As the content host resource is no longer there, host will be used instead on sat 6.3. 
Subcommand 'content-host' is also not present in hammer so this issue will not exist on 6.3. 

** Note that - in 6.3.0, `--by` option is replaced by `--order` option.

For example - 
hammer -u admin -p password host list --order 'name desc'

Comment 4 Kavita 2017-08-09 12:27:00 UTC
Created attachment 1311182 [details]
hosts are ordered by name using --order

Comment 5 Satellite Program 2018-02-21 16:49:54 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, 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-2018:0336