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 2222554

Summary: The registration_commands api endpoint does not replace unicode with ASCII
Product: Red Hat Satellite Reporter: matt jia <mjia>
Component: RegistrationAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED MIGRATED QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.13.3CC: ahumbe, lstejska, nalfassi, ofedoren, saydas
Target Milestone: UnspecifiedKeywords: MigratedToJIRA, 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: 2024-06-06 16:24:15 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 matt jia 2023-07-13 05:09:05 UTC
Description of problem:

When calling the api/registration_commands endpoint to generate the host registration command like:

curl -X POST https://xxx.xxx.redhat.com/api/registration_commands \
--user "admin" \
-H 'Content-Type: application/json' \
-d '{ "registration_command": { "activation_keys": ["test-ak "], "location_id": 4, "organization_id": 1 }}'

below curl command is generated:

curl -sS  'https://xxx.xxx.com/register?activation_keys=test-ak+\u0026location_id=4\u0026organization_id=2' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0LCJpYXQiOjE2ODkyMjMxNjUsImp0aSI6ImYzMmU1OTg3OThjMzM4YzAwMTBiNDE2NmUxMzJhMjZjZTkzMDIzZjdmYjY0MGVlOTI0MTcyNzgyYjg5NGY1M2IiLCJleHAiOjE2ODkyMzc1NjUsInNjb3BlIjoicmVnaXN0cmF0aW9uI2dsb2JhbCByZWdpc3RyYXRpb24jaG9zdCJ9.0nKQrYqCKSW4O_nohmB4SsquNSuQzd4N4WNuwiJAFBc'

as you can see, \u0026 is there rather &.  The result of running the curl command is that location_id and organization_id are not passed to the global registration template:

~~~
#!/bin/sh

# Make sure, all command output can be parsed (e.g. from subscription-manager)
export LC_ALL=C LANG=C
....
register_host() {
  curl --silent --show-error --cacert $SSL_CA_CERT --request POST https://xx.xxx.redhat.com/register \
       -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0LCJpYXQiOjE2ODkyMjM1NzEsImp0aSI6ImJjMGQyZWM1MGEwZjEwMDc3ZTAxMmQ3ZjgwY2JhOTJhNDE4MDAxMjcwNTA2YjNiYmM3ZGRjYTUwOGNmZGVkOTMiLCJleHAiOjE2ODkyMzc5NzEsInNjb3BlIjoicmVnaXN0cmF0aW9uI2dsb2JhbCByZWdpc3RyYXRpb24jaG9zdCJ9.4UvxwfsvpyTMqZiihLu0R6rLft1-3z1z_p1uQJLnQ8o' \
       --data "host[name]=$(hostname --fqdn)" \
       --data "host[build]=false" \
       --data "host[managed]=false" \
       --data 'host[organization_id]=1' \  <== should be 2 
       --data 'host[location_id]=2' \ <== should be 4

}
~~~

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

6.13

How reproducible:

Easy

Steps to Reproduce:

Generate the registration command with:

~~~
curl -X POST https://xxx.xxx.redhat.com/api/registration_commands \
--user "admin" \
-H 'Content-Type: application/json' \
-d '{ "registration_command": { "activation_keys": ["test-ak "], "location_id": 4, "organization_id": 1 }}'
~~~

Actual results:

unicode characters are not converted to ASCII


Expected results:

unicode characters should be converted to ASCII 

Additional info:

Comment 1 Brad Buckingham 2023-07-13 14:06:29 UTC
Is this a regression in Satellite 6.13?  Thanks!

Comment 2 matt jia 2023-07-13 23:36:06 UTC
Hi Brad,

(In reply to Brad Buckingham from comment #1)
> Is this a regression in Satellite 6.13?  Thanks!

Not really as I can reproduce it on 6.11 too.

Comment 3 nalfassi 2023-07-18 11:09:16 UTC
On which OS are you running your Satellite? We tested it on Fedora and it is working properly, also on RHEL 8 for Satellite 6.14 (latest snap). 
Can you share the output for the `locale` command?

Comment 6 Eric Helms 2024-06-06 16:24:15 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "SAT-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.