Bug 1328925 - Several host-collection commands are missing the organization options
Summary: Several host-collection commands are missing the organization options
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: Unspecified
Assignee: Andrew Kofink
QA Contact: sthirugn@redhat.com
URL: http://projects.theforeman.org/issues...
Whiteboard:
: 1324848 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-20 15:42 UTC by sthirugn@redhat.com
Modified: 2019-11-14 07:50 UTC (History)
7 users (show)

Fixed In Version: rubygem-hammer_cli_katello-0.0.22.15-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-27 11:34:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 14853 0 Normal Closed Several host-collection commands are missing the organization options 2020-07-16 14:46:52 UTC

Description sthirugn@redhat.com 2016-04-20 15:42:52 UTC
Description of problem:
host-collection update/delete - commands missing organization options

Version-Release number of selected component (if applicable):
satellite-6.2.0-8.2.beta.el7sat.noarch

How reproducible:
Always

Steps to Reproduce:
hammer> host-collection delete --help
Usage:
     host-collection delete [OPTIONS]

Options:
 --id ID                       Id of the host collection
 --name NAME                   Host collection name to search by
 -h, --help                    print help

hammer> host-collection update --help
Usage:
     host-collection update [OPTIONS]

Options:
 --description DESCRIPTION          
 --host-ids HOST_IDS               List of host ids to replace the hosts in host collection
                                   Comma separated list of values.
 --hosts HOST_NAMES                Comma separated list of values.
 --id ID                           Id of the host collection
 --max-hosts MAX_HOSTS             Maximum number of hosts in the host collection
 --name NAME                       Host collection name to search by
 --new-name NEW_NAME               Host Collection name
 --unlimited-hosts UNLIMITED_HOSTS Whether or not the host collection may have unlimited hosts
                                   One of true/false, yes/no, 1/0.
 -h, --help                        print help

Actual results:
No organization options as shown above

Expected results:
Organization options should be present

Additional info:

Comment 2 Elyézer Rezende 2016-04-20 18:32:18 UTC
`host-collection add-host` is also not accepting the organization options.

Comment 3 Andrii Balakhtar 2016-04-21 09:38:28 UTC
Actually any sub-command except `create` and `list` is not accepting organization. Full list of affected commands:
host-collection add-host
host-collection copy
host-collection delete
host-collection erratum install
host-collection hosts (this one seems completely broken as it doesn't accept anything at all)
host-collection info
host-collection package install
host-collection package remove
host-collection package update
host-collection package-group install
host-collection package-group remove
host-collection package-group update
host-collection remove-host
host-collection update

Comment 4 Andrew Kofink 2016-04-27 15:00:01 UTC
Created redmine issue http://projects.theforeman.org/issues/14853 from this bug

Comment 5 Bryan Kearney 2016-04-27 16:01:37 UTC
Upstream bug component is Hammer

Comment 6 Andrew Kofink 2016-05-02 13:54:49 UTC
It seems to me that many of these commands shouldn't require or allow an organization to be specified. The following should require an organization to be specified (according to the web UI):

hammer host-collection create (organization is required)
hammer host-collection list (organization is optional)

Updating a host collection via the web UI does not allow changing the organization, so why would we allow this via hammer?

The remainder of the hammer host-collection commands should not require an organization to be specified, and if they did, what exactly would it do?

 add-host                      Add host to the host collection
 copy                          Make copy of a host collection
 delete                        Destroy a host collection
 erratum                       Manipulate errata for a host collection
 hosts                          
 info                          Show a host collection
 package                       Manipulate packages for a host collection
 package-group                 Manipulate package-groups for a host collection
 remove-host                   Remove hosts from the host collection

Comment 7 sthirugn@redhat.com 2016-05-02 14:07:38 UTC
Most of the katello commands either accept the entity id or entity name.  
* If entity id is specified, it doesnt required org id or org name, as entity id is unique across satellite
* If entity is specified, it required org id or org name to find the entity as entity name can be duplicated across orgs unlike entity id.

Comment 8 Andrew Kofink 2016-05-12 15:25:23 UTC
*** Bug 1324848 has been marked as a duplicate of this bug. ***

Comment 9 Mike McCune 2016-06-06 15:33:40 UTC
The --organization flags are not for modification of the organization on the host-collection, they are used for the lookup of the Host Collection within a specific organization when the --name flag is specified for the operation:


# hammer host-collection delete --name test-hg --organization-id 4

this will delete the test-hg from org 4

# hammer host-collection update --name test-hg --max-hosts 999 --organization-id 4

this will update test-hg to have a max-hosts of 999, will not modify the organization.

we need the --org* flags back for the operations within host-collection so we can lookup the object by name

Comment 10 Bryan Kearney 2016-06-06 16:15:00 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/14853 has been closed

Comment 11 Bryan Kearney 2016-06-20 19:41:47 UTC
Verified.
Verified on Snap 16
satellite-cli-6.2.0-15.1.beta.el7sat.noarch
satellite-6.2.0-15.1.beta.el7sat.noarch

Steps to Verify:

[vagrant@sat-test-rhel7 ~]$ hammer -u admin -p changeme shell
Welcome to the hammer interactive shell
Type 'help' for usage information
hammer> host-collection create --help
Usage:
     host-collection create [OPTIONS]

Options:
 --description DESCRIPTION                
 --host-ids HOST_IDS                     List of host ids to replace the hosts in host collection
                                         Comma separated list of values.
 --hosts HOST_NAMES                      Comma separated list of values.
 --max-hosts MAX_HOSTS                   Maximum number of hosts in the host collection
 --name NAME                             Host Collection name
 --organization ORGANIZATION_NAME        Organization name to search by
 --organization-id ORGANIZATION_ID       organization ID
 --organization-label ORGANIZATION_LABEL Organization label to search by
 --unlimited-hosts UNLIMITED_HOSTS       Whether or not the host collection may have unlimited hosts
                                         One of true/false, yes/no, 1/0.
 -h, --help                              print help
hammer> host-collection delete --help
Usage:
     host-collection delete [OPTIONS]

Options:
 --id ID                                 Id of the host collection
 --name NAME                             Host collection name to search by
 --organization ORGANIZATION_NAME        Organization name to search by
 --organization-id ORGANIZATION_ID       Organization ID to search by
 --organization-label ORGANIZATION_LABEL Organization label to search by
 -h, --help                              print help

hammer> host-collection update --help
Usage:
     host-collection update [OPTIONS]

Options:
 --description DESCRIPTION                  
 --host-ids HOST_IDS                       List of host ids to replace the hosts in host collection
                                           Comma separated list of values.
 --hosts HOST_NAMES                        Comma separated list of values.
 --id ID                                   Id of the host collection
 --max-hosts MAX_HOSTS                     Maximum number of hosts in the host collection
 --name NAME                               Host collection name to search by
 --new-name NEW_NAME                       Host Collection name
 --new-organization-id NEW_ORGANIZATION_ID  
 --organization ORGANIZATION_NAME          Organization name to search by
 --organization-id ORGANIZATION_ID         Organization ID to search by
 --organization-label ORGANIZATION_LABEL   Organization label to search by
 --unlimited-hosts UNLIMITED_HOSTS         Whether or not the host collection may have unlimited hosts
                                           One of true/false, yes/no, 1/0.
 -h, --help                                print help
hammer> host-collection list --help
Usage:
     host-collection list [OPTIONS]

Options:
 --activation-key ACTIVATION_KEY_NAME    Activation key name to search by
 --activation-key-id ACTIVATION_KEY_ID   ID of the activation key
 --available-for AVAILABLE_FOR           Interpret specified object to return only Host Collections that can be
                                         associated with specified object. The value 'host' is supported.
 --by BY                                 Field to sort the results on
 --full-results FULL_RESULTS             Whether or not to show all results
                                         One of true/false, yes/no, 1/0.
 --host HOST_NAME                        Name to search by
 --host-id HOST_ID                        
 --name NAME                             host collection name to filter by
 --order ORDER                           Sort field and order, eg. 'name DESC'
 --organization ORGANIZATION_NAME        Organization name to search by
 --organization-id ORGANIZATION_ID       organization ID
 --organization-label ORGANIZATION_LABEL Organization label to search by
 --page PAGE                             Page number, starting at 1
 --per-page PER_PAGE                     Number of results per page to return
 --search SEARCH                         Search string
 -h, --help                              print help
hammer> host-collection info --help
Usage:
     host-collection info [OPTIONS]

Options:
 --id ID                                 Id of the host collection
 --name NAME                             Host collection name to search by
 --organization ORGANIZATION_NAME        Organization name to search by
 --organization-id ORGANIZATION_ID       Organization ID to search by
 --organization-label ORGANIZATION_LABEL Organization label to search by
 -h, --help                              print help
hammer> host-collection create --name "Jar Jar" --organization-id 1
Host collection created
hammer> host-collection create list --organization-id 1
Could not create the host collection:
  Error: too many arguments
  
  See: ' host-collection create --help'
hammer> host-collection list --organization-id 1
---|---------|-------|------------
ID | NAME    | LIMIT | DESCRIPTION
---|---------|-------|------------
1  | Jar Jar | None  |            
---|---------|-------|------------
hammer> host-collection delete --name "Jar Jar" --organization-id 1
Host collection deleted
hammer>

Comment 12 Bryan Kearney 2016-07-27 11:34:42 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/RHBA-2016:1501


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