Bug 1335559

Summary: hammer host-collection add-host/remove-host always return success
Product: Red Hat Satellite Reporter: Andrew Kofink <akofink>
Component: Hammer - ContentAssignee: Andrew Kofink <akofink>
Status: CLOSED ERRATA QA Contact: Bruno Rocha <rochacbruno>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: bbuckingham, bkearney, ehelms, jcallaha, mmccune, rochacbruno, tstrachota
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/15291
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:46:23 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 Andrew Kofink 2016-05-12 13:47:38 UTC
Description of problem:
The `hammer host-collection add-host/remove-host` commands always return success messages, regardless of whether the hosts added/removed are found.

Version-Release number of selected component (if applicable):
6.1,6.2,devel

How reproducible:
Always

Steps to Reproduce:
1. Run the following hammer commands with a valid host collection but invalid host ids
`hammer host-collection add-host --id 1 --host-ids 2354,34`
`hammer host-collection remove-host --id 1 --host-ids 2354,34`

Actual results:
The host(s) has been added
The host(s) has been removed

Expected results:
Could not find hosts with IDs 2354,34. No hosts added.
Could not find hosts with IDs 2354,34. No hosts removed.

Additional info:

Comment 1 Andrew Kofink 2016-06-03 17:29:55 UTC
Created redmine issue http://projects.theforeman.org/issues/15291 from this bug

Comment 3 Bryan Kearney 2016-08-08 16:15:33 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/15291 has been closed

Comment 8 Bruno Rocha 2016-11-14 19:20:43 UTC
Verified in:

Conclusion: Still failing


[root@ibm-x3550m3-09 ~]# hammer -u admin host-collection add-host --id 1 --host-ids 2354,34,899090,666
The host(s) has been added

I can put any id in host ids even invalid values as

[root@ibm-x3550m3-09 ~]# hammer -u admin -p changeme host-collection add-host --id 1 --host-ids 0
The host(s) has been added

also accepts strings

[root@ibm-x3550m3-09 ~]# hammer -u admin -p changeme host-collection add-host --id 1 --host-ids banana,ironmaiden,pythonrocks,thisisnotanid
The host(s) has been added

Comment 9 Bruno Rocha 2016-11-14 19:21:47 UTC
version: satellite-6.3.0-6.1.beta.el7sat.noarch - RHEL7

Comment 10 Bryan Kearney 2016-11-14 21:15:53 UTC
Upstream bug component is Hammer - Content

Comment 11 Bruno Rocha 2017-05-26 06:22:33 UTC
Problem still exists in 6.2.10


[root@cloud-qe-09 ~]# hammer -u admin -p changeme host-collection add-host --id 1 --host-ids banana,ironmaiden,pythonrocks,thisisnotanid
The host(s) has been added
[root@cloud-qe-09 ~]# rpm -q satellite
satellite-6.2.10-1.0.el7sat.noarch

Comment 12 Bruno Rocha 2017-09-20 19:03:44 UTC
Problem still happening on 6.3 compose 16

[root@cloud-qe-15 ~]# rpm -q satellite
satellite-6.3.0-18.0.beta.el7sat.noarch

[root@cloud-qe-15 ~]# hammer -u admin -p changeme host-collection add-host --id 1 --host-ids CeciNestPasUneID

The host(s) has been added

[root@cloud-qe-15 ~]# hammer host-collection add-host --id 1 --host-ids 2354,34
The host(s) has been added


[root@cloud-qe-15 ~]# hammer host-collection remove-host --id 1 --host-ids 2354,34
The host(s) has been removed

[root@cloud-qe-15 ~]# hammer host-collection remove-host --id 1 --host-ids CeciNestPasUneID
The host(s) has been removed

Comment 13 Bruno Rocha 2017-10-26 15:05:40 UTC
[root@cloud-qe-19 ~]# rpm -q satellite
satellite-6.3.0-21.0.beta.el7sat.noarch


[root@cloud-qe-19 ~]# hammer host-collection add-host --id 1 --host-ids 2354,34
Could not add host(s)
Host with ID 2354 not found.
Host with ID 34 not found.

[root@cloud-qe-19 ~]# hammer -u admin -p changeme host-collection add-host --id 1 --host-ids CeciNestPasUneID
Could not add host(s)
Host with ID 0 not found.

[root@cloud-qe-19 ~]# hammer host-collection remove-host --id 1 --host-ids CeciNestPasUneID
Could not remove host(s)
Host with ID 0 not found.

Comment 14 Bryan Kearney 2018-02-21 16:42:20 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

Comment 15 Bryan Kearney 2018-02-21 16:46:23 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