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:
François HORTA 2026-03-02 18:07:52 +01:00
parent 692b906b82
commit f059a74d44
No known key found for this signature in database
GPG key ID: ED6C1E0F36613431
8 changed files with 14 additions and 11 deletions

View file

@ -17,8 +17,6 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os.path
from ansible import constants as C
from ansible.module_utils.six import string_types
from ansible.module_utils.six.moves import shlex_quote
@ -301,8 +299,6 @@ class ActionModule(ActionBase):
break
if localhost_shell:
break
else:
localhost_shell = os.path.basename(C.DEFAULT_EXECUTABLE)
self._play_context.shell = localhost_shell
# Unlike port, there can be only one executable

View file

@ -11,7 +11,8 @@ hostvars:
asserts:
- hasattr(SAM._connection, 'ismock')
- SAM._connection.transport == 'local'
- self._play_context.shell == 'sh'
- self._play_context.shell == None
- self._play_context.executable == '/bin/sh'
- self.execute_called
- self.final_module_args['_local_rsync_path'] == 'rsync'
- self.final_module_args['src'] == '/tmp/deleteme'

View file

@ -32,7 +32,8 @@ asserts:
- self.final_module_args['dest'] == 'root@el6host:/tmp/deleteme'
- self.task.become == True
- 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_user == 'root'
- self._play_context.become == False

View file

@ -32,7 +32,8 @@ asserts:
- self.final_module_args['dest'] == 'root@el6host:/tmp/deleteme'
- self.task.become == 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_user == 'root'
- self._play_context.become == False

View file

@ -22,7 +22,8 @@ asserts:
- self.final_module_args['dest_port'] == 2202
- self.final_module_args['src'] == '/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_user == 'vagrant'
- self._play_context.become == False

View file

@ -25,7 +25,8 @@ asserts:
- self.final_module_args['dest_port'] == 2202
- self.final_module_args['src'] == '/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_user == 'vagrant'
- self._play_context.become == False

View file

@ -22,7 +22,8 @@ asserts:
- self.final_module_args['dest_port'] == 2202
- self.final_module_args['src'] == '/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_user == 'vagrant'
- self._play_context.become == False

View file

@ -18,7 +18,8 @@ task_args:
asserts:
- hasattr(SAM._connection, 'ismock')
- SAM._connection.transport == 'local'
- self._play_context.shell == 'sh'
- self._play_context.shell == None
- self._play_context.executable == '/bin/sh'
- self.execute_called
- self.final_module_args['_local_rsync_path'] == 'rsync'
- self.final_module_args['src'] == '/tmp/deleteme'