mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-03-08 02:25:20 +01:00
Remove shell override in synchronize action plugin
Setting the shell from the executable basename is technically wrong, Ansible will determine the right shell to use on its own so setting it to None is safer
This commit is contained in:
parent
692b906b82
commit
f059a74d44
8 changed files with 14 additions and 11 deletions
|
|
@ -17,8 +17,6 @@
|
||||||
from __future__ import (absolute_import, division, print_function)
|
from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
import os.path
|
|
||||||
|
|
||||||
from ansible import constants as C
|
from ansible import constants as C
|
||||||
from ansible.module_utils.six import string_types
|
from ansible.module_utils.six import string_types
|
||||||
from ansible.module_utils.six.moves import shlex_quote
|
from ansible.module_utils.six.moves import shlex_quote
|
||||||
|
|
@ -301,8 +299,6 @@ class ActionModule(ActionBase):
|
||||||
break
|
break
|
||||||
if localhost_shell:
|
if localhost_shell:
|
||||||
break
|
break
|
||||||
else:
|
|
||||||
localhost_shell = os.path.basename(C.DEFAULT_EXECUTABLE)
|
|
||||||
self._play_context.shell = localhost_shell
|
self._play_context.shell = localhost_shell
|
||||||
|
|
||||||
# Unlike port, there can be only one executable
|
# Unlike port, there can be only one executable
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ hostvars:
|
||||||
asserts:
|
asserts:
|
||||||
- hasattr(SAM._connection, 'ismock')
|
- hasattr(SAM._connection, 'ismock')
|
||||||
- SAM._connection.transport == 'local'
|
- SAM._connection.transport == 'local'
|
||||||
- self._play_context.shell == 'sh'
|
- self._play_context.shell == None
|
||||||
|
- self._play_context.executable == '/bin/sh'
|
||||||
- self.execute_called
|
- self.execute_called
|
||||||
- self.final_module_args['_local_rsync_path'] == 'rsync'
|
- self.final_module_args['_local_rsync_path'] == 'rsync'
|
||||||
- self.final_module_args['src'] == '/tmp/deleteme'
|
- self.final_module_args['src'] == '/tmp/deleteme'
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,8 @@ asserts:
|
||||||
- self.final_module_args['dest'] == 'root@el6host:/tmp/deleteme'
|
- self.final_module_args['dest'] == 'root@el6host:/tmp/deleteme'
|
||||||
- self.task.become == True
|
- self.task.become == True
|
||||||
- self.task.become_user == None
|
- self.task.become_user == None
|
||||||
- self._play_context.shell == 'sh'
|
- self._play_context.shell == None
|
||||||
|
- self._play_context.executable == '/bin/sh'
|
||||||
- self._play_context.remote_addr == 'el6host'
|
- self._play_context.remote_addr == 'el6host'
|
||||||
- self._play_context.remote_user == 'root'
|
- self._play_context.remote_user == 'root'
|
||||||
- self._play_context.become == False
|
- self._play_context.become == False
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,8 @@ asserts:
|
||||||
- self.final_module_args['dest'] == 'root@el6host:/tmp/deleteme'
|
- self.final_module_args['dest'] == 'root@el6host:/tmp/deleteme'
|
||||||
- self.task.become == None
|
- self.task.become == None
|
||||||
- self.task.become_user == None
|
- self.task.become_user == None
|
||||||
- self._play_context.shell == 'sh'
|
- self._play_context.shell == None
|
||||||
|
- self._play_context.executable == '/bin/sh'
|
||||||
- self._play_context.remote_addr == 'el6host'
|
- self._play_context.remote_addr == 'el6host'
|
||||||
- self._play_context.remote_user == 'root'
|
- self._play_context.remote_user == 'root'
|
||||||
- self._play_context.become == False
|
- self._play_context.become == False
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,8 @@ asserts:
|
||||||
- self.final_module_args['dest_port'] == 2202
|
- self.final_module_args['dest_port'] == 2202
|
||||||
- self.final_module_args['src'] == '/tmp/deleteme'
|
- self.final_module_args['src'] == '/tmp/deleteme'
|
||||||
- self.final_module_args['dest'] == 'vagrant@127.0.0.1:/tmp/deleteme'
|
- self.final_module_args['dest'] == 'vagrant@127.0.0.1:/tmp/deleteme'
|
||||||
- self._play_context.shell == 'sh'
|
- self._play_context.shell == None
|
||||||
|
- self._play_context.executable == '/bin/sh'
|
||||||
- self._play_context.remote_addr == '127.0.0.1'
|
- self._play_context.remote_addr == '127.0.0.1'
|
||||||
- self._play_context.remote_user == 'vagrant'
|
- self._play_context.remote_user == 'vagrant'
|
||||||
- self._play_context.become == False
|
- self._play_context.become == False
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,8 @@ asserts:
|
||||||
- self.final_module_args['dest_port'] == 2202
|
- self.final_module_args['dest_port'] == 2202
|
||||||
- self.final_module_args['src'] == '/tmp/deleteme'
|
- self.final_module_args['src'] == '/tmp/deleteme'
|
||||||
- self.final_module_args['dest'] == 'vagrant@127.0.0.1:/tmp/deleteme'
|
- self.final_module_args['dest'] == 'vagrant@127.0.0.1:/tmp/deleteme'
|
||||||
- self._play_context.shell == 'sh'
|
- self._play_context.shell == None
|
||||||
|
- self._play_context.executable == '/bin/sh'
|
||||||
- self._play_context.remote_addr == '127.0.0.1'
|
- self._play_context.remote_addr == '127.0.0.1'
|
||||||
- self._play_context.remote_user == 'vagrant'
|
- self._play_context.remote_user == 'vagrant'
|
||||||
- self._play_context.become == False
|
- self._play_context.become == False
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,8 @@ asserts:
|
||||||
- self.final_module_args['dest_port'] == 2202
|
- self.final_module_args['dest_port'] == 2202
|
||||||
- self.final_module_args['src'] == '/tmp/deleteme'
|
- self.final_module_args['src'] == '/tmp/deleteme'
|
||||||
- self.final_module_args['dest'] == 'vagrant@127.0.0.1:/tmp/deleteme'
|
- self.final_module_args['dest'] == 'vagrant@127.0.0.1:/tmp/deleteme'
|
||||||
- self._play_context.shell == 'sh'
|
- self._play_context.shell == None
|
||||||
|
- self._play_context.executable == '/bin/sh'
|
||||||
- self._play_context.remote_addr == '127.0.0.1'
|
- self._play_context.remote_addr == '127.0.0.1'
|
||||||
- self._play_context.remote_user == 'vagrant'
|
- self._play_context.remote_user == 'vagrant'
|
||||||
- self._play_context.become == False
|
- self._play_context.become == False
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@ task_args:
|
||||||
asserts:
|
asserts:
|
||||||
- hasattr(SAM._connection, 'ismock')
|
- hasattr(SAM._connection, 'ismock')
|
||||||
- SAM._connection.transport == 'local'
|
- SAM._connection.transport == 'local'
|
||||||
- self._play_context.shell == 'sh'
|
- self._play_context.shell == None
|
||||||
|
- self._play_context.executable == '/bin/sh'
|
||||||
- self.execute_called
|
- self.execute_called
|
||||||
- self.final_module_args['_local_rsync_path'] == 'rsync'
|
- self.final_module_args['_local_rsync_path'] == 'rsync'
|
||||||
- self.final_module_args['src'] == '/tmp/deleteme'
|
- self.final_module_args['src'] == '/tmp/deleteme'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue