From 542e170b81b7d36687480c09de2dbe4707d0c266 Mon Sep 17 00:00:00 2001
From: "James E. Blair" <jeblair@hp.com>
Date: Mon, 15 Sep 2014 11:12:01 -0700
Subject: [PATCH] Keep environment for cloner in apply test sudo

The zuul cloner needs the ZUUL_* env vars when setting up projects
for the new apply integration test.

Also, add some more debugging to both versions of the test.

Change-Id: I486b19cecd034250068e4a59604e1e0ca90ed83d
---
 test.sh             | 4 +++-
 tools/apply-test.sh | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/test.sh b/test.sh
index 54e1380319..72ffa3db14 100755
--- a/test.sh
+++ b/test.sh
@@ -1,4 +1,4 @@
-#!/bin/bash -e
+#!/bin/bash -ex
 
 ROOT=$(readlink -fn $(dirname $0))
 MODULE_PATH="${ROOT}/modules:/etc/puppet/modules"
@@ -43,6 +43,8 @@ sudo mv /tmp/hosts /etc/hosts
 
 sudo mkdir -p /var/run/puppet
 sudo bash -x ./install_modules.sh
+echo "Running apply test on these hosts:"
+find applytest -name 'puppetapplytest*.final' -print0
 find applytest -name 'puppetapplytest*.final' -print0 | \
     xargs -0 -P $(nproc) -n 1 -I filearg \
         sudo puppet apply --modulepath=${MODULE_PATH} --noop --verbose --debug filearg > /dev/null
diff --git a/tools/apply-test.sh b/tools/apply-test.sh
index d5cd92ba12..83b97dad9f 100755
--- a/tools/apply-test.sh
+++ b/tools/apply-test.sh
@@ -26,7 +26,7 @@ clonemap:
 EOF
 
 # Add puppet modules that should be installed to the end of this list
-sudo /usr/zuul-env/bin/zuul-cloner -m clonemap.yaml --cache-dir /opt/git \
+sudo -E /usr/zuul-env/bin/zuul-cloner -m clonemap.yaml --cache-dir /opt/git \
     git://git.openstack.org \
     openstack-infra/puppet-storyboard
 
@@ -67,6 +67,8 @@ sudo mv /tmp/hosts /etc/hosts
 
 sudo mkdir -p /var/run/puppet
 sudo -E bash -x ./install_modules.sh
+echo "Running apply test on these hosts:"
+find applytest -name 'puppetapplytest*.final' -print0
 find applytest -name 'puppetapplytest*.final' -print0 | \
     xargs -0 -P $(nproc) -n 1 -I filearg \
         sudo puppet apply --modulepath=${MODULE_PATH} --noop --verbose --debug filearg > /dev/null