Eliminate possible race condition in async_wrapper where ansible deletes the argsfile while the module

is still kicking off.  Should not happen except in modules that are somewhat slow to load and probably
can be fixed better than the included sleep, i.e. some IPC communication that the process has
launched and is ok to exit.  This works pretty well for now though.
reviewable/pr18780/r1
Michael DeHaan 13 years ago
parent dca511fa35
commit a3bd951bfb

@ -134,6 +134,11 @@ if pid != 0:
# print "RETURNING SUCCESS IN PARENT" # print "RETURNING SUCCESS IN PARENT"
print json.dumps({ "started" : 1, "ansible_job_id" : jid, "results_file" : log_path }) print json.dumps({ "started" : 1, "ansible_job_id" : jid, "results_file" : log_path })
sys.stdout.flush() sys.stdout.flush()
# we need to not return immmediately such that the launched command has an attempt
# to initialize PRIOR to ansible trying to clean up the launch directory (and argsfile)
# this probably could be done with some IPC later. Modules should always read
# the argsfile at the very first start of their execution anyway
time.sleep(1)
sys.exit(0) sys.exit(0)
else: else:
# the kid manages the job # the kid manages the job

13
yum

@ -265,13 +265,14 @@ def remove_only(pkgspec):
def main(): def main():
# state=installed pkg=pkgspec # state=installed pkg=pkgspec
# state=removed pkg=pkgspec # state=removed pkg=pkgspec
# list=installed # state=latest pkg=pkgspec
# list=updates
# list=available
# list=repos
# list=pkgspec
# update="args"?
# #
# informational commands:
# list=installed
# list=updates
# list=available
# list=repos
# list=pkgspec
if len(sys.argv) == 1: if len(sys.argv) == 1:
msg = "the yum module requires arguments (-a)" msg = "the yum module requires arguments (-a)"

Loading…
Cancel
Save