From f737ff5276b551e7eb511dba2f5b3452139fb406 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Fri, 4 May 2018 15:30:51 +0100 Subject: [PATCH] ansible: stop passing through remote_tmp variable Ansiballz does not use remote_tmp so neither should we, per #239. --- ansible_mitogen/mixins.py | 1 - ansible_mitogen/planner.py | 6 +----- ansible_mitogen/runner.py | 5 ++--- ansible_mitogen/target.py | 4 ++-- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/ansible_mitogen/mixins.py b/ansible_mitogen/mixins.py index 79d71928..b9cbd3e7 100644 --- a/ansible_mitogen/mixins.py +++ b/ansible_mitogen/mixins.py @@ -319,7 +319,6 @@ class ActionModuleMixin(ansible.plugins.action.ActionBase): connection=self._connection, module_name=mitogen.utils.cast(module_name), module_args=mitogen.utils.cast(module_args), - remote_tmp=mitogen.utils.cast(self._get_remote_tmp()), task_vars=task_vars, templar=self._templar, env=mitogen.utils.cast(env), diff --git a/ansible_mitogen/planner.py b/ansible_mitogen/planner.py index 7e3aa39a..f007205c 100644 --- a/ansible_mitogen/planner.py +++ b/ansible_mitogen/planner.py @@ -92,7 +92,7 @@ class Invocation(object): target.run_module() or helpers.run_module_async() in the target context. """ def __init__(self, action, connection, module_name, module_args, - remote_tmp, task_vars, templar, env, wrap_async): + task_vars, templar, env, wrap_async): #: ActionBase instance invoking the module. Required to access some #: output postprocessing methods that don't belong in ActionBase at #: all. @@ -104,9 +104,6 @@ class Invocation(object): self.module_name = module_name #: Final module arguments. self.module_args = module_args - #: Value of 'remote_tmp' parameter, to allow target to create temporary - #: files in correct location. - self.remote_tmp = remote_tmp #: Task variables, needed to extract ansible_*_interpreter. self.task_vars = task_vars #: Templar, needed to extract ansible_*_interpreter. @@ -198,7 +195,6 @@ class BinaryPlanner(Planner): path=invocation.module_path, args=invocation.module_args, env=invocation.env, - remote_tmp=invocation.remote_tmp, **kwargs ) diff --git a/ansible_mitogen/runner.py b/ansible_mitogen/runner.py index f93a0028..5021b925 100644 --- a/ansible_mitogen/runner.py +++ b/ansible_mitogen/runner.py @@ -92,15 +92,14 @@ class Runner(object): Subclasses may override `_run`()` and extend `setup()` and `revert()`. """ - def __init__(self, module, remote_tmp, service_context, - emulate_tty=None, raw_params=None, args=None, env=None): + def __init__(self, module, service_context, emulate_tty=None, + raw_params=None, args=None, env=None): if args is None: args = {} if raw_params is not None: args['_raw_params'] = raw_params self.module = utf8(module) - self.remote_tmp = utf8(os.path.expanduser(remote_tmp)) self.service_context = service_context self.emulate_tty = emulate_tty self.raw_params = raw_params diff --git a/ansible_mitogen/target.py b/ansible_mitogen/target.py index 87df9b5e..6259bdec 100644 --- a/ansible_mitogen/target.py +++ b/ansible_mitogen/target.py @@ -239,8 +239,8 @@ def reset_temp_dir(econtext): """ Create one temporary directory to be reused by all runner.py invocations for the lifetime of the process. The temporary directory is changed for - each forked job, and emptied as necessary runner.py::_cleanup_temp() after - each module invocation. + each forked job, and emptied as necessary by runner.py::_cleanup_temp() + after each module invocation. The result is that a context need only create and delete one directory during startup and shutdown, and no further filesystem writes need occur