summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTobias Henkel <tobias.henkel@bmw.de>2019-05-25 08:35:21 +0200
committerTobias Henkel <tobias.henkel@bmw.de>2019-05-25 09:07:32 +0200
commite912cd15a933e660043a0c55d38158ebeee627b9 (patch)
tree286856075e5f051d8d4b6f94a515df86cab17c86 /tools
parentaf910d9d8e432100a74e97a91670fc0ecc7e2b4f (diff)
downloadzuul-e912cd15a933e660043a0c55d38158ebeee627b9.tar.gz
Fix test-logs.sh utility for multi-ansible
Since the multi-ansible work the test-logs.sh script is broken and needs to be fixed to use the managed ansible. Change-Id: I271f45d9f096a05949900ba1dd2bf8321c459815
Diffstat (limited to 'tools')
-rwxr-xr-xtools/test-logs.sh39
1 files changed, 25 insertions, 14 deletions
diff --git a/tools/test-logs.sh b/tools/test-logs.sh
index 429bac5e8..2df7eb69a 100755
--- a/tools/test-logs.sh
+++ b/tools/test-logs.sh
@@ -22,19 +22,23 @@ if [[ ! -d "${ZUUL_DIR}/.tox/venv" ]]; then
tox -e venv --notest
popd
fi
+
+ANSIBLE_VERSION="2.7"
+ANSIBLE_ROOT="${ZUUL_DIR}/.tox/venv/lib/zuul/ansible/${ANSIBLE_VERSION}"
+ARA_DIR=$(dirname $("${ANSIBLE_ROOT}/bin/python3" -c 'import ara; print(ara.__file__)'))
+
# Source tox environment
source ${ZUUL_DIR}/.tox/venv/bin/activate
-# Install ARA if it's not installed (not in requirements.txt by default)
-python -c "import ara" &> /dev/null
-if [ $? -eq 1 ]; then
- echo "ARA isn't installed... Installing it."
- pip install ara
-fi
-ARA_DIR=$(dirname $(python3 -c 'import ara; print(ara.__file__)'))
-
WORK_DIR=$(mktemp -d /tmp/zuul_logs_XXXX)
+# Copy zuul ansible modules into workdir
+ZUUL_ANSIBLE="${WORK_DIR}/zuul-ansible"
+mkdir -p "${ZUUL_ANSIBLE}/zuul"
+cp -Lr "${ZUUL_DIR}/zuul/ansible/${ANSIBLE_VERSION}" "${ZUUL_ANSIBLE}/zuul/ansible"
+touch "${ZUUL_ANSIBLE}/zuul/ansible/__init__.py"
+touch "${ZUUL_ANSIBLE}/zuul/__init__.py"
+
if [ -z $1 ] ; then
INVENTORY=$WORK_DIR/hosts.yaml
cat >$INVENTORY <<EOF
@@ -62,11 +66,12 @@ gathering = smart
gather_subset = !all
fact_caching = jsonfile
fact_caching_connection = ~/.cache/facts
-lookup_plugins = $ZUUL_DIR/zuul/ansible/lookup
-callback_plugins = $ZUUL_DIR/zuul/ansible/callback:$ARA_DIR/plugins/callbacks
-module_utils = $ZUUL_DIR/zuul/ansible/module_utils
+lookup_plugins = ${ZUUL_ANSIBLE}/zuul/ansible/lookup
+callback_plugins = ${ZUUL_ANSIBLE}/zuul/ansible/callback:$ARA_DIR/plugins/callbacks
+action_plugins = ${ZUUL_ANSIBLE}/zuul/ansible/actiongeneral
+module_utils = ${ZUUL_ANSIBLE}/zuul/ansible/module_utils
stdout_callback = zuul_stream
-library = $ZUUL_DIR/zuul/ansible/library
+library = ${ZUUL_ANSIBLE}/zuul/ansible/library
retry_files_enabled = False
EOF
@@ -75,8 +80,14 @@ python3 $ZUUL_DIR/zuul/ansible/logconfig.py
export ZUUL_JOB_LOG_CONFIG=$WORK_DIR/logging.json
export ARA_DIR=$WORK_DIR/.ara
export ARA_LOG_CONFIG=$ZUUL_JOB_LOG_CONFIG
+export PYTHONPATH="${ZUUL_ANSIBLE}:${PYTHONPATH}"
+export ZUUL_JOBDIR=$WORK_DIR
rm -rf $ARA_DIR
-ansible-playbook $ZUUL_DIR/playbooks/zuul-stream/fixtures/test-stream.yaml
-ansible-playbook $ZUUL_DIR/playbooks/zuul-stream/fixtures/test-stream-failure.yaml
+
+"${ANSIBLE_ROOT}/bin/ansible" all -m zuul_console
+
+ANSIBLE="${ANSIBLE_ROOT}/bin/ansible-playbook"
+"${ANSIBLE}" "${ZUUL_DIR}/playbooks/zuul-stream/fixtures/test-stream.yaml"
+"${ANSIBLE}" "${ZUUL_DIR}/playbooks/zuul-stream/fixtures/test-stream-failure.yaml"
# ansible-playbook $ZUUL_DIR/playbooks/zuul-stream/functional.yaml
echo "Logs are in $WORK_DIR"