#!/bin/bash
#
# This script is used by Puppet OpenStack modules to prepare
# modules before running dependencies.
#

set -ex

if [ -n "${GEM_HOME}" ]; then
    GEM_BIN_DIR=${GEM_HOME}/bin/
    export PATH=${PATH}:${GEM_BIN_DIR}
fi

export PUPPET_BASE_PATH=/etc/puppetlabs/code
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_unit.sh)'

print_header 'Install Modules'
install_modules

print_header 'Module List'
puppet module list --modulepath ./spec/fixtures/modules

print_header 'Done (install_modules_unit.sh)'

#!/bin/bash
#
# This script is used by Puppet OpenStack modules to prepare
# modules before running dependencies.
#

set -ex

if [ -n "${GEM_HOME}" ]; then
    GEM_BIN_DIR=${GEM_HOME}/bin/
    export PATH=${PATH}:${GEM_BIN_DIR}
fi

if [ "${PUPPET_MAJ_VERSION}" = 4 ]; then
  export PUPPET_BASE_PATH=/etc/puppetlabs/code
else
  export PUPPET_BASE_PATH=/etc/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_unit.sh)'

print_header 'Install Modules'
install_modules

print_header 'Module List'
puppet module list --modulepath ./spec/fixtures/modules

print_header 'Done (install_modules_unit.sh)'

--- 
+++ 
@@ -11,7 +11,12 @@
     export PATH=${PATH}:${GEM_BIN_DIR}
 fi
 
-export PUPPET_BASE_PATH=/etc/puppetlabs/code
+if [ "${PUPPET_MAJ_VERSION}" = 4 ]; then
+  export PUPPET_BASE_PATH=/etc/puppetlabs/code
+else
+  export PUPPET_BASE_PATH=/etc/puppet
+fi
+
 export SCRIPT_DIR=$(cd `dirname $0` && pwd -P)
 export PUPPETFILE_DIR=${PUPPETFILE_DIR:-${PUPPET_BASE_PATH}/modules}
 source $SCRIPT_DIR/functions
Remove PUPPET_MAJ_VERSION check for unit modules

The install_modules_unit.sh which is called by the
spec helper to install the modules for the unit
tests checks the PUPPET_MAJ_VERSION variable when
selecting the puppet base path.

The zuul jobs is not configured to give this env
variable so unit tests failed when using the puppet
base path for v3 which was /etc/puppet instead of
/etc/puppetlabs/code that is valid for v4 and v5.

We don't test v3 specifically so the check
should not be needed.

Change-Id: I6a9c53d58f05dfbb8646ad36d3bf5f6bad5588e1
