mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
cmdmod: add sysfs into the chroot
Some commands executed inside the chroot require access to the /sys
information. For example, /sys/firmware is used to get to information
from UEFI systems.
This patch mount a sysfs file system inside the chroot.
Also normalize the name for devtmpfs, replacing the old udev one.
(cherry picked from commit 2b5d45ac99
)
This commit is contained in:
parent
d4b90933ac
commit
9193106c50
1 changed files with 6 additions and 1 deletions
|
@ -3035,12 +3035,16 @@ def run_chroot(root,
|
|||
'''
|
||||
__salt__['mount.mount'](
|
||||
os.path.join(root, 'dev'),
|
||||
'udev',
|
||||
'devtmpfs',
|
||||
fstype='devtmpfs')
|
||||
__salt__['mount.mount'](
|
||||
os.path.join(root, 'proc'),
|
||||
'proc',
|
||||
fstype='proc')
|
||||
__salt__['mount.mount'](
|
||||
os.path.join(root, 'sys'),
|
||||
'sysfs',
|
||||
fstype='sysfs')
|
||||
|
||||
# Execute chroot routine
|
||||
sh_ = '/bin/sh'
|
||||
|
@ -3092,6 +3096,7 @@ def run_chroot(root,
|
|||
log.error('Processes running in chroot could not be killed, '
|
||||
'filesystem will remain mounted')
|
||||
|
||||
__salt__['mount.umount'](os.path.join(root, 'sys'))
|
||||
__salt__['mount.umount'](os.path.join(root, 'proc'))
|
||||
__salt__['mount.umount'](os.path.join(root, 'dev'))
|
||||
if hide_output:
|
||||
|
|
Loading…
Add table
Reference in a new issue