mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Establish sh as the default shell plugin.
This is a fix for one of the problems pointed out in #14176
This commit is contained in:
parent
a584ab3420
commit
5b1d8cfd5c
5 changed files with 30 additions and 1 deletions
|
@ -83,7 +83,12 @@ class ConnectionBase(with_metaclass(ABCMeta, object)):
|
|||
elif hasattr(self, '_shell_type'):
|
||||
shell_type = getattr(self, '_shell_type')
|
||||
else:
|
||||
shell_type = os.path.basename(C.DEFAULT_EXECUTABLE)
|
||||
shell_type = 'sh'
|
||||
shell_filename = os.path.basename(C.DEFAULT_EXECUTABLE)
|
||||
for shell in shell_loader.all():
|
||||
if shell_filename in shell.COMPATIBLE_SHELLS:
|
||||
shell_type = shell.SHELL_FAMILY
|
||||
break
|
||||
|
||||
self._shell = shell_loader.get(shell_type)
|
||||
if not self._shell:
|
||||
|
|
|
@ -21,6 +21,11 @@ from ansible.plugins.shell.sh import ShellModule as ShModule
|
|||
|
||||
class ShellModule(ShModule):
|
||||
|
||||
# Common shell filenames that this plugin handles
|
||||
COMPATIBLE_SHELLS = frozenset(('csh', 'tcsh'))
|
||||
# Family of shells this has. Must match the filename without extension
|
||||
SHELL_FAMILY = 'csh'
|
||||
|
||||
# How to end lines in a python script one-liner
|
||||
_SHELL_EMBEDDED_PY_EOL = '\\\n'
|
||||
_SHELL_REDIRECT_ALLNULL = '>& /dev/null'
|
||||
|
|
|
@ -21,6 +21,11 @@ from ansible.plugins.shell.sh import ShellModule as ShModule
|
|||
|
||||
class ShellModule(ShModule):
|
||||
|
||||
# Common shell filenames that this plugin handles
|
||||
COMPATIBLE_SHELLS = frozenset(('fish',))
|
||||
# Family of shells this has. Must match the filename without extension
|
||||
SHELL_FAMILY = 'fish'
|
||||
|
||||
_SHELL_AND = '; and'
|
||||
_SHELL_OR = '; or'
|
||||
_SHELL_SUB_LEFT = '('
|
||||
|
|
|
@ -36,6 +36,13 @@ if _powershell_version:
|
|||
|
||||
class ShellModule(object):
|
||||
|
||||
# Common shell filenames that this plugin handles
|
||||
# Powershell is handled differently. It's selected when winrm is the
|
||||
# connection
|
||||
COMPATIBLE_SHELLS = frozenset()
|
||||
# Family of shells this has. Must match the filename without extension
|
||||
SHELL_FAMILY = 'powershell'
|
||||
|
||||
def env_prefix(self, **kwargs):
|
||||
return ''
|
||||
|
||||
|
|
|
@ -30,6 +30,13 @@ _USER_HOME_PATH_RE = re.compile(r'^~[_.A-Za-z0-9][-_.A-Za-z0-9]*$')
|
|||
|
||||
class ShellModule(object):
|
||||
|
||||
# Common shell filenames that this plugin handles.
|
||||
# Note: sh is the default shell plugin so this plugin may also be selected
|
||||
# if the filename is not listed in any Shell plugin.
|
||||
COMPATIBLE_SHELLS = frozenset(('sh', 'zsh', 'bash', 'dash', 'ksh'))
|
||||
# Family of shells this has. Must match the filename without extension
|
||||
SHELL_FAMILY = 'sh'
|
||||
|
||||
# How to end lines in a python script one-liner
|
||||
_SHELL_EMBEDDED_PY_EOL = '\n'
|
||||
_SHELL_REDIRECT_ALLNULL = '> /dev/null 2>&1'
|
||||
|
|
Loading…
Reference in a new issue