Create element to purge resolv.conf

We should be managing the network configuration with os-net-config or
elsewhere so we should not be providing a nameserver in resolv.conf
in overcloud images. This element will be used to ensure that the
resolv.conf of the overcloud-full image should not contain any
nameservers.

Change-Id: If8c44137d120059b356675a074e3af23ea63a6f8
Partial-Bug: #1749756
(cherry picked from commit c38d7ff551)
This commit is contained in:
Alex Schultz 2018-02-15 10:47:20 -07:00
parent 246581fb40
commit 1ab281355b
2 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,7 @@
==================
remove-resolveconf
==================
Clears an existing ``/etc/resolv.conf`` from the resulting image, so that it
it will be managed via the network configuration.

View File

@ -0,0 +1,14 @@
#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
# Clear the resolv.conf so that the nameserver configuration does not inherit
# any incorrect nameservers from the image. LP#1749756
# NOTE: This relies on the fact the DIB copies the original resolv.conf and
# during the finalise_base function in img-functions (in DIB) copies the old
# one back in place after the build process completes.
sudo sed -i '/nameserver/d' $TARGET_ROOT/etc/resolv.conf.ORIG