2014-11-14 22:14:08 +00:00
|
|
|
# (c) 2014, Chris Church <chris@ninemoreminutes.com>
|
2014-10-15 22:35:16 +00:00
|
|
|
#
|
2014-11-14 22:14:08 +00:00
|
|
|
# This file is part of Ansible.
|
2014-10-15 22:35:16 +00:00
|
|
|
#
|
|
|
|
# Ansible is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# Ansible is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
2015-04-13 20:28:01 +00:00
|
|
|
from __future__ import (absolute_import, division, print_function)
|
|
|
|
__metaclass__ = type
|
2014-10-15 23:25:48 +00:00
|
|
|
|
2016-02-05 05:39:09 +00:00
|
|
|
from ansible.plugins.shell import ShellBase
|
2014-10-15 23:25:48 +00:00
|
|
|
|
2017-06-02 11:14:11 +00:00
|
|
|
|
2016-02-05 05:39:09 +00:00
|
|
|
class ShellModule(ShellBase):
|
2014-11-14 22:14:08 +00:00
|
|
|
|
2016-02-02 19:46:09 +00:00
|
|
|
# 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'
|
|
|
|
|
2015-03-03 00:08:08 +00:00
|
|
|
# How to end lines in a python script one-liner
|
|
|
|
_SHELL_EMBEDDED_PY_EOL = '\\\n'
|
2015-08-30 21:48:09 +00:00
|
|
|
_SHELL_REDIRECT_ALLNULL = '>& /dev/null'
|
2016-02-05 05:39:09 +00:00
|
|
|
_SHELL_AND = '&&'
|
|
|
|
_SHELL_OR = '||'
|
2015-12-12 21:10:18 +00:00
|
|
|
_SHELL_SUB_LEFT = '"`'
|
|
|
|
_SHELL_SUB_RIGHT = '`"'
|
2016-02-05 05:39:09 +00:00
|
|
|
_SHELL_GROUP_LEFT = '('
|
|
|
|
_SHELL_GROUP_RIGHT = ')'
|
2015-03-03 00:08:08 +00:00
|
|
|
|
2014-11-14 22:14:08 +00:00
|
|
|
def env_prefix(self, **kwargs):
|
|
|
|
return 'env %s' % super(ShellModule, self).env_prefix(**kwargs)
|