issue #587: support pausing ansible_tests if flag file exists

To support debugging on Azure
This commit is contained in:
David Wilson 2019-05-26 12:06:14 +01:00
parent 8a18d1862e
commit 838742f000
1 changed files with 15 additions and 2 deletions

View File

@ -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()