Merge pull request #1257 from jhutchins/choose_shell

Use shell grain as default in modules/cmdmod.py
This commit is contained in:
Jeff Schroeder 2012-05-11 05:31:32 -07:00
commit a97c97d217
3 changed files with 15 additions and 13 deletions

View File

@ -544,17 +544,6 @@ def saltversion():
from salt import __version__
return {'saltversion': __version__}
def shell():
'''
Return the default shell to use on this system
'''
# Provides:
# shell
ret = {'shell': '/bin/sh'}
if 'SHELL' in os.environ:
ret['shell'] = os.environ['SHELL']
return ret
# Relatively complex mini-algorithm to iterate over the various
# sections of dmidecode output and return matches for specific
# lines containing data we want, but only in the right section.

13
salt/grains/extra.py Normal file
View File

@ -0,0 +1,13 @@
import os
def shell():
'''
Return the default shell to use on this system
'''
# Provides:
# shell
ret = {'shell': '/bin/sh'}
if 'SHELL' in os.environ:
ret['shell'] = os.environ['SHELL']
return ret

View File

@ -11,6 +11,7 @@ import subprocess
import tempfile
import salt.utils
from salt.exceptions import CommandExecutionError
from salt.grains.extra import shell as shell_grain
# Only available on posix systems, nonfatal on windows
try:
@ -27,8 +28,7 @@ __outputter__ = {
'run': 'txt',
}
DEFAULT_SHELL = '/bin/sh'
DEFAULT_SHELL = shell_grain()['shell']
def __virtual__():
'''