1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

remote user should rely on context, not direct var

this can cause issues with non-ssh connections and/or ansible_user
This commit is contained in:
Brian Coca 2017-01-19 11:58:06 -05:00
parent b2acba0d16
commit 58b6027a75
6 changed files with 6 additions and 6 deletions

View file

@ -102,7 +102,7 @@ class ActionModule(ActionBase):
result['msg'] = "src and dest are required"
return result
remote_user = task_vars.get('ansible_ssh_user') or self._play_context.remote_user
remote_user = self._play_context.remote_user
if boolean(remote_src):
result.update(self._execute_module(tmp=tmp, task_vars=task_vars))
return result

View file

@ -139,7 +139,7 @@ class ActionModule(ActionBase):
delete_remote_tmp = (len(source_files) == 1)
# If this is a recursive action create a tmp path that we can share as the _exec_module create is too late.
remote_user = task_vars.get('ansible_ssh_user') or self._play_context.remote_user
remote_user = self._play_context.remote_user
if not delete_remote_tmp:
if tmp is None or "-tmp-" not in tmp:
tmp = self._make_tmp_path(remote_user)

View file

@ -36,7 +36,7 @@ class ActionModule(ActionBase):
src = self._task.args.get('src', None)
remote_src = boolean(self._task.args.get('remote_src', 'no'))
remote_user = task_vars.get('ansible_ssh_user') or self._play_context.remote_user
remote_user = self._play_context.remote_user
if src is None:
result['failed'] = True

View file

@ -39,7 +39,7 @@ class ActionModule(ActionBase):
result['msg'] = 'check mode not supported for this module'
return result
remote_user = task_vars.get('ansible_ssh_user') or self._play_context.remote_user
remote_user = self._play_context.remote_user
if not tmp:
tmp = self._make_tmp_path(remote_user)
self._cleanup_remote_tmp = True

View file

@ -145,7 +145,7 @@ class ActionModule(ActionBase):
result['msg'] = type(e).__name__ + ": " + str(e)
return result
remote_user = task_vars.get('ansible_ssh_user') or self._play_context.remote_user
remote_user = self._play_context.remote_user
if not tmp:
tmp = self._make_tmp_path(remote_user)
self._cleanup_remote_tmp = True

View file

@ -59,7 +59,7 @@ class ActionModule(ActionBase):
result['msg'] = "src (or content) and dest are required"
return result
remote_user = task_vars.get('ansible_ssh_user') or self._play_context.remote_user
remote_user = self._play_context.remote_user
if not tmp:
tmp = self._make_tmp_path(remote_user)
self._cleanup_remote_tmp = True