Bindmount /etc/lsb-release into bubblewrap
Things like pip use lsb_release, so it is helpful to include this in bubblewrap. This conditionally includes similar files on both debuntu and fedora. Change-Id: Ibfed3ace26163da6484966e348e757f7268811f0 Signed-off-by: Paul Belanger <pabelanger@redhat.com> Co-Authored-By: James E. Blair <jeblair@redhat.com>
This commit is contained in:
parent
8316762e1d
commit
5d993ed71d
|
@ -22,6 +22,7 @@ import pwd
|
|||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
import re
|
||||
|
||||
from typing import Dict, List # flake8: noqa
|
||||
|
||||
|
@ -73,6 +74,7 @@ class BubblewrapDriver(Driver, WrapperInterface):
|
|||
log = logging.getLogger("zuul.BubblewrapDriver")
|
||||
|
||||
mounts_map = {'rw': [], 'ro': []} # type: Dict[str, List]
|
||||
release_file_re = re.compile('^\W+-release$')
|
||||
|
||||
def __init__(self):
|
||||
self.bwrap_command = self._bwrap_command()
|
||||
|
@ -170,11 +172,16 @@ class BubblewrapDriver(Driver, WrapperInterface):
|
|||
'--file', '{gid_fd}', '/etc/group',
|
||||
]
|
||||
|
||||
if os.path.isdir('/lib64'):
|
||||
bwrap_command.extend(['--ro-bind', '/lib64', '/lib64'])
|
||||
if os.path.isfile('/etc/nsswitch.conf'):
|
||||
bwrap_command.extend(['--ro-bind', '/etc/nsswitch.conf',
|
||||
'/etc/nsswitch.conf'])
|
||||
for path in ['/lib64',
|
||||
'/etc/nsswitch.conf',
|
||||
'/etc/lsb-release.d',
|
||||
]:
|
||||
if os.path.exists(path):
|
||||
bwrap_command.extend(['--ro-bind', path, path])
|
||||
for fn in os.listdir('/etc'):
|
||||
if self.release_file_re.match(fn):
|
||||
path = os.path.join('/etc', fn)
|
||||
bwrap_command.extend(['--ro-bind', path, path])
|
||||
|
||||
return bwrap_command
|
||||
|
||||
|
|
Loading…
Reference in New Issue