Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2082241 - hammer host-collection create fails with "Too many arguments" when setting unlimited-hosts
Summary: hammer host-collection create fails with "Too many arguments" when setting un...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Host Collections
Version: 6.11.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.11.0
Assignee: Partha Aji
QA Contact: Stephen Wadeley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-05-05 16:28 UTC by Stephen Wadeley
Modified: 2022-08-02 05:32 UTC (History)
2 users (show)

Fixed In Version: tfm-rubygem-katello-4.3.0.38-1,tfm-rubygem-hammer_cli_katello-1.3.1.5-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-07-05 14:35:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 34889 0 Normal New hammer host-collection update inconsistent with create 2022-05-10 16:07:49 UTC
Red Hat Product Errata RHSA-2022:5498 0 None None None 2022-07-05 14:35:58 UTC

Description Stephen Wadeley 2022-05-05 16:28:06 UTC
Description of problem:

hammer host-collection create fails with "Too many arguments" when setting unlimited-hosts

Version-Release number of selected component (if applicable):
~]# rpm -q satellite
satellite-6.11.0-0.11.beta.el8sat.noarch

snap 19

How reproducible:
Every time


Steps to Reproduce:
1. ~]# hammer host-collection create --name="Test2" --organization-id="24" --unlimited-hosts="True"


2.  ~]# hammer host-collection create --name="Test2" --organization-id="24" --unlimited-hosts=1



Actual results:
Could not create the host collection:
  Error: Too many arguments.

Expected results:
Host Collection is created


Additional info:
Found by test automation
https://github.com/SatelliteQE/robottelo/blob/522377e8fac861b1b6819c92dc08ce9851302468/tests/foreman/cli/test_hostcollection.py#L137

Comment 1 Stephen Wadeley 2022-05-05 16:39:55 UTC
Hi

In production.log I only see the successful test (Test1, without --unlimited-hosts="True"), not the failures:

2022-05-05T12:19:23 [I|app|e257f9c4] Started POST "/katello/api/organizations/24/host_collections" for 10.1.2.241 at 2022-05-05 12:19:23 -0400
2022-05-05T12:19:23 [I|app|e257f9c4] Processing by Katello::Api::V2::HostCollectionsController#create as JSON
2022-05-05T12:19:23 [I|app|e257f9c4]   Parameters: {"name"=>"Test1", "api_version"=>"v2", "organization_id"=>"24", "host_collection"=>{"name"=>"Test1"}}
2022-05-05T12:19:23 [I|app|e257f9c4] Authorized user admin(Admin User)
2022-05-05T12:19:23 [I|aud|e257f9c4] Katello::HostCollection (1) create event on name Test1
2022-05-05T12:19:23 [I|aud|e257f9c4] Katello::HostCollection (1) create event on description 
2022-05-05T12:19:23 [I|aud|e257f9c4] Katello::HostCollection (1) create event on max_hosts 
2022-05-05T12:19:23 [I|aud|e257f9c4] Katello::HostCollection (1) create event on organization_id 24
2022-05-05T12:19:23 [I|aud|e257f9c4] Katello::HostCollection (1) create event on unlimited_hosts true
2022-05-05T12:19:23 [I|app|e257f9c4]   Rendering /usr/share/gems/gems/katello-4.3.0.33/app/views/katello/api/v2/host_collections/create.json.rabl within katello/api/v2/layouts/resource
2022-05-05T12:19:23 [I|app|e257f9c4]   Rendered /usr/share/gems/gems/katello-4.3.0.33/app/views/katello/api/v2/host_collections/create.json.rabl within katello/api/v2/layouts/resource (Duration: 29.3ms | Allocations: 4952)
2022-05-05T12:19:23 [I|app|e257f9c4] Completed 201 Created in 305ms (Views: 42.7ms | ActiveRecord: 43.1ms | Allocations: 26902)

Comment 2 Partha Aji 2022-05-09 20:40:29 UTC
Hey Stephen,

Have you tried 
`hammer host-collection create --name="Test2" --organization-id=1 --unlimited-hosts`

That should work. '--unlimited-hosts' is a flag not an option.

Comment 3 Stephen Wadeley 2022-05-10 06:40:40 UTC
Hi Partha

That raises a question, why did test automation pass before?


E             'unlimited-hosts': 'True'}

Testing on 6.11.0-19.0-rhel7.9
~]# hammer --version
hammer (3.1.0.1)
 * hammer_cli_foreman (3.1.0)
 * hammer_cli_foreman_admin (1.1.0)

* hammer_cli_katello (1.3.1.2

[root@xxx ~]# rpm -q satellite
satellite-6.11.0-0.11.beta.el7sat.noarch
[root@xxx ~]# hammer host-collection create --name="Test1" --organization-id=1
Host collection created.

[root@xxx ~]# hammer host-collection info --name="Test1" --organization-id=1 
Id:          1
Name:        Test1
Limit:       None   <----- Note (so that is the default)
Description: 
Total Hosts: 0

[root@xxx ~]# hammer host-collection create --name="Test2" --organization-id=1 --unlimited-hosts
Host collection created.

[root@xxx ~]# hammer host-collection info --name="Test2" --organization-id=1 
Id:          2
Name:        Test2
Limit:       None
Description: 
Total Hosts: 0


~]# hammer host-collection create --name="Test3" --organization-id=1 --max-hosts 10
Host collection created.
[root@xxx ~]# hammer host-collection info --name="Test3" --organization-id=1 
Id:          3
Name:        Test3
Limit:       10
Description: 
Total Hosts: 0


Another question, why does it require a value in the case of updating?

[root@xxx ~]# hammer host-collection update --name="Test3" --organization-id=1 --unlimited-hosts
Could not update the the host collection:
  Error: Option '--unlimited-hosts': Value must be one of true/false, yes/no, 1/0..
  
  See: 'hammer host-collection update --help'.

[root@xxx ~]# hammer host-collection update --name="Test3" --organization-id=1 --unlimited-hosts=1   <--- NOTE
Host collection updated.
[root@xxx ~]# hammer host-collection info --name="Test3" --organization-id=1 
Id:          3
Name:        Test3
Limit:       None
Description: 
Total Hosts: 0


Thank you

Comment 4 Partha Aji 2022-05-10 16:02:57 UTC
Re ""That raises a question, why did test automation pass before? ""

This got added as part of ->  https://bugzilla.redhat.com/show_bug.cgi?id=1813624

"""
Another question, why does it require a value in the case of updating?
"""

Sounds like a bug . I 'll put in a upstream issue for that.

Comment 5 Partha Aji 2022-05-10 16:07:48 UTC
Connecting redmine issue https://projects.theforeman.org/issues/34889 from this bug

Comment 6 Bryan Kearney 2022-05-10 20:05:06 UTC
Upstream bug assigned to paji

Comment 7 Bryan Kearney 2022-05-10 20:05:08 UTC
Upstream bug assigned to paji

Comment 8 Stephen Wadeley 2022-05-11 06:01:14 UTC
(In reply to Partha Aji from comment #4)
> Re ""That raises a question, why did test automation pass before? ""
> 
> This got added as part of -> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1813624
> 

Has the suggestion in the "Additional info:" section[1] has not been accepted?


[1] https://bugzilla.redhat.com/show_bug.cgi?id=1813624#c0

Comment 9 Bryan Kearney 2022-05-11 20:04:47 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/34889 has been resolved.

Comment 15 errata-xmlrpc 2022-07-05 14:35:32 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 (Moderate: Satellite 6.11 Release), 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-2022:5498


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