From 8154680e6af78825ab946c98022ca69afb4ac46d Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Thu, 9 Jun 2016 10:17:53 +1000 Subject: [PATCH] Don't clear-out all repos in puppet cleanup dib 1.17.0 includes fixes for debian-minimal to work with the apt-sources element in I69dbaa34be3db3d667e6bd8450ef4ce04a751c70 This moved to having the base repos split out from the usual /etc/apt/sources.list into separate files in /etc/apt/sources.list.d Unfortunately, this puppet module does the cleanup by glob removal of everything in that directory, which is a bit unsafe. I've refactored this slightly so that, like the RedHat path, we only remove the puppetlabs repos files. Change-Id: I5bcd8880a90d238b77aaacfd1eaf0a720552c7ee --- .../elements/puppet/install.d/95-clean-repos | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/nodepool/elements/puppet/install.d/95-clean-repos b/nodepool/elements/puppet/install.d/95-clean-repos index 15a1390b49..dbbce2926c 100755 --- a/nodepool/elements/puppet/install.d/95-clean-repos +++ b/nodepool/elements/puppet/install.d/95-clean-repos @@ -27,15 +27,24 @@ fi set -e OS_FAMILY=$(facter osfamily) -if [ "$OS_FAMILY" == "Debian" ] ; then - rm -f /etc/apt/sources.list.d/* - apt-get update -elif [ "$OS_FAMILY" == "RedHat" ] ; then - # Can't delete * in yum.repos.d since all of the repos are listed there. - # Be specific instead. - if [ -f /etc/yum.repos.d/puppetlabs.repo ] ; then - sudo rm -f /etc/yum.repos.d/puppetlabs.repo - fi -fi + +case $OS_FAMILY in + "Debian") + repo=/etc/apt/sources.list.d/puppetlabs.list + update="apt-get update" + ;; + "RedHat") + repo=/etc/yum.repos.d/puppetlabs.repo + # yum/dnf will notice this is gone, so don't need to spend + # time updating. + update="" + ;; + *) + die "Don't know how to cleanup!" + ;; +esac + +rm -f $repo +$update rm /usr/local/bin/prepare-node