versionutils convert_version_to_tuple fails with beta versions

Bug #2042886 reported by Michael Johnson
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
oslo.utils
Fix Released
Critical
Takashi Kajinami

Bug Description

We have a job "designate-tox-py310-with-sqlalchemy-2x" that tests using the master branch of sqlalchemy.

This job started failing today because sqlalchemy 2.1.0b1 [1] was committed to the master branch.

oslo.db calls versionutils [2] convert_version_to_tuple() to check the version for compatibility, but fails due to the "0b1" patch version.

Versionutils should be able to handle beta and rc patch version strings.

Here is the Traceback:

2023-11-06 23:20:24.748531 | ubuntu-jammy | =========================
2023-11-06 23:20:24.748549 | ubuntu-jammy | Failures during discovery
2023-11-06 23:20:24.748558 | ubuntu-jammy | =========================
2023-11-06 23:20:24.748567 | ubuntu-jammy | --- import errors ---
2023-11-06 23:20:24.748576 | ubuntu-jammy | Failed to import test module: designate.tests
2023-11-06 23:20:24.748585 | ubuntu-jammy | Traceback (most recent call last):
2023-11-06 23:20:24.748593 | ubuntu-jammy | File "/usr/lib/python3.10/unittest/loader.py", line 470, in _find_test_path
2023-11-06 23:20:24.748602 | ubuntu-jammy | package = self._get_module_from_name(name)
2023-11-06 23:20:24.748611 | ubuntu-jammy | File "/usr/lib/python3.10/unittest/loader.py", line 377, in _get_module_from_name
2023-11-06 23:20:24.748621 | ubuntu-jammy | __import__(name)
2023-11-06 23:20:24.748629 | ubuntu-jammy | File "/home/zuul/src/opendev.org/openstack/designate/designate/tests/__init__.py", line 37, in <module>
2023-11-06 23:20:24.748638 | ubuntu-jammy | from designate import storage
2023-11-06 23:20:24.748647 | ubuntu-jammy | File "/home/zuul/src/opendev.org/openstack/designate/designate/storage/__init__.py", line 26, in <module>
2023-11-06 23:20:24.748655 | ubuntu-jammy | from designate.storage import sql
2023-11-06 23:20:24.748663 | ubuntu-jammy | File "/home/zuul/src/opendev.org/openstack/designate/designate/storage/sql.py", line 24, in <module>
2023-11-06 23:20:24.748671 | ubuntu-jammy | from oslo_db.sqlalchemy import enginefacade
2023-11-06 23:20:24.748680 | ubuntu-jammy | File "/home/zuul/src/opendev.org/openstack/designate/.tox/py310/lib/python3.10/site-packages/oslo_db/sqlalchemy/enginefacade.py", line 28, in <module>
2023-11-06 23:20:24.748693 | ubuntu-jammy | from oslo_db.sqlalchemy import engines
2023-11-06 23:20:24.748760 | ubuntu-jammy | File "/home/zuul/src/opendev.org/openstack/designate/.tox/py310/lib/python3.10/site-packages/oslo_db/sqlalchemy/engines.py", line 36, in <module>
2023-11-06 23:20:24.748775 | ubuntu-jammy | from oslo_db.sqlalchemy import compat
2023-11-06 23:20:24.748784 | ubuntu-jammy | File "/home/zuul/src/opendev.org/openstack/designate/.tox/py310/lib/python3.10/site-packages/oslo_db/sqlalchemy/compat/__init__.py", line 18, in <module>
2023-11-06 23:20:24.748793 | ubuntu-jammy | _vers = versionutils.convert_version_to_tuple(__version__)
2023-11-06 23:20:24.748801 | ubuntu-jammy | File "/home/zuul/src/opendev.org/openstack/designate/.tox/py310/lib/python3.10/site-packages/oslo_utils/versionutils.py", line 90, in convert_version_to_tuple
2023-11-06 23:20:24.748810 | ubuntu-jammy | return tuple(int(part) for part in version_str.split('.'))
2023-11-06 23:20:24.748818 | ubuntu-jammy | File "/home/zuul/src/opendev.org/openstack/designate/.tox/py310/lib/python3.10/site-packages/oslo_utils/versionutils.py", line 90, in <genexpr>
2023-11-06 23:20:24.748827 | ubuntu-jammy | return tuple(int(part) for part in version_str.split('.'))
2023-11-06 23:20:24.748835 | ubuntu-jammy | ValueError: invalid literal for int() with base 10: '0b1'
2023-11-06 23:20:24.748843 | ubuntu-jammy |
2023-11-06 23:20:24.748852 | ubuntu-jammy | ================================================================================
2023-11-06 23:20:24.748875 | ubuntu-jammy | The above traceback was encountered during test discovery which imports all the found test modules in the specified test_path.

[1] https://github.com/sqlalchemy/sqlalchemy/commit/34802a204fd3e4a181029575d424d132baee2d91#diff-7fce8d70400125ce4c13b97597ab04135c7311094a9f31337d7eedcfd8ed91a7R245
[2] https://github.com/openstack/oslo.db/blob/master/oslo_db/sqlalchemy/compat/__init__.py#L18

Revision history for this message
Brian Haley (brian-haley) wrote :

This has broken the neutron gate as well.

Changed in oslo.utils:
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.utils (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/oslo.utils/+/900343

Changed in oslo.utils:
status: Confirmed → In Progress
Changed in oslo.utils:
importance: Undecided → Critical
importance: Critical → High
assignee: nobody → Takashi Kajinami (kajinamit)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.utils (master)

Reviewed: https://review.opendev.org/c/openstack/oslo.utils/+/900343
Committed: https://opendev.org/openstack/oslo.utils/commit/0588ba20d91b45f5a1383af35effdd2d536b7ea5
Submitter: "Zuul (22348)"
Branch: master

commit 0588ba20d91b45f5a1383af35effdd2d536b7ea5
Author: Takashi Kajinami <email address hidden>
Date: Wed Nov 8 02:01:55 2023 +0900

    versionutil: Remove trailing alpha/beta/rc suffix

    Sometimes we have to use the latest code instead of the latest release
    to test upcoming changes (eg. sqlalchemy). In such case the version
    string might contain its development status such as beta, and causes
    failure while parsing the version string.

    This makes the parse logic ignore the development status suffix to
    avoid the failure.

    Closes-Bug: #2042886
    Change-Id: I27c14ede026c5600173047b1a0892a02a54dbb06

Changed in oslo.utils:
status: In Progress → Fix Released
Revision history for this message
Takashi Kajinami (kajinamit) wrote :

New release of oslo.utils has been proposed. https://review.opendev.org/c/openstack/releases/+/900382

Changed in oslo.utils:
importance: High → Critical
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/oslo.utils 6.3.0

This issue was fixed in the openstack/oslo.utils 6.3.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.