mirror of
https://github.com/ansible/awx.git
synced 2026-03-27 22:05:07 -02:30
Ability to pause pexpect output with env var
Since inventory updates don't support extra vars
This commit is contained in:
@@ -426,8 +426,14 @@ class BaseTask(Task):
|
|||||||
logfile = stdout_handle
|
logfile = stdout_handle
|
||||||
logfile_pos = logfile.tell()
|
logfile_pos = logfile.tell()
|
||||||
if hasattr(instance, "extra_vars_dict") and "PEXPECT_SLEEP" in instance.extra_vars_dict:
|
if hasattr(instance, "extra_vars_dict") and "PEXPECT_SLEEP" in instance.extra_vars_dict:
|
||||||
|
pexpect_sleep = int(instance.extra_vars_dict['PEXPECT_SLEEP'])
|
||||||
|
elif 'PEXPECT_SLEEP' in os.environ:
|
||||||
|
pexpect_sleep = int(os.environ['PEXPECT_SLEEP'])
|
||||||
|
else:
|
||||||
|
pexpect_sleep = None
|
||||||
|
if pexpect_sleep is not None:
|
||||||
logger.info("Suspending Job Execution for QA Work")
|
logger.info("Suspending Job Execution for QA Work")
|
||||||
time.sleep(int(instance.extra_vars_dict["PEXPECT_SLEEP"]))
|
time.sleep(pexpect_sleep)
|
||||||
child = pexpect.spawnu(args[0], args[1:], cwd=cwd, env=env)
|
child = pexpect.spawnu(args[0], args[1:], cwd=cwd, env=env)
|
||||||
child.logfile_read = logfile
|
child.logfile_read = logfile
|
||||||
canceled = False
|
canceled = False
|
||||||
|
|||||||
Reference in New Issue
Block a user