From 838742f000fd6d22912626d89ed740bd0843b231 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 26 May 2019 12:06:14 +0100 Subject: [PATCH] issue #587: support pausing ansible_tests if flag file exists To support debugging on Azure --- .ci/ansible_tests.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.ci/ansible_tests.py b/.ci/ansible_tests.py index 98e45ab8..8d2d8bba 100755 --- a/.ci/ansible_tests.py +++ b/.ci/ansible_tests.py @@ -3,6 +3,7 @@ import glob import os +import signal import sys import ci_lib @@ -13,6 +14,12 @@ TESTS_DIR = os.path.join(ci_lib.GIT_ROOT, 'tests/ansible') HOSTS_DIR = os.path.join(ci_lib.TMP, 'hosts') +def pause_if_interactive(): + if os.path.exists('/tmp/interactive'): + while True: + signal.pause() + + with ci_lib.Fold('unit_tests'): os.environ['SKIP_MITOGEN'] = '1' ci_lib.run('./run_tests -v') @@ -59,5 +66,11 @@ with ci_lib.Fold('job_setup'): with ci_lib.Fold('ansible'): playbook = os.environ.get('PLAYBOOK', 'all.yml') - run('./run_ansible_playbook.py %s -i "%s" %s', - playbook, HOSTS_DIR, ' '.join(sys.argv[1:])) + try: + run('./run_ansible_playbook.py %s -i "%s" %s', + playbook, HOSTS_DIR, ' '.join(sys.argv[1:])) + except: + pause_if_interactive() + raise + +pause_if_interactive()