Uploaded image for project: 'RHEL Conversions'
  1. RHEL Conversions
  2. RHELC-745

Fix the conversion when the LANGUAGE env var is set

XMLWordPrintable

      1. Run c2r with: LANGUAGE=FR_fr convert2rhel --debug --no-rpm-va
      2. Answer "y" whenever asked to continue
      3. observe the traceback
    • False
    • False
    • Hide

      None

      Show
      None
    • 3
    • 2022-Q3, 2022-Q4, 2023-Q1

      Currently, the LANGUAGE env var doesn't work, and when running it with the conversion you run into this traceback:

      07/22/2022 20:08:36] TASK - [Convert: Subscription Manager - Replace] **************************
      Unregistering the system.
      [07/22/2022 20:08:36] DEBUG - Calling command 'rpm --quiet -q subscription-manager'
      [07/22/2022 20:08:36] DEBUG - Calling command 'subscription-manager unregister'
      [07/22/2022 20:08:36] DEBUG - Traceback (most recent call last):
        File "/usr/lib/python2.7/site-packages/convert2rhel/main.py", line 101, in main
          pre_ponr_conversion()
        File "/usr/lib/python2.7/site-packages/convert2rhel/main.py", line 195, in pre_ponr_conversion
          subscription.replace_subscription_manager()
        File "/usr/lib/python2.7/site-packages/convert2rhel/subscription.py", line 361, in replace_subscription_manager
          unregister_system()
        File "/usr/lib/python2.7/site-packages/convert2rhel/subscription.py", line 100, in unregister_system
          output, ret_code = utils.run_subprocess(unregistration_cmd, print_output=False)
        File "/usr/lib/python2.7/site-packages/convert2rhel/utils.py", line 145, in run_subprocess
          output += line.decode()
      UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128)
      

      We see this because convert2rehl doesn't specify anywhere what codec to use, so it is up to Python to try and guess what codec to use. For python 2.7, this doesn't work, so the fix for this is to set the codec to utf-8.

      The conversion still won't work as intended, as after some research, I have found that the  "LANGUAGE" envar needs to be added to the list of environment variables with LC_ALL and LANG.

      Acceptance criteria

      • Run convert2rhel with non-standard locale, such as export LANGUAGE=fr_FR and get it working without a traceback. Make sure the locale is available on the system (run `locale -a`).
      • We should specify using the UTF-8 codec, which should resolve the traceback. 
      • We should also add the "LANGUAGE" environment variable with the others.

              aanglin@redhat.com Andrew Anglin
              aanglin@redhat.com Andrew Anglin
              Daniel Diblik Daniel Diblik
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: