Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-19016

The registration_commands api endpoint does not replace unicode with ASCII

XMLWordPrintable

    • 0
    • False
    • Moderate
    • None
    • None
    • None
    • To Do

      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

      1. 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:

              jira-bugzilla-migration RH Bugzilla Integration
              mjiao@redhat.com Manjun Jiao
              RH Bugzilla Integration RH Bugzilla Integration
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: