diff options
author | knownexus <phillip.smyth@codethink.co.uk> | 2018-08-30 11:56:23 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2018-09-27 10:49:12 +0100 |
commit | cc7197f462f7f4ecdfc2ec65215256ecffd1bfee (patch) | |
tree | 3bfe34b1f1be16cb203dcedd800320f4764afe1a | |
parent | da73f1077585ab18c804ca8975d35499433fabc3 (diff) | |
download | buildstream-cc7197f462f7f4ecdfc2ec65215256ecffd1bfee.tar.gz |
Added FUSE check, as WSL does not support FUSE yet
_platform/linux.py: Add FUSE check
And Ensure exception is not raised when performing sandbox availability check
Without this check, WSL would error upon finding FUSE missing
This must be bypassed to allow remote execution
-rw-r--r-- | buildstream/_platform/linux.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/buildstream/_platform/linux.py b/buildstream/_platform/linux.py index 7af1a2283..2763259c8 100644 --- a/buildstream/_platform/linux.py +++ b/buildstream/_platform/linux.py @@ -38,7 +38,11 @@ class Linux(Platform): self._gid = os.getegid() self._die_with_parent_available = _site.check_bwrap_version(0, 1, 8) - self._user_ns_available = self._check_user_ns_available() + + if self._local_sandbox_available(): + self._user_ns_available = self._check_user_ns_available() + else: + self._user_ns_available = False def create_sandbox(self, *args, **kwargs): # Inform the bubblewrap sandbox as to whether it can use user namespaces or not @@ -58,8 +62,13 @@ class Linux(Platform): ################################################ # Private Methods # ################################################ - def _check_user_ns_available(self): + def _local_sandbox_available(self): + try: + return os.path.exists(utils.get_host_tool('bwrap')) and os.path.exists('/dev/fuse') + except utils.ProgramNotFoundError: + return False + def _check_user_ns_available(self): # Here, lets check if bwrap is able to create user namespaces, # issue a warning if it's not available, and save the state # locally so that we can inform the sandbox to not try it |