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:
`host-collection add-host` is also not accepting the organization options.
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
Created redmine issue http://projects.theforeman.org/issues/14853 from this bug
Upstream bug component is Hammer
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
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.
*** Bug 1324848 has been marked as a duplicate of this bug. ***
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
Moving to POST since upstream bug http://projects.theforeman.org/issues/14853 has been closed
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>
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