system-config/install_modules.sh
Ryan Lane 7da354907e Initial commit of MediaWiki module
Change-Id: I6181e0d4a717d0a11ea2d741034db99435d5e180
Reviewed-on: https://review.openstack.org/10521
Approved: Monty Taylor <mordred@inaugust.com>
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Tested-by: Jenkins
2012-08-12 18:40:54 +00:00

50 lines
1.1 KiB
Bash

#!/bin/bash
MODULE_PATH=/etc/puppet/modules
function clone_git() {
REMOTE_URL=$1
REPO=$2
REV=$3
if [ -d $MODULE_PATH/$REPO -a ! -d $MODULE_PATH/$REPO/.git ] ; then
rm -rf $MODULE_PATH/$REPO
fi
if [ ! -d $MODULE_PATH/$REPO ] ; then
git clone $REMOTE_URL $MODULE_PATH/$REPO
fi
OLDDIR=`pwd`
cd $MODULE_PATH/$REPO
if ! git rev-parse HEAD | grep "^$REV" >/dev/null; then
git fetch $REMOTE_URL
git reset --hard $REV >/dev/null
fi
cd $OLDDIR
}
if ! puppet help module >/dev/null 2>&1 ; then
apt-get install -y -o Dpkg::Options::="--force-confold" puppet facter
fi
MODULES="
openstackci-dashboard
openstackci-vcsrepo
puppetlabs-apache
puppetlabs-apt
puppetlabs-mysql
saz-memcached
"
MODULE_LIST=`puppet module list`
# Transition away from old things
if [ -d /etc/puppet/modules/vcsrepo/.git ] ; then
rm -rf /etc/puppet/modules/vcsrepo
fi
for MOD in $MODULES ; do
if ! echo $MODULE_LIST | grep $MOD >/dev/null 2>&1 ; then
# This will get run in cron, so silence non-error output
puppet module install --force $MOD >/dev/null
fi
done