copy standard cmd.run* kwargs into cmd.run_chroot

Fixes #23153.
This commit is contained in:
Justin Findlay 2015-04-29 12:21:35 -06:00
parent 168508ec2a
commit 7dc3417b44

View file

@ -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):