Bug 1986485 - otopi uses deprecated API platform.linux_distribution which has been removed in Python 3.7 and later.
Summary: otopi uses deprecated API platform.linux_distribution which has been removed ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: otopi
Classification: oVirt
Component: General
Version: master
Hardware: x86_64
OS: Linux
medium
high
Target Milestone: ovirt-4.5.0
: 1.10.0
Assignee: Sandro Bonazzola
QA Contact: Pavol Brilla
URL:
Whiteboard:
Depends On:
Blocks: oVirt_on_CentOS_Stream_9_Hosts oVirt_Engine_on_CentOS_Stream_9 2034313
TreeView+ depends on / blocked
 
Reported: 2021-07-27 16:41 UTC by Sandro Bonazzola
Modified: 2022-05-03 06:46 UTC (History)
4 users (show)

Fixed In Version: otopi-1.10.0
Clone Of:
Environment:
Last Closed: 2022-05-03 06:46:19 UTC
oVirt Team: Integration
Embargoed:
sbonazzo: ovirt-4.5?
lsvaty: blocker-


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 115935 0 master MERGED use distro module instead of platform 2021-08-20 14:29:03 UTC

Description Sandro Bonazzola 2021-07-27 16:41:03 UTC
Description of problem:

+ cov_otopi otopi packager-install-testpackage2 ODEBUG/packagesAction=str:install ODEBUG/packages=str:testpackage2
+ otopi=otopi
+ name=packager-install-testpackage2
+ shift 2
+ OTOPI_DEBUG=1
+ OTOPI_COVERAGE=1
+ COVERAGE_PROCESS_START=/home/sbonazzo/otopi/automation/coverage.rc
++ mktemp -p /home/sbonazzo/otopi .coverage.XXXXXX
+ COVERAGE_FILE=/home/sbonazzo/otopi/.coverage.Lv85aO
+ otopi CORE/logFileNamePrefix=str:otopi-packager-install-testpackage2 ODEBUG/packagesAction=str:install ODEBUG/packages=str:testpackage2
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'platform' has no attribute 'linux_distribution'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'platform' has no attribute 'linux_distribution'
/usr/share/otopi/otopi-functions: line 47: [: : integer expression expected
Loading plugin group otopi
Loading plugin otopi:core (/usr/share/otopi/plugins/otopi/core)
Loading plugin otopi:dialog (/usr/share/otopi/plugins/otopi/dialog)
Loading plugin otopi:network (/usr/share/otopi/plugins/otopi/network)
***L:ERROR Internal error: module 'platform' has no attribute 'linux_distribution'
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/otopi/main.py", line 141, in execute
    self.context.loadPlugins()
  File "/usr/lib/python3.9/site-packages/otopi/context.py", line 803, in loadPlugins
    self._loadPluginGroups(plugindir, needgroups, loadedgroups)
  File "/usr/lib/python3.9/site-packages/otopi/context.py", line 112, in _loadPluginGroups
    self._loadPlugins(path, path, groupname)
  File "/usr/lib/python3.9/site-packages/otopi/context.py", line 69, in _loadPlugins
    self._loadPlugins(base, d, groupname)
  File "/usr/lib/python3.9/site-packages/otopi/context.py", line 95, in _loadPlugins
    util.loadModule(
  File "/usr/share/otopi/plugins/otopi/network/__init__.py", line 22, in createPlugins
    iptables.Plugin(context=context)
  File "/usr/share/otopi/plugins/otopi/network/iptables.py", line 36, in __init__
    self._distribution = platform.linux_distribution(
AttributeError: module 'platform' has no attribute 'linux_distribution'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/otopi/__main__.py", line 88, in main
    installer.execute()
  File "/usr/lib/python3.9/site-packages/otopi/main.py", line 143, in execute
    util.raiseExceptionInformation(
  File "/usr/lib/python3.9/site-packages/otopi/util.py", line 85, in raiseExceptionInformation
    raise info[1].with_traceback(info[2])
  File "/usr/lib/python3.9/site-packages/otopi/main.py", line 141, in execute
    self.context.loadPlugins()
  File "/usr/lib/python3.9/site-packages/otopi/context.py", line 803, in loadPlugins
    self._loadPluginGroups(plugindir, needgroups, loadedgroups)
  File "/usr/lib/python3.9/site-packages/otopi/context.py", line 112, in _loadPluginGroups
    self._loadPlugins(path, path, groupname)
  File "/usr/lib/python3.9/site-packages/otopi/context.py", line 69, in _loadPlugins
    self._loadPlugins(base, d, groupname)
  File "/usr/lib/python3.9/site-packages/otopi/context.py", line 95, in _loadPlugins
    util.loadModule(
  File "/usr/share/otopi/plugins/otopi/network/__init__.py", line 22, in createPlugins
    iptables.Plugin(context=context)
  File "/usr/share/otopi/plugins/otopi/network/iptables.py", line 36, in __init__
    self._distribution = platform.linux_distribution(
otopi.main.PluginLoadException: module 'platform' has no attribute 'linux_distribution'



Steps to Reproduce:
1. Install CentOS Stream 9
2. run check-patch from https://gerrit.ovirt.org/c/otopi/+/115919
3.

Actual results: looks like platform module in Python 3.9 on CentOS Stream 9 is not providing anymore linux_distribution. We'll need to check if it's intended or file a bug on CentOS Stream for it.

Comment 1 RHEL Program Management 2021-07-27 16:41:12 UTC
This bug report has Keywords: Regression or TestBlocker.
Since no regressions or test blockers are allowed between releases, it is also being identified as a blocker for this release. Please resolve ASAP.

Comment 2 Sandro Bonazzola 2021-07-28 08:09:43 UTC
Confirmed being an intended change: https://docs.python.org/3.5/library/platform.html#platform.linux_distribution
was deprecated in Python 3.5 and removed in 3.7.

Comment 3 Sandro Bonazzola 2021-07-28 08:15:18 UTC
python3-distro is included in CentOS Stream 8 and derivatives and should be used instead of platform. More details: https://github.com/python-distro/distro

Comment 4 Pavol Brilla 2022-05-03 06:39:06 UTC
# yum deplist python3-otopi.noarch | grep distro
  dependency: python3-distro
   provider: python3-distro-1.4.0-2.module+el8.1.0+3334+5cb623d7.noarch
   provider: python3-distro-1.4.0-2.module+el8.1.0+3334+5cb623d7.noarch


Installed Packages
python3-otopi.noarch     1.10.0-1.el8ev

Comment 5 Sandro Bonazzola 2022-05-03 06:46:19 UTC
This bugzilla is included in oVirt 4.5.0 release, published on April 20th 2022.

Since the problem described in this bug report should be resolved in oVirt 4.5.0 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.


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