Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-14094

AttributeError: module 'platform' has no attribute 'linux_distribution'"

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Undefined Undefined
    • rhel-9.4
    • rhel-9.3.0
    • tracer
    • None
    • None
    • rhel-sst-cs-system-management
    • ssg_core_services
    • 23
    • None
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None

      Tracer crashes if it encounters an unknown distro in /etc/os-release. One of Cockpit's tests removes /etc/os-release.

      rm -f /etc/os-release
      python3 -c 'from tracer.query import Query; print(Query().affected_applications().get())'
      

      With that, tracer crashes:

      Traceback (most recent call last):
        File \"<string>\", line 5, in <module>
        File \"/usr/lib/python3.9/site-packages/tracer/query.py\", line 44, in __init__
          self._tracer = tracer(System.package_manager(), Rules, Applications, dump_memory)
        File \"/usr/lib/python3.9/site-packages/tracer/resources/system.py\", line 90, in package_manager
          distro = System.distribution()
        File \"/usr/lib/python3.9/site-packages/tracer/resources/system.py\", line 60, in distribution
          return platform.linux_distribution(full_distribution_name=False)[0]
      AttributeError: module 'platform' has no attribute 'linux_distribution'"
      

      Indeed the platform module does not have a linux_distribution any more. These were all deprecated in Python 3.5 and removed in 3.8. So this still works in RHEL 8, but not RHEL 9 / Fedora any more.

      python3-tracer-0.7.5-4.el9.noarch

              jkadlcik Jakub Kadlčík
              rhn-engineering-mpitt Martin Pitt
              Jakub Kadlčík Jakub Kadlčík
              Evgeny Fedin Evgeny Fedin
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: