Fix OSA_VERSION during upgrades

Installing OSA in editable mode no longer produce egg-info and wheels,
which results in existance of stale egg-info which returns an old
version for openstack-ansible package.

As we do `cd ${OSA_CLONE_DIR}` this is appended to PATH, making
`importlib` to respect stale egg-info rather then actually installed
version from venv.

On top of that we add a simple pyproject.toml to define the build
backend of pbr to detect package versioning correctly during
installation, as otherwise behavior may be unexpected [1] due to
deprecation.

[1] https://github.com/pypa/pip/issues/11457

Closes-Bug: #2137630
Change-Id: I33c4cd030985a360570202b78e9d6f23f72edbb0
Signed-off-by: Dmitriy Rabotyagov <dmitriy.rabotyagov@cleura.com>
This commit is contained in:
Dmitriy Rabotyagov
2026-01-07 13:32:02 +01:00
committed by Dmitriy Chubinidze
parent 62cc0fc484
commit 17b31bf510
4 changed files with 10 additions and 2 deletions

3
pyproject.toml Normal file
View File

@@ -0,0 +1,3 @@
[build-system]
requires = ["pbr>=6.1.1"]
build-backend = "pbr.build"

View File

@@ -0,0 +1,5 @@
---
fixes:
- |
OpenStack-Ansible and venv version detection is fixed for environments
which were upgraded from pre-Flamingo releases.

View File

@@ -135,7 +135,7 @@ if [ "${SETUP_ARA}" == "true" ]; then
fi
# Get current code version (this runs at the root of OSA clone)
export CURRENT_OSA_VERSION=$(cd ${OSA_CLONE_DIR}; /opt/ansible-runtime/bin/python -c "from importlib.metadata import version; print(version('openstack-ansible'))")
export CURRENT_OSA_VERSION=$(cd /tmp; /opt/ansible-runtime/bin/python -c "from importlib.metadata import version; print(version('openstack-ansible'))")
# Ensure that Ansible binaries run from the venv
pushd /opt/ansible-runtime/bin

View File

@@ -16,5 +16,5 @@
import setuptools
setuptools.setup(
setup_requires=['pbr>=2.0.0'],
setup_requires=['pbr>=6.1.1'],
pbr=True)