From 5be53d4a79ca67c90c3a7f1a14b1e717d8760a65 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Mon, 28 Sep 2015 15:43:46 -0400 Subject: [PATCH] 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 --- awx/main/tasks.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index e91259f249..b92b965dd8 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -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