From 2043788473a8cd6707bfc9aaedbc2065688f0db0 Mon Sep 17 00:00:00 2001 From: Gregory Thiemonge Date: Fri, 8 Oct 2021 08:27:08 +0200 Subject: [PATCH] Workaround to fix amphora-agent on centos dnspython now requires to have at least one nameserver in /etc/resolv.conf. The amphora image doesn't need and doesn't use any dns servers, add a dummy dns server as a workaround on centos (on ubuntu, resolv.conf contains the systemd resolver). We will revert this patch when we find a more convenient fix for this issue Story: 2009281 Task: 43552 Change-Id: I81af508e7df5ffef343f1614335ffe1a98540912 --- .../static/etc/NetworkManager/conf.d/dns-none.conf | 4 ++++ elements/no-resolvconf/finalise.d/99-disable-resolv-conf | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 elements/amphora-agent/static/etc/NetworkManager/conf.d/dns-none.conf diff --git a/elements/amphora-agent/static/etc/NetworkManager/conf.d/dns-none.conf b/elements/amphora-agent/static/etc/NetworkManager/conf.d/dns-none.conf new file mode 100644 index 0000000000..9032e19419 --- /dev/null +++ b/elements/amphora-agent/static/etc/NetworkManager/conf.d/dns-none.conf @@ -0,0 +1,4 @@ +[main] +# Set dns to none, it prevents NetworkManager to update the /etc/resolv.conf +# file. +dns=none diff --git a/elements/no-resolvconf/finalise.d/99-disable-resolv-conf b/elements/no-resolvconf/finalise.d/99-disable-resolv-conf index d7d6c7f7d2..1bdddad379 100755 --- a/elements/no-resolvconf/finalise.d/99-disable-resolv-conf +++ b/elements/no-resolvconf/finalise.d/99-disable-resolv-conf @@ -1,6 +1,9 @@ #!/bin/bash -echo "" > /etc/resolv.conf -echo "" > /etc/resolv.conf.ORIG + +# Override resolv.conf file from DIB with a custom one. +# Having at least one nameserver is now required by dnfpython (>=) +echo "nameserver 127.0.0.1" > /etc/resolv.conf +echo "nameserver 127.0.0.1" > /etc/resolv.conf.ORIG if [ -d /etc/dhcp/dhclient-enter-hooks.d ] then # Debian/Ubuntu