1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

Add a sleep step to job runs if configured

If the extra var PEXPECT_SLEEP is given to a job then it will
artificially delay the job run by that number of seconds allowing QA to
hook in and cancel the job
This commit is contained in:
Matthew Jones 2015-09-28 15:43:46 -04:00
parent 2e43ed0405
commit 5be53d4a79

View File

@ -425,6 +425,9 @@ class BaseTask(Task):
'''
logfile = stdout_handle
logfile_pos = logfile.tell()
if hasattr(instance, "extra_vars_dict") and "PEXPECT_SLEEP" in instance.extra_vars_dict:
logger.info("Suspending Job Execution for QA Work")
time.sleep(int(instance.extra_vars_dict["PEXPECT_SLEEP"]))
child = pexpect.spawnu(args[0], args[1:], cwd=cwd, env=env)
child.logfile_read = logfile
canceled = False