From 22c29c79ace347ea6b77f5658ece5e565c3ad27a Mon Sep 17 00:00:00 2001
From: David Moreau-Simard <dms@redhat.com>
Date: Mon, 13 Jun 2016 14:11:46 -0400
Subject: [PATCH] Ensure $GEM_BIN_DIR is in $PATH

This makes gem binary usage consistent (i.e, r10k) and prevents
encoutering a command not found error.

Change-Id: I3ef01274417cd88403d71af0e6216850d77cc81c
Closes-Bug: #1592113
---
 functions               | 2 +-
 install_modules.sh      | 1 +
 install_modules_unit.sh | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/functions b/functions
index 4e84600f0..5d1764dce 100644
--- a/functions
+++ b/functions
@@ -9,7 +9,7 @@
 # - ``SCRIPT_DIR`` must be set to script path
 # - ``GEM_BIN_DIR`` must be set to Gem bin directory
 install_external() {
-  PUPPETFILE=${SCRIPT_DIR}/Puppetfile1 ${GEM_BIN_DIR}r10k puppetfile install -v
+  PUPPETFILE=${SCRIPT_DIR}/Puppetfile1 r10k puppetfile install -v
 }
 
 # Install Puppet OpenStack modules with zuul-cloner
diff --git a/install_modules.sh b/install_modules.sh
index 2bb02f726..c48468e71 100755
--- a/install_modules.sh
+++ b/install_modules.sh
@@ -4,6 +4,7 @@ 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
diff --git a/install_modules_unit.sh b/install_modules_unit.sh
index 730cd41b2..6305224bd 100755
--- a/install_modules_unit.sh
+++ b/install_modules_unit.sh
@@ -8,6 +8,7 @@ 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