Bug 1103080 - hammer: cmd to remove a content host from host-collection should use system id instead of UUID
Summary: hammer: cmd to remove a content host from host-collection should use system i...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.0.3
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: Unspecified
Assignee: Dustin Tsang
QA Contact: Tazim Kolhar
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-05-30 08:04 UTC by Sachin Ghai
Modified: 2019-09-26 18:14 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-02 14:14:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

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)


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