From 30678e04aca5def6228fd46f67352d4db61b0286 Mon Sep 17 00:00:00 2001 From: Aleksey Ovcharenko Date: Fri, 22 Nov 2013 04:06:10 +0200 Subject: [PATCH 1/2] Make tests happy --- lib/ansible/runner/__init__.py | 9 ++++++++- lib/ansible/runner/action_plugins/synchronize.py | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 6118c2b8a6f..6563c24884c 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -584,9 +584,12 @@ class Runner(object): actual_user = inject.get('ansible_ssh_user', self.remote_user) actual_pass = inject.get('ansible_ssh_pass', self.remote_pass) actual_transport = inject.get('ansible_connection', self.transport) - actual_private_key_file = os.path.expanduser(inject.get('ansible_ssh_private_key_file', self.private_key_file)) + actual_private_key_file = inject.get('ansible_ssh_private_key_file', self.private_key_file) self.sudo_pass = inject.get('ansible_sudo_pass', self.sudo_pass) + if actual_private_key_file is not None: + actual_private_key_file = os.path.expanduser(actual_private_key_file) + if self.accelerate and actual_transport != 'local': #Fix to get the inventory name of the host to accelerate plugin if inject.get('ansible_ssh_host', None): @@ -626,6 +629,10 @@ class Runner(object): actual_private_key_file = os.path.expanduser(delegate_info.get('ansible_ssh_private_key_file', self.private_key_file)) actual_transport = delegate_info.get('ansible_connection', self.transport) self.sudo_pass = delegate_info.get('ansible_sudo_pass', self.sudo_pass) + + if actual_private_key_file is not None: + actual_private_key_file = os.path.expanduser(actual_private_key_file) + for i in delegate_info: if i.startswith("ansible_") and i.endswith("_interpreter"): inject[i] = delegate_info[i] diff --git a/lib/ansible/runner/action_plugins/synchronize.py b/lib/ansible/runner/action_plugins/synchronize.py index 3ff74cb0537..004deded22e 100644 --- a/lib/ansible/runner/action_plugins/synchronize.py +++ b/lib/ansible/runner/action_plugins/synchronize.py @@ -79,9 +79,11 @@ class ActionModule(object): if not dest_host is src_host: user = inject.get('ansible_ssh_user', self.runner.remote_user) - private_key = os.path.expanduser(inject.get('ansible_ssh_private_key_file', self.runner.private_key_file)) + private_key = inject.get('ansible_ssh_private_key_file', self.runner.private_key_file) if not private_key is None: + private_key = os.path.expanduser(private_key) options['private_key'] = private_key + src = self._process_origin(src_host, src, user) dest = self._process_origin(dest_host, dest, user) From 9af44b1b429d5ea53cc7425f16af7cd7eed6376b Mon Sep 17 00:00:00 2001 From: Aleksey Ovcharenko Date: Fri, 22 Nov 2013 04:20:14 +0200 Subject: [PATCH 2/2] Update to 4 space indent --- lib/ansible/runner/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 6563c24884c..59e2094e221 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -588,7 +588,7 @@ class Runner(object): self.sudo_pass = inject.get('ansible_sudo_pass', self.sudo_pass) if actual_private_key_file is not None: - actual_private_key_file = os.path.expanduser(actual_private_key_file) + actual_private_key_file = os.path.expanduser(actual_private_key_file) if self.accelerate and actual_transport != 'local': #Fix to get the inventory name of the host to accelerate plugin @@ -631,7 +631,7 @@ class Runner(object): self.sudo_pass = delegate_info.get('ansible_sudo_pass', self.sudo_pass) if actual_private_key_file is not None: - actual_private_key_file = os.path.expanduser(actual_private_key_file) + actual_private_key_file = os.path.expanduser(actual_private_key_file) for i in delegate_info: if i.startswith("ansible_") and i.endswith("_interpreter"):