diff --git a/.zuul.yaml b/.zuul.yaml index 22ecb79..5bf1f9e 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -79,6 +79,15 @@ image_type: 'dib' image_distro: 'centos7' +- job: + name: ironic-python-agent-check-image-dib-centos7-python3 + parent: ironic-python-agent-check-image-base + required-projects: + - openstack/diskimage-builder + vars: + image_type: 'dib' + image_distro: 'centos7' + - job: name: ironic-python-agent-check-image-dib-centos8 parent: ironic-python-agent-check-image-base @@ -133,6 +142,8 @@ - ironic-python-agent-check-image-dib-centos8 - ironic-python-agent-check-image-dib-centos7 # Non-voting jobs + - ironic-python-agent-check-image-dib-centos7-python3: + voting: false - ironic-python-agent-check-image-dib-fedora: voting: false - ironic-python-agent-check-image-dib-debian: diff --git a/dib/ironic-python-agent-ramdisk/install.d/ironic-python-agent-ramdisk-source-install/60-ironic-python-agent-ramdisk-install b/dib/ironic-python-agent-ramdisk/install.d/ironic-python-agent-ramdisk-source-install/60-ironic-python-agent-ramdisk-install index 1b5cddb..a01c50f 100755 --- a/dib/ironic-python-agent-ramdisk/install.d/ironic-python-agent-ramdisk-source-install/60-ironic-python-agent-ramdisk-install +++ b/dib/ironic-python-agent-ramdisk/install.d/ironic-python-agent-ramdisk-source-install/60-ironic-python-agent-ramdisk-install @@ -13,11 +13,28 @@ IPADIR=/tmp/ironic-python-agent UPPER_CONSTRAINTS=/tmp/requirements/upper-constraints.txt VENVDIR=/opt/ironic-python-agent +IPA_PYTHON_VERSION=$DIB_PYTHON_VERSION +IPA_PYTHON="$DIB_PYTHON" + +case "$DISTRO_NAME" in + centos7|rhel7) + # NOTE(dtantsur): C.UTF-8 doesn't seem to exist in CentOS 7 + export LC_ALL=en_US.UTF-8 + + if grep -q 'Python :: 3 :: Only' $IPADIR/setup.cfg; then + echo "WARNING: using Python 3 on CentOS 7, this is not recommended" + ${YUM:-yum} install -y python3 python3-devel + IPA_PYTHON=python3 + IPA_PYTHON_VERSION=3 + fi + ;; +esac + # create the virtual environment using the default python -if [ $DIB_PYTHON_VERSION == 3 ]; then - $DIB_PYTHON -m venv $VENVDIR +if [ $IPA_PYTHON_VERSION == 3 ]; then + $IPA_PYTHON -m venv $VENVDIR else - $DIB_PYTHON -m virtualenv $VENVDIR + $IPA_PYTHON -m virtualenv $VENVDIR fi # pip might be an older version which does not support the -c option, therefore diff --git a/releasenotes/notes/centos7-python3-185f1d35c37096c7.yaml b/releasenotes/notes/centos7-python3-185f1d35c37096c7.yaml new file mode 100644 index 0000000..7528ce5 --- /dev/null +++ b/releasenotes/notes/centos7-python3-185f1d35c37096c7.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Supports building images for Ussuri+ on CentOS 7 using Python 3. This is + not recommended but is necessary for some older hardware.