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
This commit is contained in:
Ian Wienand 2016-06-09 10:17:53 +10:00
parent 8365913c73
commit 8154680e6a

View File

@ -27,15 +27,24 @@ fi
set -e set -e
OS_FAMILY=$(facter osfamily) OS_FAMILY=$(facter osfamily)
if [ "$OS_FAMILY" == "Debian" ] ; then
rm -f /etc/apt/sources.list.d/* case $OS_FAMILY in
apt-get update "Debian")
elif [ "$OS_FAMILY" == "RedHat" ] ; then repo=/etc/apt/sources.list.d/puppetlabs.list
# Can't delete * in yum.repos.d since all of the repos are listed there. update="apt-get update"
# Be specific instead. ;;
if [ -f /etc/yum.repos.d/puppetlabs.repo ] ; then "RedHat")
sudo rm -f /etc/yum.repos.d/puppetlabs.repo repo=/etc/yum.repos.d/puppetlabs.repo
fi # yum/dnf will notice this is gone, so don't need to spend
fi # time updating.
update=""
;;
*)
die "Don't know how to cleanup!"
;;
esac
rm -f $repo
$update
rm /usr/local/bin/prepare-node rm /usr/local/bin/prepare-node