Browse Source

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
changes/07/712207/2
Michael Johnson 2 years ago
parent
commit
c8b044af4a
  1. 5
      diskimage-create/diskimage-create.sh
  2. 6
      elements/disable-makecache/README.rst
  3. 18
      elements/disable-makecache/post-install.d/80-disable-makecache
  4. 2
      elements/disable-makecache/svc-map

5
diskimage-create/diskimage-create.sh

@ -444,6 +444,11 @@ if [ "$AMP_ENABLE_FULL_MAC_SECURITY" -ne 1 ]; then
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
export DIB_YUM_MINIMAL_CREATE_INTERFACES=0
fi

6
elements/disable-makecache/README.rst vendored

@ -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.

18
elements/disable-makecache/post-install.d/80-disable-makecache vendored

@ -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

2
elements/disable-makecache/svc-map vendored

@ -0,0 +1,2 @@
disable-makecache:
default: disable-makecache
Loading…
Cancel
Save