From 17b31bf5109bfa70988807d025ec718ac8588ced Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Wed, 7 Jan 2026 13:32:02 +0100 Subject: [PATCH] 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 --- pyproject.toml | 3 +++ .../notes/fixed-osa-version-detection-59ea42b9f2f55914.yaml | 5 +++++ scripts/bootstrap-ansible.sh | 2 +- setup.py | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 pyproject.toml create mode 100644 releasenotes/notes/fixed-osa-version-detection-59ea42b9f2f55914.yaml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000..2a38d6bc75 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["pbr>=6.1.1"] +build-backend = "pbr.build" diff --git a/releasenotes/notes/fixed-osa-version-detection-59ea42b9f2f55914.yaml b/releasenotes/notes/fixed-osa-version-detection-59ea42b9f2f55914.yaml new file mode 100644 index 0000000000..d15523fb9d --- /dev/null +++ b/releasenotes/notes/fixed-osa-version-detection-59ea42b9f2f55914.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + OpenStack-Ansible and venv version detection is fixed for environments + which were upgraded from pre-Flamingo releases. diff --git a/scripts/bootstrap-ansible.sh b/scripts/bootstrap-ansible.sh index f5d8f8d249..3b04d388c7 100755 --- a/scripts/bootstrap-ansible.sh +++ b/scripts/bootstrap-ansible.sh @@ -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 diff --git a/setup.py b/setup.py index cd35c3c35b..db1ad0c61b 100644 --- a/setup.py +++ b/setup.py @@ -16,5 +16,5 @@ import setuptools setuptools.setup( - setup_requires=['pbr>=2.0.0'], + setup_requires=['pbr>=6.1.1'], pbr=True)