Stop "dnf makecache" in the amphora images

On base operating systems that use DNF there can be a systemd timer
that attempts to call out and update the dnf cache every hour.
This patch adds an diskimage-builder element that disables this
timer as most amphora will not be successful in updating this cache
because they do not have network access or DNS services avaialable.

Change-Id: I5dec631d3e66e1dfb6b8741caea89938ee18a7d8
Story: 2007408
Task: 39019
This commit is contained in:
Michael Johnson 2020-03-10 16:40:19 -07:00
parent 801b99ed00
commit c8b044af4a
4 changed files with 31 additions and 0 deletions

View File

@ -444,6 +444,11 @@ if [ "$AMP_ENABLE_FULL_MAC_SECURITY" -ne 1 ]; then
fi fi
fi fi
# Disable the dnf makecache timer
if [ "${AMP_BASEOS}" = "centos-minimal" ] || [ "${AMP_BASEOS}" = "fedora" ] || [ "${AMP_BASEOS}" = "rhel" ]; then
AMP_element_sequence="$AMP_element_sequence disable-makecache"
fi
if [ "${AMP_BASEOS}" = "centos-minimal" ]; then if [ "${AMP_BASEOS}" = "centos-minimal" ]; then
export DIB_YUM_MINIMAL_CREATE_INTERFACES=0 export DIB_YUM_MINIMAL_CREATE_INTERFACES=0
fi fi

View File

@ -0,0 +1,6 @@
This element disables the dnf makecache hourly timer.
The amphora typically do not have internet access nor access to DNS servers.
We want to disable this makecache timer to stop the amphora from attempting
to update/download the dnf cache every hour. Without this element it will
run and log a failure every hour.

View File

@ -0,0 +1,18 @@
#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
case $DISTRO_NAME in
fedora | centos* | rhel* )
systemctl disable dnf-makecache.timer || true
;;
*)
echo "ERROR: Unsupported distribution $DISTRO_NAME"
exit 1
;;
esac

View File

@ -0,0 +1,2 @@
disable-makecache:
default: disable-makecache