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 ***