Bug 2180568

Summary: `hammer host-registration generate-command` doesn't accept `unlimited` as JWT life time
Product: Red Hat Satellite Reporter: Pablo Mendez Hernandez <pmendezh>
Component: RegistrationAssignee: satellite6-bugs <satellite6-bugs>
Status: NEW --- QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.13.0CC: ahumbe, jhutar, lstejska, msunil, rlavi, saydas, shwsingh
Target Milestone: UnspecifiedKeywords: FutureFeature, Triaged
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: 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 Pablo Mendez Hernandez 2023-03-21 19:37:51 UTC
Description of problem:

When trying to create a host-registration script with an unlimited life time using hammer, it complains about the parameter not being numeric (it's possible to set that generate that same script with unlimited life time through the web UI):

```
# hammer host-registration generate-command --organization-id 1 --activation-key $AK --jwt-expiration unlimited --insecure true --force true
Failed to generate registration command:
  Error: Option '--jwt-expiration': Numeric value is required..
  
  See: 'hammer host-registration generate-command --help'.
```

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

Satellite 6.13 Snap 15


How reproducible:

Always.


Steps to Reproduce:
1.
2.
3.


Actual results:

Host registration command is not generated.


Expected results:

Host registration command should be generated with an unlimited JWT life time.


Additional info:

Comment 1 Ron Lavi 2023-04-04 08:27:29 UTC
I made this an RFE, to propose the support of `unlimited` token expiration option also in Hammer and also API

Comment 3 Leos Stejskal 2023-08-02 08:10:51 UTC
*** Bug 2228192 has been marked as a duplicate of this bug. ***

Comment 4 Sayan Das 2023-08-02 08:41:53 UTC
An important point to add ( mentioned in dup BZ# 2228192 )  is that when we use the API, it accepts "unlimited" as a valid value ( same as UI ). But it seems it's just the hammer with some validation in place which would not accept anything except a numerical value.