Skip to content

Commit 246785e

Browse files
committed
ci: Pin to the yoga version of openstackclient
Work round issues running openstackclient on python 3.7
1 parent acab3dc commit 246785e

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

hack/ci/create_devstack.sh

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,32 @@ function retry {
7676
function ensure_openstack_client {
7777
if ! command -v openstack;
7878
then
79-
apt-get install -y python3-dev
80-
# install PyYAML first because otherwise we get an error because pip3 doesn't upgrade PyYAML to the correct version
81-
# ERROR: Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which
82-
# files belong to it which would lead to only a partial uninstall.
83-
pip3 install --ignore-installed PyYAML
84-
pip3 install python-cinderclient python-glanceclient python-keystoneclient python-neutronclient python-novaclient python-openstackclient python-octaviaclient
79+
# We are running in a Debian Buster image with python 3.7. Python 3.7
80+
# is starting to show its age in upstream support. Ideally we would
81+
# move to a newer image with a newer python version.
82+
#
83+
# Until then, this script tries to carefully navigate around current
84+
# issues running openstack client on python 3.7.
85+
#
86+
# We explicitly pin the yoga version of openstackclient. This is the
87+
# last version of openstackclient which will support python 3.7.
88+
89+
# Install virtualenv to install the openstack client and curl to fetch
90+
# the build constraints.
91+
apt-get install -y python3-virtualenv curl
92+
python3 -m virtualenv -p $(which python3) /tmp/openstack-venv
93+
VIRTUAL_ENV_DISABLE_PROMPT=1 source /tmp/openstack-venv/bin/activate
94+
95+
# openstackclient has never actually supported python 3.7, only 3.6 and
96+
# 3.8. Here we download the yoga constraints file and modify all the
97+
# 3.8 constraints to be 3.7 constraints.
98+
curl -L https://releases.openstack.org/constraints/upper/yoga -o /tmp/yoga-constraints
99+
sed -i "s/python_version=='3.8'/python_version=='3.7'/" /tmp/yoga-constraints
100+
101+
pip install -c /tmp/yoga-constraints \
102+
python-openstackclient python-cinderclient \
103+
python-glanceclient python-keystoneclient \
104+
python-neutronclient python-novaclient python-octaviaclient
85105
fi
86106
}
87107

0 commit comments

Comments
 (0)