Remove unneeded package sources from nodepool node

We need additional package sources on nodepool nodes to install things
like puppet, pypy, and python3. But once these packages are installed we
don't need them anymore. Any test that does an apt-get update or yum
upgrade will hit these package repos despite not needing to. Remove the
additional sources after we are done with them to be nicer to them.

Fixes-Bug: 1253774
Change-Id: I3c5bd7e544076f26b224553bdea6134d39fc8bba
This commit is contained in:
Clark Boylan 2014-03-11 17:07:57 -07:00
parent ec9d70408b
commit e4c9c9680b

View File

@ -44,5 +44,21 @@ sudo -i python /opt/nodepool-scripts/cache_git_repos.py
# boot (eg when this image is used for testing).
sudo sed -i 's/ext3/ext4/g' /etc/fstab
# Remove additional sources used to install puppet or special version of pypi.
# We do this because leaving these sources in place causes every test that
# does an apt-get update to hit those servers which may not have the uptime
# of our local mirrors.
OS_FAMILY=$(facter osfamily)
if [ "$OS_FAMILY" == "Debian" ] ; then
sudo rm -f /etc/apt/sources.list.d/*
sudo 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
sync
sleep 5