Bug 1103080

Summary: hammer: cmd to remove a content host from host-collection should use system id instead of UUID
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: HammerAssignee: Dustin Tsang <dtsang>
Status: CLOSED CURRENTRELEASE QA Contact: Tazim Kolhar <tkolhar>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.0.3CC: bbuckingham, cwelton, jmontleo, mmccune, tkolhar
Target Milestone: UnspecifiedKeywords: Reopened, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-02 14:14:47 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 Sachin Ghai 2014-05-30 08:04:24 UTC
Description of problem:
to remove a content-host from host collection, I passed system-id (as help says) but commands throws:

Could not remove content host:
  Couldn't find Katello::System with uuid = 3

Its misleading, either we need to update the --help to use --UUID or we need to update the cli api to use --system-id.

[root@dhcp207-55 ~]# hammer host-collection content-hosts --id 1
---|--------------------------------------|--------------------------
ID | UUID                                 | NAME                     
---|--------------------------------------|--------------------------
2  | 92c8c0a4-fcd8-4d00-a1de-900bf742c96e | vodka.katellolabs.org    
3  | 3a248438-5092-467d-8ee0-1671fb125ef4 | scroponok.katellolabs.org
---|--------------------------------------|--------------------------


[root@dhcp207-55 ~]# hammer host-collection remove-content-host --name hc1 --organization-id 1 --system-id 3

Could not remove content host:
  Couldn't find Katello::System with uuid = 3


[root@dhcp207-55 ~]# hammer host-collection remove-content-host --help
Usage:
    hammer host-collection remove-content-host [OPTIONS]

Options:
    --id ID                        
    --name NAME                   Name to search by
    --organization ORGANIZATION_NAME  
    --organization-id ORGANIZATION_ID  
    --organization-label ORGANIZATION_LABEL  
    --system SYSTEM_NAME           
    --system-id SYSTEM_ID          
    -h, --help                    print help




Version-Release number of selected component (if applicable):
sat6 beta snap7 compose 2 (Satellite-6.0.3-RHEL-6-20140528.4)

How reproducible:
always

Steps to Reproduce:
1. 
2.
3.

Actual results:


Expected results:
we need to update the --help to use --UUID or we need to update the cli api to use --system-id.

Additional info:

Comment 1 RHEL Program Management 2014-05-30 08:24:48 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 Brad Buckingham 2014-06-02 19:09:01 UTC
As part of the fix for bug 1097633, the host-collections commands were updated to consistently use 'uuid' vs 'id' to represent the content-host.  As a result, the user is intended to provide a uuid as the input and not a db id.  That said, it does look like there is minor update to the helptext to ensure the user knows what to provide.  The current helptext looks like:

Note: --system-ids has proper description, but --system-id does not

$ bundle exec hammer host-collection create --help                                                                                                                                                             
Usage:
    hammer host-collection create [OPTIONS]

Options:
    --activation-key ACTIVATION_KEY_NAME  
    --activation-key-id ACTIVATION_KEY_ID  
    --description DESCRIPTION      
    --max-content-hosts MAX_CONTENT_HOSTS Maximum number of content hosts in the host collection
    --name NAME                   Host Collection name
    --organization ORGANIZATION_NAME  
    --organization-id ORGANIZATION_ID organization identifier
    --organization-label ORGANIZATION_LABEL  
    --system SYSTEM_NAME           
    --system-id SYSTEM_ID          
    --system-ids SYSTEM_IDS       List of system uuids to be in the host collection
                                  Comma separated list of values.
    -h, --help                    print help


$ bundle exec hammer host-collection update --help
Usage:
    hammer host-collection update [OPTIONS]

Options:
    --activation-key ACTIVATION_KEY_NAME  
    --activation-key-id ACTIVATION_KEY_ID  
    --description DESCRIPTION      
    --id ID                       Id of the host collection
    --max-content-hosts MAX_CONTENT_HOSTS Maximum number of content hosts in the host collection
    --name NAME                   Host Collection name
    --new-name NEW_NAME            
    --organization ORGANIZATION_NAME  
    --organization-id ORGANIZATION_ID  
    --organization-label ORGANIZATION_LABEL  
    --system SYSTEM_NAME           
    --system-id SYSTEM_ID          
    --system-ids SYSTEM_IDS       List of system uuids to be in the host collection
                                  Comma separated list of values.
    -h, --help                    print help


$ bundle exec hammer host-collection add-content-host --help  
Usage:
    hammer host-collection add-content-host [OPTIONS]

Options:
    --id ID                        
    --name NAME                   Name to search by
    --organization ORGANIZATION_NAME  
    --organization-id ORGANIZATION_ID  
    --organization-label ORGANIZATION_LABEL  
    --system SYSTEM_NAME           
    --system-id SYSTEM_ID          
    -h, --help                    print help

$ bundle exec hammer host-collection remove-content-host --help
Usage:
    hammer host-collection remove-content-host [OPTIONS]

Options:
    --id ID                        
    --name NAME                   Name to search by
    --organization ORGANIZATION_NAME  
    --organization-id ORGANIZATION_ID  
    --organization-label ORGANIZATION_LABEL  
    --system SYSTEM_NAME           
    --system-id SYSTEM_ID          
    -h, --help                    print help

Comment 4 Dustin Tsang 2014-06-09 17:35:15 UTC
Hi Sachin,

To make things consistent, the UUID will be presented to the user as the ID.
* All ids accepted for --systemid, --system-ids should take a uuid. 
* however the helpful comments describing --system-ids, --system-ids should describe arguments that take ID.
* all ID fields presented for content-hosts should display the uuid. (hammer content-host info/list/create should display the ID as the uuid)


https://github.com/Katello/hammer-cli-katello/pull/180
https://github.com/Katello/hammer-cli-katello/pull/181
https://github.com/Katello/hammer-cli-katello/pull/183
https://github.com/Katello/hammer-cli-katello/pull/185

Comment 8 Tazim Kolhar 2014-06-16 10:27:55 UTC
VERIFIED :

# hammer host-collection content-hosts --name test-host-group  --organization ACME_Corporation
-------------------------------------|---------
ID                                   | NAME    
-------------------------------------|---------
9fc0eb11-3500-4f1a-ae6b-47cdaf7f505b | test.org

# hammer host-collection remove-content-host --name test-host-group --organization ACME_Corporation --system-ids 9fc0eb11-3500-4f1a-ae6b-47cdaf7f505b
The content host(s) has been removed

# hammer host-collection content-hosts --name test-host-group  --organization ACME_Corporation
No data.

Comment 9 Bryan Kearney 2014-07-02 14:09:56 UTC
This was delivered with 6.0.3, which is the Satellite 6 Beta.

Comment 10 Bryan Kearney 2014-07-02 14:10:16 UTC
This was delivered in 6.0.3, the Beta version of Satellite 6.0

Comment 11 Bryan Kearney 2014-07-02 14:14:47 UTC
This was delivered in the Satellite 6 Beta (6.0.3)