mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
parent
168508ec2a
commit
7dc3417b44
1 changed files with 42 additions and 6 deletions
|
@ -1297,7 +1297,26 @@ def tty(device, echo=None):
|
|||
}
|
||||
|
||||
|
||||
def run_chroot(root, cmd):
|
||||
def run_chroot(root,
|
||||
cmd,
|
||||
cwd=None,
|
||||
stdin=None,
|
||||
runas=None,
|
||||
shell=DEFAULT_SHELL,
|
||||
python_shell=True,
|
||||
env=None,
|
||||
clean_env=False,
|
||||
template=None,
|
||||
rstrip=True,
|
||||
umask=None,
|
||||
output_loglevel='quiet',
|
||||
quiet=False,
|
||||
timeout=None,
|
||||
reset_system_locale=True,
|
||||
ignore_retcode=False,
|
||||
saltenv='base',
|
||||
use_vt=False,
|
||||
**kwargs):
|
||||
'''
|
||||
.. versionadded:: 2014.7.0
|
||||
|
||||
|
@ -1324,11 +1343,28 @@ def run_chroot(root, cmd):
|
|||
if os.path.isfile(os.path.join(root, 'bin/bash')):
|
||||
sh_ = '/bin/bash'
|
||||
|
||||
cmd = 'chroot {0} {1} -c {2!r}'.format(
|
||||
root,
|
||||
sh_,
|
||||
cmd)
|
||||
res = run_all(cmd, output_loglevel='quiet')
|
||||
if isinstance(cmd, (list, tuple)):
|
||||
cmd = ' '.join([str(i) for i in cmd])
|
||||
cmd = 'chroot {0} {1} -c {2!r}'.format(root, sh_, cmd)
|
||||
|
||||
res = run_all(cmd,
|
||||
runas=runas,
|
||||
cwd=cwd,
|
||||
stdin=stdin,
|
||||
shell=shell,
|
||||
python_shell=python_shell,
|
||||
env=env,
|
||||
clean_env=clean_env,
|
||||
template=template,
|
||||
rstrip=rstrip,
|
||||
umask=umask,
|
||||
output_loglevel=output_loglevel,
|
||||
quiet=quiet,
|
||||
timeout=timeout,
|
||||
reset_system_locale=reset_system_locale,
|
||||
ignore_retcode=ignore_retcode,
|
||||
saltenv=saltenv,
|
||||
use_vt=use_vt)
|
||||
|
||||
# Kill processes running in the chroot
|
||||
for i in range(6):
|
||||
|
|
Loading…
Add table
Reference in a new issue