Alfredo Moralejo 2887c1652f Don't install puppetlabs repo when MANAGE_REPOS=false
Currently, p-o-i allways tries to install puppet package
from puppetlabs repo. In some cases, as RDO-CI we use p-o-i
to test puppet modules from RDO distro and it's recommended
to test it using puppet version provided in RDO repos which
uses different paths.

This patch provides a way to override this behavior by using
env variables as:

MANAGE_REPOS=false
PUPPET_PKG=puppet
PUPPETFILE_DIR=/etc/puppet/modules

Change-Id: I680504ab65d780deba53387e9b6604d3102de47b
2017-05-30 16:25:33 +02:00

46 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
set -ex
if [ -n "${GEM_HOME}" ]; then
GEM_BIN_DIR=${GEM_HOME}/bin/
export PATH=${PATH}:${GEM_BIN_DIR}
fi
# NOTE(aschultz): since puppet 3 is now EOL, and beaker-puppet_install_helper
# version 0.6.0 has made the agent version the default, we need to symlink
# puppet to the /opt/puppetlabs version when specifically not version 3.
# Workaround to deploy puppet for beaker jobs
if [ -e /opt/puppetlabs/bin/puppet ]; then
export PUPPET_BASE_PATH=/etc/puppetlabs/code
export PATH=${PATH}:/opt/puppetlabs/bin:/opt/puppetlabs/puppet/bin
sudo -E ln -sfn /opt/puppetlabs/bin/puppet /usr/sbin/puppet
fi
export SCRIPT_DIR=$(cd `dirname $0` && pwd -P)
export PUPPETFILE_DIR=${PUPPETFILE_DIR:-${PUPPET_BASE_PATH}/modules}
source $SCRIPT_DIR/functions
print_header 'Start (install_modules.sh)'
print_header 'Workaround to remove certifi requests and urllib3 deployed by pip'
sudo -E pip uninstall certifi -y || true
sudo -E pip uninstall urllib3 -y || true
sudo -E pip uninstall requests -y || true
print_header 'Install r10k'
# fast_gettext 1.2.0+ requires ruby 2.1.0
gem install fast_gettext -v '< 1.2.0'
gem install r10k --no-ri --no-rdoc
# make sure there is no puppet module pre-installed
rm -rf "${PUPPETFILE_DIR:?}/"*
print_header 'Install Modules'
install_modules
print_header 'Module List'
puppet module list
print_header 'Done (install_modules.sh)'