From 7f9907baa6a9eb8351eb2c24dba79e6e24f26430 Mon Sep 17 00:00:00 2001
From: Alex Schultz <aschultz@redhat.com>
Date: Fri, 26 May 2017 13:42:25 -0600
Subject: [PATCH] Drop puppet3 support

Puppet 3 was EOL as of December 31, 2016. Since we don't use it in the
gate for Pike, let's drop the configuration bits in p-o-i for it. This
change leaves the PUPPET_MAJ_VERSION support on the off chance we need
it in the future but basically 4 is currently the only supported
version.

Change-Id: I0f04a3cb194ec2225010fb4e062703195b79baf1
---
 functions          | 21 +++++++++------------
 install_modules.sh | 12 ++++--------
 run_tests.sh       |  6 +-----
 3 files changed, 14 insertions(+), 25 deletions(-)

diff --git a/functions b/functions
index 84a48e931..5f9e92547 100644
--- a/functions
+++ b/functions
@@ -145,20 +145,17 @@ install_puppet() {
     if uses_debs; then
         print_header 'Setup (Debian based)'
         # Puppetlabs packaging:
-        # - trusty: puppet3 and puppet4
         # - xenial: puppet4 only
-        if [[ ${DISTRO} == "trusty" ]] || [[ ${DISTRO} == "xenial" && ${PUPPET_MAJ_VERSION} == 4 ]]; then
-              if dpkg -l $PUPPET_RELEASE_FILE >/dev/null 2>&1; then
-                  $SUDO apt-get purge -y $PUPPET_RELEASE_FILE
-              fi
-              $SUDO rm -f /tmp/puppet.deb
-              wget http://apt.puppetlabs.com/${PUPPET_RELEASE_FILE}-${DISTRO}.deb -O /tmp/puppet.deb
-              $SUDO dpkg -i /tmp/puppet.deb
-              # TODO(emilien): figure what installed /etc/default/puppet on the xenial nodepool image
-              # We have no problem on Trusty but on Xenial we need to remove /etc/default/puppet before
-              # trying to deploy puppet-agent from puppetlabs.com.
-              $SUDO rm -rf /etc/default/puppet
+        if dpkg -l $PUPPET_RELEASE_FILE >/dev/null 2>&1; then
+            $SUDO apt-get purge -y $PUPPET_RELEASE_FILE
         fi
+        $SUDO rm -f /tmp/puppet.deb
+        wget http://apt.puppetlabs.com/${PUPPET_RELEASE_FILE}-${DISTRO}.deb -O /tmp/puppet.deb
+        $SUDO dpkg -i /tmp/puppet.deb
+        # TODO(emilien): figure what installed /etc/default/puppet on the xenial nodepool image
+        # We have no problem on Trusty but on Xenial we need to remove /etc/default/puppet before
+        # trying to deploy puppet-agent from puppetlabs.com.
+        $SUDO rm -rf /etc/default/puppet
         $SUDO apt-get update
         $SUDO apt-get install -y ${PUPPET_PKG}
     elif is_fedora; then
diff --git a/install_modules.sh b/install_modules.sh
index 6f6db4171..5db11c02d 100755
--- a/install_modules.sh
+++ b/install_modules.sh
@@ -10,14 +10,10 @@ 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.
-if [ "${PUPPET_MAJ_VERSION}" = 3 ]; then
-  export PUPPET_BASE_PATH=/etc/puppet
-else
-  export PUPPET_BASE_PATH=/etc/puppetlabs/code
-  export PATH=${PATH}:/opt/puppetlabs/bin:/opt/puppetlabs/puppet/bin
-  # Workaround to deploy puppet for beaker jobs
-  sudo -E ln -sfn /opt/puppetlabs/bin/puppet /usr/sbin/puppet
-fi
+export PUPPET_BASE_PATH=/etc/puppetlabs/code
+export PATH=${PATH}:/opt/puppetlabs/bin:/opt/puppetlabs/puppet/bin
+# Workaround to deploy puppet for beaker jobs
+sudo -E ln -sfn /opt/puppetlabs/bin/puppet /usr/sbin/puppet
 
 export SCRIPT_DIR=$(cd `dirname $0` && pwd -P)
 export PUPPETFILE_DIR=${PUPPETFILE_DIR:-${PUPPET_BASE_PATH}/modules}
diff --git a/run_tests.sh b/run_tests.sh
index ec74fd102..a65b8b8a8 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -17,7 +17,7 @@ export SCRIPT_DIR=$(cd `dirname $0` && pwd -P)
 source ${SCRIPT_DIR}/functions
 
 export WORKSPACE=${WORKSPACE:-/tmp}
-export PUPPET_MAJ_VERSION=${PUPPET_MAJ_VERSION:-3}
+export PUPPET_MAJ_VERSION=${PUPPET_MAJ_VERSION:-4}
 export SCENARIO=${SCENARIO:-scenario001}
 export MANAGE_PUPPET_MODULES=${MANAGE_PUPPET_MODULES:-true}
 export MANAGE_REPOS=${MANAGE_REPOS:-true}
@@ -71,10 +71,6 @@ if [ $PUPPET_MAJ_VERSION == 4 ]; then
   export PUPPET_RELEASE_FILE=puppetlabs-release-pc1
   export PUPPET_BASE_PATH=/etc/puppetlabs/code
   export PUPPET_PKG=puppet-agent
-else
-  export PUPPET_RELEASE_FILE=puppetlabs-release
-  export PUPPET_BASE_PATH=/etc/puppet
-  export PUPPET_PKG=puppet
 fi
 
 print_header 'Start (run_tests.sh)'