ironic-python-agent-builder/dib/ironic-python-agent-ramdisk/post-install.d/99-remove-extra-packages
Steve Baker e51c210861 Remove centos7 job, python2 support
This change does the following:
- Removes the centos7 job, it uses python2 even though python2 was
  dropped from IPA in 2019.
  (see Ifd0e0b99bb82a7d7e82d6c14309468196f5734fc)
- Allow 60-ironic-python-agent-ramdisk-install to assume python3 and
  the venv module, the remaining centos7-python3 job will also test this
- Replaces the pip-and-virtualenv element with ensure-venv.
  pip-and-virtualenv exists to install virtualenv for python2
  environments, and it is unmaintained and mostly technical debt.

Change-Id: I9b6e03f50a4eb2484a04748e51d7348401b6ca04
(cherry picked from commit 66206d0b27)
2022-01-25 12:31:39 +13:00

32 lines
900 B
Bash
Executable File

#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
rm -rf /tmp/ironic-python-agent
# In Centos Stream, /lib is linked to /lib/firmware, so the first
# loop will likely go ahead and remove everything, but the || true
# below will keep it from erroring.
KNOWN_FIRMWARE_PATH="/lib/firmware/ /usr/lib/firmware/"
for folder in $KNOWN_FIRMWARE_PATH; do
for item in ${IPA_REMOVE_FIRMWARE//,/ }; do
# Attempt removal of item, but don't error
# if it is not present already.
rm -rf $folder$item || true
done
done
# TODO(dtantsur): implement the same for debian-based systems
case "$DISTRO_NAME" in
fedora|centos|rhel)
${YUM:-yum} remove -y postfix gcc make
${YUM:-yum} clean all
# Rebuilding the rpm database after removing packages will reduce
# its size
rpm --rebuilddb
;;
esac