From 7eebc69e8a5a2a6346f68b11bd9f6b6109e10fd9 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Tue, 22 Nov 2022 18:10:01 +0100 Subject: [PATCH] Update self version fetching mechanism With release of new setuptools running setup.py --version started returining extra line. Eventually, running setup.py as a script is not considered as good practice and we should not rely on it's output much. Instead, we can leverage importlib.metadata as it should be more reliable in long run. Closes-Bug: #1997365 Change-Id: Ife227db4ad25851456e1acc6b4daf198f39d989a --- scripts/bootstrap-ansible.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/bootstrap-ansible.sh b/scripts/bootstrap-ansible.sh index 6e7d06ce44..41b1d5a52a 100755 --- a/scripts/bootstrap-ansible.sh +++ b/scripts/bootstrap-ansible.sh @@ -156,7 +156,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 setup.py --version) +export CURRENT_OSA_VERSION=$(cd ${OSA_CLONE_DIR}; /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