You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by GitBox <gi...@apache.org> on 2022/08/31 17:24:03 UTC

[GitHub] [buildstream] abderrahim commented on a diff in pull request #1746: Fail early if `buildbox-run` is present but non-functional

abderrahim commented on code in PR #1746:
URL: https://github.com/apache/buildstream/pull/1746#discussion_r959841234


##########
src/buildstream/_platform/platform.py:
##########
@@ -44,16 +44,16 @@ def _setup_sandbox(self):
         # Try to setup buildbox-run sandbox, otherwise fallback to the dummy sandbox.
         try:
             self._check_sandbox(SandboxBuildBoxRun)
-        except (SandboxError, utils.ProgramNotFoundError):
+        except (SandboxUnsupportedError, utils.ProgramNotFoundError):
             pass
 
     def _check_sandbox(self, Sandbox):
         Sandbox._dummy_reasons = []
         try:
             Sandbox.check_available()
-        except SandboxError as Error:
+        except SandboxUnsupportedError as Error:

Review Comment:
   The reason I didn't modify it in #1436 is that I wanted to have it backportable to bst-1 (but turns out bst-1 didn't have a dummy sandbox at all, so whatever).
   
   There are actually two different checks `Sandox.check_available()` and `Sandbox._check_sandbox_config()` (is there a reason why the former is "public"?) and we want to cache the result of the former. That's essentially why dummy_reasons exist.
   
   What I would recommend is to do the caching in the `Sandbox` class itself, such that calling `_check_sandbox_config()` will raise the newly introduced `SandboxUnsupportedError` if buildbox-run isn't available before actually checking the config (and possibly drop `Sandox.check_available()` altogether if it's not needed for your new check?)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org