← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 2069333] [NEW] Caracal magnum __init__ returns None as the version (EL9)

 

Public bug reported:

Hi,

Hi recently upgraded an Antelope Magnum server to Caracal. After the
upgrade, I have not been able to run `magnum-db-manage` because of an
exception in magnum/__init__ when retrieving the Magnum version, the
value returned being None. This happens on an EL9.4 machine using
Caracal RPMs from RDO repository (repository from one week ago, June 7).


Steps to reproduce
==================

- Run `nova-db-manage version` (or magnum-api) on an EL9.4 machine


Expected result
===============

The DB version number, something like `Current DB revision is
c0f832afc4fd`


Actual result
=============

I get the following exception:

```
  File "/usr/bin/magnum-db-manage", line 5, in <module>
    from magnum.cmd.db_manage import main
  File "/usr/lib/python3.9/site-packages/magnum/__init__.py", line 18, in <module>
    __version__ = pbr.version.VersionInfo(
  File "/usr/lib/python3.9/site-packages/pbr/version.py", line 505, in version_string
    return self.semantic_version().brief_string()
  File "/usr/lib/python3.9/site-packages/pbr/version.py", line 498, in semantic_version
    self._semantic = self._get_version_from_importlib_metadata()
  File "/usr/lib/python3.9/site-packages/pbr/version.py", line 483, in _get_version_from_importlib_metadata
    return SemanticVersion.from_pip_string(result_string)
  File "/usr/lib/python3.9/site-packages/pbr/version.py", line 156, in from_pip_string
    return klass._from_pip_string_unsafe(version_string)
  File "/usr/lib/python3.9/site-packages/pbr/version.py", line 163, in _from_pip_string_unsafe
    version_string = version_string.lstrip('vV')
AttributeError: 'NoneType' object has no attribute 'lstrip' 
```

After looking a little bit at the problem, I found that the culprit is
probably module importlib.metadata provided by python3-importlib-
metadata-6.8.0-1.el9s.noarch (that has been installed from RDO
repository mirror, the last version today). Because of a problem in this
module, the returned value for magnum from
importlib.metadata.distribution() called by pbr.version.VersionInfo()
(itself called by magnum/__init__ as shown by the traceback given in my
first message) is None instead of a string.

The following code (copied from pbr.version) allows to demonstrate the
problem:

```
#!/usr/bin/python

from importlib import metadata as importlib_metadata

for package in ['magnum']:
    distribution = importlib_metadata.distribution(package)
    result_string = distribution.version
    print("package", package, "result_string=", result_string)
```

If run on an Antelope machine it works fine. If run on a Caracal machine
it returns None.


Environment
===========

```
python3-pbr-5.11.1-1.el9s.noarch
python3-importlib-metadata-6.8.0-1.el9s.noarch
python3-magnumclient-4.4.0-1.el9s.noarch
python3-magnum-18.0.0-1.el9s.noarch
openstack-magnum-common-18.0.0-1.el9s.noarch
openstack-magnum-api-18.0.0-1.el9s.noarch
openstack-magnum-conductor-18.0.0-1.el9s.noarch
```

** Affects: nova
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/2069333

Title:
  Caracal magnum __init__ returns  None as the version (EL9)

Status in OpenStack Compute (nova):
  New

Bug description:
  Hi,

  Hi recently upgraded an Antelope Magnum server to Caracal. After the
  upgrade, I have not been able to run `magnum-db-manage` because of an
  exception in magnum/__init__ when retrieving the Magnum version, the
  value returned being None. This happens on an EL9.4 machine using
  Caracal RPMs from RDO repository (repository from one week ago, June
  7).

  
  Steps to reproduce
  ==================

  - Run `nova-db-manage version` (or magnum-api) on an EL9.4 machine

  
  Expected result
  ===============

  The DB version number, something like `Current DB revision is
  c0f832afc4fd`

  
  Actual result
  =============

  I get the following exception:

  ```
    File "/usr/bin/magnum-db-manage", line 5, in <module>
      from magnum.cmd.db_manage import main
    File "/usr/lib/python3.9/site-packages/magnum/__init__.py", line 18, in <module>
      __version__ = pbr.version.VersionInfo(
    File "/usr/lib/python3.9/site-packages/pbr/version.py", line 505, in version_string
      return self.semantic_version().brief_string()
    File "/usr/lib/python3.9/site-packages/pbr/version.py", line 498, in semantic_version
      self._semantic = self._get_version_from_importlib_metadata()
    File "/usr/lib/python3.9/site-packages/pbr/version.py", line 483, in _get_version_from_importlib_metadata
      return SemanticVersion.from_pip_string(result_string)
    File "/usr/lib/python3.9/site-packages/pbr/version.py", line 156, in from_pip_string
      return klass._from_pip_string_unsafe(version_string)
    File "/usr/lib/python3.9/site-packages/pbr/version.py", line 163, in _from_pip_string_unsafe
      version_string = version_string.lstrip('vV')
  AttributeError: 'NoneType' object has no attribute 'lstrip' 
  ```

  After looking a little bit at the problem, I found that the culprit is
  probably module importlib.metadata provided by python3-importlib-
  metadata-6.8.0-1.el9s.noarch (that has been installed from RDO
  repository mirror, the last version today). Because of a problem in
  this module, the returned value for magnum from
  importlib.metadata.distribution() called by pbr.version.VersionInfo()
  (itself called by magnum/__init__ as shown by the traceback given in
  my first message) is None instead of a string.

  The following code (copied from pbr.version) allows to demonstrate the
  problem:

  ```
  #!/usr/bin/python

  from importlib import metadata as importlib_metadata

  for package in ['magnum']:
      distribution = importlib_metadata.distribution(package)
      result_string = distribution.version
      print("package", package, "result_string=", result_string)
  ```

  If run on an Antelope machine it works fine. If run on a Caracal
  machine it returns None.

  
  Environment
  ===========

  ```
  python3-pbr-5.11.1-1.el9s.noarch
  python3-importlib-metadata-6.8.0-1.el9s.noarch
  python3-magnumclient-4.4.0-1.el9s.noarch
  python3-magnum-18.0.0-1.el9s.noarch
  openstack-magnum-common-18.0.0-1.el9s.noarch
  openstack-magnum-api-18.0.0-1.el9s.noarch
  openstack-magnum-conductor-18.0.0-1.el9s.noarch
  ```

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/2069333/+subscriptions



Follow ups