mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Make lxc.run_cmd execute in a chroot if attach does not work
This commit is contained in:
parent
899dd07aca
commit
f6afb67dd0
@ -1333,8 +1333,12 @@ def run_cmd(name, cmd, no_start=False, preserve_state=True,
|
||||
prior_state = _ensure_running(name, no_start=no_start)
|
||||
if not prior_state:
|
||||
return prior_state
|
||||
res = __salt__['cmd.run_all'](
|
||||
'lxc-attach -n \'{0}\' -- {1}'.format(name, cmd))
|
||||
if attachable(name):
|
||||
res = __salt__['cmd.run_all'](
|
||||
'lxc-attach -n \'{0}\' -- {1}'.format(name, cmd))
|
||||
else:
|
||||
rootfs = info(name).get('rootfs')
|
||||
res = __salt__['cmd.run_chroot'](rootfs, cmd)
|
||||
|
||||
if preserve_state:
|
||||
if prior_state == 'stopped':
|
||||
|
Loading…
Reference in New Issue
Block a user