Remove r10k env vars with proper args

The PUPPETFILE and PUPPETFILE_DIR environment
variables are deprecated since several releases
and are superseeded by the --puppetfile and
--moduledir arguments. [0] [1]

This patch replaces all those occurences to future
proof it when the env vars are removed.

[0] http://logs.openstack.org/57/529657/2/check/puppet-openstack-integration-4-scenario004-tempest-ubuntu-xenial/ce6f987/job-output.txt.gz#_2017-12-21_22_52_53_499924
[1] https://github.com/puppetlabs/r10k/pull/479

Change-Id: I216fe01a13e46c90bbb1455df72b25daf899c9f0
This commit is contained in:
Tobias Urdin 2017-12-22 15:29:24 +01:00
parent 8fea96515c
commit 9f14f75ec6
3 changed files with 12 additions and 10 deletions

View File

@ -8,21 +8,22 @@
# #
# - ``SCRIPT_DIR`` must be set to script path # - ``SCRIPT_DIR`` must be set to script path
# - ``GEM_BIN_DIR`` must be set to Gem bin directory # - ``GEM_BIN_DIR`` must be set to Gem bin directory
# - ``MODULES_DIR`` must be set to Puppet modules directory
install_external() { install_external() {
PUPPETFILE=${SCRIPT_DIR}/Puppetfile1 r10k -v DEBUG puppetfile install r10k -v DEBUG puppetfile install --puppetfile ${SCRIPT_DIR}/Puppetfile1 --moduledir ${MODULES_DIR}
} }
# Install Puppet OpenStack modules with zuul-cloner # Install Puppet OpenStack modules with zuul-cloner
# Uses the following variables: # Uses the following variables:
# #
# - ``PUPPETFILE_DIR`` must be set to Puppet modules directory # - ``MODULES_DIR`` must be set to Puppet modules directory
# - ``SCRIPT_DIR`` must be set to script path # - ``SCRIPT_DIR`` must be set to script path
# - ``ZUUL_BRANCH`` must be set to Zuul branch. Fallback to 'master'. # - ``ZUUL_BRANCH`` must be set to Zuul branch. Fallback to 'master'.
install_openstack() { install_openstack() {
cat > clonemap.yaml <<EOF cat > clonemap.yaml <<EOF
clonemap: clonemap:
- name: '(.*?)/puppet-(.*)' - name: '(.*?)/puppet-(.*)'
dest: '$PUPPETFILE_DIR/\2' dest: '$MODULES_DIR/\2'
EOF EOF
# Periodic jobs run without ref on master # Periodic jobs run without ref on master
@ -39,25 +40,26 @@ EOF
# Because openstack-integration can't be a class name. # Because openstack-integration can't be a class name.
# https://projects.puppetlabs.com/issues/5268 # https://projects.puppetlabs.com/issues/5268
mv $PUPPETFILE_DIR/openstack-integration $PUPPETFILE_DIR/openstack_integration mv $MODULES_DIR/openstack-integration $MODULES_DIR/openstack_integration
} }
# Install all Puppet modules with r10k # Install all Puppet modules with r10k
# Uses the following variables: # Uses the following variables:
# #
# - ``SCRIPT_DIR`` must be set to script path # - ``SCRIPT_DIR`` must be set to script path
# - ``MODULES_DIR`` must be set to Puppet modules directory
install_all() { install_all() {
# When installing from local source, we want to install the current source # When installing from local source, we want to install the current source
# we're working from. # we're working from.
PUPPETFILE=${SCRIPT_DIR}/Puppetfile r10k -v DEBUG puppetfile install r10k -v DEBUG puppetfile install --puppetfile ${SCRIPT_DIR}/Puppetfile --moduledir ${MODULES_DIR}
cp -a ${SCRIPT_DIR} ${PUPPETFILE_DIR}/openstack_integration cp -a ${SCRIPT_DIR} ${MODULES_DIR}/openstack_integration
} }
# Install Puppet OpenStack modules and dependencies by using # Install Puppet OpenStack modules and dependencies by using
# zuul-cloner or r10k. # zuul-cloner or r10k.
# Uses the following variables: # Uses the following variables:
# #
# - ``PUPPETFILE_DIR`` must be set to Puppet modules directory # - ``MODULES_DIR`` must be set to Puppet modules directory
# - ``SCRIPT_DIR`` must be set to script path # - ``SCRIPT_DIR`` must be set to script path
# - ``ZUUL_BRANCH`` must be set to Zuul branch # - ``ZUUL_BRANCH`` must be set to Zuul branch
install_modules() { install_modules() {

View File

@ -18,7 +18,7 @@ if [ -e /opt/puppetlabs/bin/puppet ]; then
fi fi
export SCRIPT_DIR=$(cd `dirname $0` && pwd -P) export SCRIPT_DIR=$(cd `dirname $0` && pwd -P)
export PUPPETFILE_DIR=${PUPPETFILE_DIR:-${PUPPET_BASE_PATH}/modules} export MODULES_DIR=${MODULES_DIR:-${PUPPET_BASE_PATH}/modules}
source $SCRIPT_DIR/functions source $SCRIPT_DIR/functions
print_header 'Start (install_modules.sh)' print_header 'Start (install_modules.sh)'
@ -31,7 +31,7 @@ gem install puppet_forge -v '= 2.2.6' --verbose
gem install r10k --no-ri --no-rdoc --verbose gem install r10k --no-ri --no-rdoc --verbose
# make sure there is no puppet module pre-installed # make sure there is no puppet module pre-installed
rm -rf "${PUPPETFILE_DIR:?}/"* rm -rf "${MODULES_DIR:?}/"*
print_header 'Install Modules' print_header 'Install Modules'
install_modules install_modules

View File

@ -18,7 +18,7 @@ else
fi fi
export SCRIPT_DIR=$(cd `dirname $0` && pwd -P) export SCRIPT_DIR=$(cd `dirname $0` && pwd -P)
export PUPPETFILE_DIR=${PUPPETFILE_DIR:-${PUPPET_BASE_PATH}/modules} export MODULES_DIR=${MODULES_DIR:-${PUPPET_BASE_PATH}/modules}
source $SCRIPT_DIR/functions source $SCRIPT_DIR/functions
print_header 'Start (install_modules_unit.sh)' print_header 'Start (install_modules_unit.sh)'