Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 2228192

Summary: API can be used to generate global registration curl with unlimited parameter but hammer with the same parameter reports error.
Product: Red Hat Satellite Reporter: Manu Sunil <msunil>
Component: RegistrationAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.13.3CC: lstejska, saydas, s.heijmans
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-08-02 08:10:51 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 Manu Sunil 2023-08-01 17:29:53 UTC
Description of problem:

- API can be used to generate global registration curl with unlimited parameter but hammer with the same parameter reports error.

Version-Release number of selected component (if applicable):

How reproducible:

- Always

Steps to Reproduce:

1. Generate a registration command with API with jwt_expiration parameter set to unlimited.

   ~~~
   curl --insecure --user test:test --header 'Content-Type: application/json' --request POST 'https://localhost/api/registration_commands/' --data-raw '{"force": 1,"organization_id": 1,"setup_insights": 0,"setup_remote_execution": 1,"setup_remote_execution_pull": 0,"activation_key": "GENERAL","insecure": 1,"jwt_expiration": "unlimited"}'
   ~~~

   The API call generates the registration command successfully.

   ~~~
   2023-08-01T10:39:10 [I|app|01930a94]   Parameters: {"force"=>1, "organization_id"=>1, "setup_insights"=>0, "setup_remote_execution"=>1, "setup_remote_execution_pull"=>0, "activation_key"=>"GENERAL", "insecure"=>1, "jwt_expiration"=>"unlimited", "apiv"=>"v2", "registration_command"=>{"force"=>1, "organization_id"=>1, "setup_insights"=>0, "setup_remote_execution"=>1, "setup_remote_execution_pull"=>0, "activation_key"=>"GENERAL", "insecure"=>1, "jwt_expiration"=>"unlimited"}}
   ~~~

2. Run registration command generation using hammer. 

   ~~~
   hammer  host-registration generate-command --organization RedHat --location Pune --insecure true --activation-key GENERAL --jwt-expiration "unlimited"
   ~~~

   Hammer command reports the following message.

   ~~~
   Failed to generate registration command:
     Error: Option '--jwt-expiration': Numeric value is required..
   ~~~

Additional info:

- In both the cases, the accepted value is a number 

  APIDOC:
  ~~~
  registration_command[jwt_expiration]
  optional , nil allowed  
  Expiration of the authorization token (in hours)
  
  Validations:
  
  Must be a number.
  ~~~

With the API , it works after passing `unlimited` as well. The validation is not performed here unlike in hammer.

Comment 1 Leos Stejskal 2023-08-02 08:10:51 UTC
Thanks for reporting the issue, this one we know about, reported in https://bugzilla.redhat.com/show_bug.cgi?id=2180568

*** This bug has been marked as a duplicate of bug 2180568 ***