issue #186: finally enable detach.

pull/262/head
David Wilson 7 years ago
parent 05e0b134f9
commit ae20a689ef

@ -462,9 +462,9 @@ class NewStyleRunner(ScriptRunner):
def _setup_imports(self): def _setup_imports(self):
""" """
Ensure the local importer has loaded every module needed by the Ansible Ensure the local importer and PushFileService has everything for the
module before setup() completes, but before detach() is called in an Ansible module before setup() completes, but before detach() is called
asynchronous task. in an asynchronous task.
The master automatically streams modules towards us concurrent to the The master automatically streams modules towards us concurrent to the
runner invocation, however there is no public API to synchronize on the runner invocation, however there is no public API to synchronize on the
@ -476,6 +476,10 @@ class NewStyleRunner(ScriptRunner):
mitogen.core.import_module(fullname) mitogen.core.import_module(fullname)
for fullname in self.module_map['builtin']: for fullname in self.module_map['builtin']:
mitogen.core.import_module(fullname) mitogen.core.import_module(fullname)
self.source = ansible_mitogen.target.get_small_file(
context=self.service_context,
path=self.path,
)
def setup(self): def setup(self):
super(NewStyleRunner, self).setup() super(NewStyleRunner, self).setup()
@ -511,11 +515,6 @@ class NewStyleRunner(ScriptRunner):
pass pass
def _get_code(self): def _get_code(self):
self.source = ansible_mitogen.target.get_small_file(
context=self.service_context,
path=self.path,
)
try: try:
return self._code_by_path[self.path] return self._code_by_path[self.path]
except KeyError: except KeyError:

@ -302,8 +302,8 @@ def _run_module_async(kwargs, job_id, econtext):
'pid': os.getpid() 'pid': os.getpid()
}) })
#kwargs['detach'] = True kwargs['detach'] = True
#kwargs['econtext'] = econtext kwargs['econtext'] = econtext
kwargs['emulate_tty'] = False kwargs['emulate_tty'] = False
dct = run_module(kwargs) dct = run_module(kwargs)
if mitogen.core.PY3: if mitogen.core.PY3:

Loading…
Cancel
Save