summaryrefslogtreecommitdiff
path: root/zuul/driver/bubblewrap
diff options
context:
space:
mode:
authorPaul Belanger <pabelanger@redhat.com>2017-08-02 16:48:36 -0400
committerJames E. Blair <jeblair@redhat.com>2017-08-10 16:45:31 -0700
commit5d993ed71d6f02169fc7c44b5a82c231d531a419 (patch)
treed82d3a5e8182119ca2d95a2b9173db24baa90948 /zuul/driver/bubblewrap
parent8316762e1de357d8e51333e1ae0f870c0a392a71 (diff)
downloadzuul-5d993ed71d6f02169fc7c44b5a82c231d531a419.tar.gz
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>
Diffstat (limited to 'zuul/driver/bubblewrap')
-rw-r--r--zuul/driver/bubblewrap/__init__.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/zuul/driver/bubblewrap/__init__.py b/zuul/driver/bubblewrap/__init__.py
index ace5b009f..cbaa6099d 100644
--- a/zuul/driver/bubblewrap/__init__.py
+++ b/zuul/driver/bubblewrap/__init__.py
@@ -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