diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2016-06-29 02:52:49 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2016-06-29 02:52:49 +0200 |
commit | c50364d5852de7446462d0b986d72dc2786df6eb (patch) | |
tree | 4006e60ab72b2e875a3d07e4bd78b14a52fc73a8 /lib/action_plugins/openldap.py | |
parent | b26aa6a670ea30442e1a8134914b2c7976dc1753 (diff) |
ansible: _make_tmp_path now takes an argument.
Diffstat (limited to 'lib/action_plugins/openldap.py')
-rw-r--r-- | lib/action_plugins/openldap.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/action_plugins/openldap.py b/lib/action_plugins/openldap.py index a66c3aa..ad77abc 100644 --- a/lib/action_plugins/openldap.py +++ b/lib/action_plugins/openldap.py @@ -30,39 +30,40 @@ class ActionModule(ActionBase): result = super(ActionModule, self).run(tmp, task_vars) target = self._task.args.get('target', None) local = self._task.args.get('local', 'no') if local not in [ 'no', 'file', 'template' ]: return dict(failed=True, msg="local must be in ['no','file','template']") if local != 'no' and target is None: return dict(failed=True, msg="target is required in local mode") if local == 'no': # run the module remotely return self._execute_module(module_args=self._task.args, task_vars=task_vars) if self._task._role is not None: target = self._loader.path_dwim_relative(self._task._role._role_path, local+'s', target) else: target = self._loader.path_dwim_relative(self._loader.get_basedir(), local+'s', target) + remote_user = task_vars.get('ansible_ssh_user') or self._play_context.remote_user new_module_args = self._task.args.copy() - new_module_args['target'] = self._connection._shell.join_path(self._make_tmp_path(), 'target.ldif') + new_module_args['target'] = self._connection._shell.join_path(self._make_tmp_path(remote_user), 'target.ldif') new_module_args['local'] = 'no' if local == 'template': # template the source data locally try: with open(target, 'r') as f: template_data = to_unicode(f.read()) target = self._templar.template(template_data, preserve_trailing_newlines=True, escape_backslashes=False, convert_data=False) except Exception as e: result['failed'] = True result['msg'] = type(e).__name__ + ": " + str(e) return result # transfer the file and run the module remotely self._transfer_data(new_module_args['target'], target) result.update(self._execute_module(module_args=new_module_args, task_vars=task_vars)) return result |