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 2180568 - Represent 'unlimited' as 0 for `hammer host-registration generate-command`
Summary: Represent 'unlimited' as 0 for `hammer host-registration generate-command`
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Registration
Version: 6.13.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: 6.15.0
Assignee: Girija Soni
QA Contact: Shweta Singh
Zuzana Lena Ansorgova
URL:
Whiteboard:
: 2228192 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-03-21 19:37 UTC by Pablo Mendez Hernandez
Modified: 2024-04-23 17:14 UTC (History)
12 users (show)

Fixed In Version: foreman-3.9.1.3-1
Doc Type: Bug Fix
Doc Text:
.Generate host registration commands by using 0 as unlimited for JWT expiration Previously, it was not clear what value Hammer and API accept for generation of the host registration command with an unlimited authorization token. The accepted values are as follows: * 0 means unlimited * A value between 0 and 999999 is expiration in hours, 4 hours by default * Other values are not accepted. With this release, the unlimited value has been clarified in the Hammer help and API reference.
Clone Of:
Environment:
Last Closed: 2024-04-23 17:13:57 UTC
Target Upstream Version:
Embargoed:
gisoni: needinfo+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 36972 0 Normal New `hammer host-registration generate-command` doesn't accept `unlimited` as JWT life time 2023-12-11 07:51:30 UTC
Red Hat Issue Tracker SAT-16950 0 None None None 2023-04-04 08:28:02 UTC
Red Hat Product Errata RHSA-2024:2010 0 None None None 2024-04-23 17:13:59 UTC

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.

Comment 6 Leos Stejskal 2023-09-11 10:50:02 UTC
I will prioritize with my team, but looking at the description I believe this should
be a bug, not an RFE, It works in UI, but not in API.

Comment 7 Sayan Das 2023-11-13 14:09:43 UTC
Removing the FutureFeature keyword based on comment 6. Please consider it as a bug for hammer.

Comment 8 Girija Soni 2023-12-11 07:51:27 UTC
Created redmine issue https://projects.theforeman.org/issues/36972 from this bug

Comment 14 Shweta Singh 2024-01-23 11:04:08 UTC
FailedQA

Version Tested: 
1. Generate the curl command with "--jwt-expiration" option, set it to 0 for unlimited.

Observation:
When x < 0, it does not raises any error.

Comment 15 Pablo Mendez Hernandez 2024-01-23 12:14:21 UTC
```
# hammer -u admin -p $PASSWORD host-registration generate-command --organization "Default Organization" --activation-key $AK --location $LOCATION --jwt-expiration unlimited
Failed to generate registration command:
  Error: Option '--jwt-expiration': Numeric value is required..
```

Comment 16 Pablo Mendez Hernandez 2024-01-23 12:17:26 UTC
This was even in stream:

```
# rpm -q foreman
foreman-3.10.0-0.4.develop.20240116220126git0b40a64.el8sat.noarch
```

Comment 20 Shweta Singh 2024-02-05 07:40:48 UTC
Verified.

Version Tested: Satellite 6.15.0 Snap 8.0

Verification Steps:
1. Generate the curl command with "--jwt-expiration" option. Set it to different options as below and see if it works.
x = 0 Unlimited token
x < 0 raises an error, invalid value
x > 999999 raises an error, invalid value
x > 0 expiration in hours.
x = 4 default hours.

Result: Token life time values are working as expected.

Comment 33 errata-xmlrpc 2024-04-23 17:13:57 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 (Important: Satellite 6.15.0 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-2024:2010


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