mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
commit
615921b619
@ -251,7 +251,9 @@ def _get_upgradable():
|
||||
'''
|
||||
|
||||
cmd = 'emerge --pretend --update --newuse --deep --ask n world'
|
||||
out = __salt__['cmd.run_stdout'](cmd, output_loglevel='trace')
|
||||
out = __salt__['cmd.run_stdout'](cmd,
|
||||
output_loglevel='trace',
|
||||
python_shell=False)
|
||||
|
||||
rexp = re.compile(r'(?m)^\[.+\] '
|
||||
r'([^ ]+/[^ ]+)' # Package string
|
||||
@ -388,16 +390,17 @@ def refresh_db():
|
||||
# We prefer 'delta-webrsync' to 'webrsync'
|
||||
if salt.utils.which('emerge-delta-webrsync'):
|
||||
cmd = 'emerge-delta-webrsync -q'
|
||||
return __salt__['cmd.retcode'](cmd) == 0
|
||||
return __salt__['cmd.retcode'](cmd, python_shell=False) == 0
|
||||
else:
|
||||
if __salt__['cmd.retcode']('emerge --sync --ask n --quiet') == 0:
|
||||
if __salt__['cmd.retcode']('emerge --sync --ask n --quiet',
|
||||
python_shell=False) == 0:
|
||||
return True
|
||||
# We fall back to "webrsync" if "rsync" fails for some reason
|
||||
cmd = 'emerge-webrsync -q'
|
||||
# We prefer 'delta-webrsync' to 'webrsync'
|
||||
if salt.utils.which('emerge-delta-webrsync'):
|
||||
cmd = 'emerge-delta-webrsync -q'
|
||||
return __salt__['cmd.retcode'](cmd) == 0
|
||||
return __salt__['cmd.retcode'](cmd, python_shell=False) == 0
|
||||
|
||||
|
||||
def install(name=None,
|
||||
@ -585,7 +588,9 @@ def install(name=None,
|
||||
cmd = 'emerge --quiet --ask n {0} {1}'.format(emerge_opts, ' '.join(targets))
|
||||
|
||||
old = list_pkgs()
|
||||
call = __salt__['cmd.run_all'](cmd, output_loglevel='trace')
|
||||
call = __salt__['cmd.run_all'](cmd,
|
||||
output_loglevel='trace',
|
||||
python_shell=False)
|
||||
__context__.pop('pkg.list_pkgs', None)
|
||||
if call['retcode'] != 0:
|
||||
return _process_emerge_err(call['stdout'], call['stderr'])
|
||||
@ -630,7 +635,9 @@ def update(pkg, slot=None, fromrepo=None, refresh=False):
|
||||
|
||||
old = list_pkgs()
|
||||
cmd = 'emerge --update --newuse --oneshot --ask n --quiet {0}'.format(full_atom)
|
||||
call = __salt__['cmd.run_all'](cmd, output_loglevel='trace')
|
||||
call = __salt__['cmd.run_all'](cmd,
|
||||
output_loglevel='trace',
|
||||
python_shell=False)
|
||||
__context__.pop('pkg.list_pkgs', None)
|
||||
if call['retcode'] != 0:
|
||||
return _process_emerge_err(call['stdout'], call['stderr'])
|
||||
@ -658,7 +665,9 @@ def upgrade(refresh=True):
|
||||
|
||||
old = list_pkgs()
|
||||
cmd = 'emerge --update --newuse --deep --ask n --quiet world'
|
||||
call = __salt__['cmd.run_all'](cmd, output_loglevel='trace')
|
||||
call = __salt__['cmd.run_all'](cmd,
|
||||
output_loglevel='trace',
|
||||
python_shell=False)
|
||||
__context__.pop('pkg.list_pkgs', None)
|
||||
if call['retcode'] != 0:
|
||||
return _process_emerge_err(call['stdout'], call['stderr'])
|
||||
@ -718,7 +727,9 @@ def remove(name=None, slot=None, fromrepo=None, pkgs=None, **kwargs):
|
||||
return {}
|
||||
cmd = 'emerge --unmerge --quiet --quiet-unmerge-warn --ask n ' \
|
||||
'{0}'.format(' '.join(targets))
|
||||
__salt__['cmd.run_all'](cmd, output_loglevel='trace')
|
||||
__salt__['cmd.run_all'](cmd,
|
||||
output_loglevel='trace',
|
||||
python_shell=False)
|
||||
__context__.pop('pkg.list_pkgs', None)
|
||||
new = list_pkgs()
|
||||
return salt.utils.compare_dicts(old, new)
|
||||
@ -807,7 +818,9 @@ def depclean(name=None, slot=None, fromrepo=None, pkgs=None):
|
||||
targets = [x for x in pkg_params if x in old]
|
||||
|
||||
cmd = 'emerge --depclean --ask n --quiet {0}'.format(' '.join(targets))
|
||||
__salt__['cmd.run_all'](cmd, output_loglevel='trace')
|
||||
__salt__['cmd.run_all'](cmd,
|
||||
output_loglevel='trace',
|
||||
python_shell=False)
|
||||
__context__.pop('pkg.list_pkgs', None)
|
||||
new = list_pkgs()
|
||||
return salt.utils.compare_dicts(old, new)
|
||||
|
@ -59,8 +59,8 @@ def exec_action(module, action, module_parameter=None, action_parameter=None, pa
|
||||
action_parameter = parameter
|
||||
out = __salt__['cmd.run'](
|
||||
'eselect --brief --colour=no {0} {1} {2} {3}'.format(
|
||||
module, module_parameter or '', action, action_parameter or ''
|
||||
)
|
||||
module, module_parameter or '', action, action_parameter or ''),
|
||||
python_shell=False
|
||||
)
|
||||
out = out.strip().split('\n')
|
||||
|
||||
|
@ -731,7 +731,7 @@ def sed(path,
|
||||
)
|
||||
)
|
||||
|
||||
return __salt__['cmd.run_all'](cmd)
|
||||
return __salt__['cmd.run_all'](cmd, python_shell=False)
|
||||
|
||||
|
||||
def sed_contains(path,
|
||||
@ -771,7 +771,7 @@ def sed_contains(path,
|
||||
flags='p{0}'.format(flags),
|
||||
path=path)
|
||||
|
||||
result = __salt__['cmd.run'](cmd)
|
||||
result = __salt__['cmd.run'](cmd, python_shell=False)
|
||||
|
||||
return bool(result)
|
||||
|
||||
@ -1479,7 +1479,7 @@ def patch(originalfile, patchfile, options='', dry_run=False):
|
||||
dry_run_opt = ''
|
||||
cmd = 'patch {0}{1} "{2}" "{3}"'.format(
|
||||
options, dry_run_opt, originalfile, patchfile)
|
||||
return __salt__['cmd.run_all'](cmd)
|
||||
return __salt__['cmd.run_all'](cmd, python_shell=False)
|
||||
|
||||
|
||||
def contains(path, text):
|
||||
@ -2325,7 +2325,7 @@ def restorecon(path, recursive=False):
|
||||
cmd = 'restorecon -FR {0}'.format(path)
|
||||
else:
|
||||
cmd = 'restorecon -F {0}'.format(path)
|
||||
return not __salt__['cmd.retcode'](cmd)
|
||||
return not __salt__['cmd.retcode'](cmd, python_shell=False)
|
||||
|
||||
|
||||
def get_selinux_context(path):
|
||||
@ -2338,7 +2338,7 @@ def get_selinux_context(path):
|
||||
|
||||
salt '*' file.get_selinux_context /etc/hosts
|
||||
'''
|
||||
out = __salt__['cmd.run']('ls -Z {0}'.format(path))
|
||||
out = __salt__['cmd.run']('ls -Z {0}'.format(path), python_shell=False)
|
||||
|
||||
try:
|
||||
ret = re.search(r'\w+:\w+:\w+:\w+', out).group(0)
|
||||
@ -2376,7 +2376,7 @@ def set_selinux_context(path,
|
||||
cmd += '-l {0} '.format(range)
|
||||
|
||||
cmd += path
|
||||
ret = not __salt__['cmd.retcode'](cmd)
|
||||
ret = not __salt__['cmd.retcode'](cmd, python_shell=False)
|
||||
if ret:
|
||||
return get_selinux_context(path)
|
||||
else:
|
||||
@ -3957,7 +3957,7 @@ def grep(path,
|
||||
)
|
||||
|
||||
try:
|
||||
ret = __salt__['cmd.run_all'](cmd)
|
||||
ret = __salt__['cmd.run_all'](cmd, python_shell=False)
|
||||
except (IOError, OSError) as exc:
|
||||
raise CommandExecutionError(exc.strerror)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user