From f576658a4f405328295e99a9a9a8a8632147aa61 Mon Sep 17 00:00:00 2001 From: Riccardo Pittau Date: Mon, 20 Dec 2021 15:16:01 +0100 Subject: [PATCH] Avoid unbound variable error when installing pip The pip_args variable is not initialized when installing pip for bullseye resulting in an unbound variable error when running install_python3_pip on that debian version. This patch fixes the issue moving pip_args inizialization to a common place. Change-Id: I1603c97871449b4f73e3062a705d655e9454bf33 --- .../pip-and-virtualenv-source-install/04-install-pip | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip b/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip index 229ec6219..8f2fdad33 100755 --- a/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip +++ b/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip @@ -24,6 +24,9 @@ function install_python2_pip { pip install $pip_args virtualenv } +# force things to happen so our assumptions hold +pip_args="-U --force-reinstall" + if [[ $DISTRO_NAME =~ (opensuse|fedora|centos|centos7|rhel|rhel7) ]]; then # Default packages @@ -98,9 +101,6 @@ if [[ $DISTRO_NAME =~ (opensuse|fedora|centos|centos7|rhel|rhel7) ]]; then ;; esac - # force things to happen so our assumptions hold - pip_args="-U --force-reinstall" - # GENERAL WARNING : mixing packaged python libraries with # pip-installed versions always creates issues. Upstream # openstack-infra uses this a lot (especially devstack) but be @@ -270,9 +270,6 @@ else apt-get -y install $packages - # force things to happen so our assumptions hold - pip_args="-U --force-reinstall" - install_python2_pip if [[ ${DIB_PYTHON_VERSION} == 3 ]]; then install_python3_pip