From c2266350c890a5db0969f5d99c7b4641b459402e Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Thu, 26 May 2016 16:23:28 +0100 Subject: [PATCH] Ensure that modified files are kept when installing/upgrading In a situation where the LXC cache and the apt mirror used do not have matching package versions, or where the host and the LXC cache have mismatches, the 'apt-get upgrade' and/or 'apt-get install' actions can fail due to dpkg asking what to do about the config file mismatches. This patch ensures that dpkg knows what to do, which is to keep the existing in-place file (the file copied from the host). This ensures that whatever apt configuration was implemented on the host is definitely used in the containers. Change-Id: I1f8bc785a8acdac71f46eff0e0d9573ba5c62ab3 --- vars/ubuntu-14.04.yml | 8 ++++++-- vars/ubuntu-16.04.yml | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/vars/ubuntu-14.04.yml b/vars/ubuntu-14.04.yml index 79e84c7d..7206117e 100644 --- a/vars/ubuntu-14.04.yml +++ b/vars/ubuntu-14.04.yml @@ -58,7 +58,7 @@ lxc_cache_map: apt-key add /root/repo.keys rm /root/repo.keys {{ lxc_cache_install_command }} {{ lxc_cache_packages | join(' ') }} - apt-get -y upgrade + apt-get upgrade -y {{ lxc_cache_install_debconf }} rm -f /usr/bin/python ln -s /usr/bin/python2.7 /usr/bin/python mkdir -p /root/.ssh @@ -66,7 +66,11 @@ lxc_cache_map: userdel --force --remove ubuntu || true apt-get clean -lxc_cache_install_command: "export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y" +lxc_cache_install_command: "export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y {{ lxc_cache_install_debconf }}" + +# This forces any modified configurations to remain, and any unmodified configs to be replaced +# ref: http://serverfault.com/questions/259226/automatically-keep-current-version-of-config-files-when-apt-get-install +lxc_cache_install_debconf: '-o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes' lxc_cache_packages: - apt-transport-https diff --git a/vars/ubuntu-16.04.yml b/vars/ubuntu-16.04.yml index 1699b75d..2a3b8709 100644 --- a/vars/ubuntu-16.04.yml +++ b/vars/ubuntu-16.04.yml @@ -61,7 +61,7 @@ lxc_cache_map: apt-key add /root/repo.keys rm /root/repo.keys {{ lxc_cache_install_command }} {{ lxc_cache_packages | join(' ') }} - apt-get -y upgrade + apt-get upgrade -y {{ lxc_cache_install_debconf }} rm -f /usr/bin/python ln -s /usr/bin/python2.7 /usr/bin/python mkdir -p /root/.ssh @@ -69,7 +69,11 @@ lxc_cache_map: userdel --force --remove ubuntu || true apt-get clean -lxc_cache_install_command: "export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y" +lxc_cache_install_command: "export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y {{ lxc_cache_install_debconf }}" + +# This forces any modified configurations to remain, and any unmodified configs to be replaced +# ref: http://serverfault.com/questions/259226/automatically-keep-current-version-of-config-files-when-apt-get-install +lxc_cache_install_debconf: '-o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes' lxc_cache_packages: - apt-transport-https