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/02/18 08:26:15 UTC

[GitHub] [buildstream] gtristan commented on a change in pull request #1436: Create a dummy sandbox when the sandbox config can't be satisfied

gtristan commented on a change in pull request #1436:
URL: https://github.com/apache/buildstream/pull/1436#discussion_r809770744



##########
File path: src/buildstream/_platform/platform.py
##########
@@ -159,44 +161,16 @@ def get_host_arch():
     #     (Sandbox) A sandbox
     #
     def create_sandbox(self, *args, **kwargs):  # pylint: disable=method-hidden
-        raise ImplError("Platform {platform} does not implement create_sandbox()".format(platform=type(self).__name__))
-
-    def check_sandbox_config(self, config):  # pylint: disable=method-hidden
-        raise ImplError(
-            "Platform {platform} does not implement check_sandbox_config()".format(platform=type(self).__name__)
-        )
-
-    # Buildbox run sandbox methods
-    def _check_sandbox_config_buildboxrun(self, config):
-        from ..sandbox._sandboxbuildboxrun import SandboxBuildBoxRun  # pylint: disable=cyclic-import
-
-        SandboxBuildBoxRun.check_sandbox_config(self, config)
-
-    @staticmethod
-    def _create_buildboxrun_sandbox(*args, **kwargs):
         from ..sandbox._sandboxbuildboxrun import SandboxBuildBoxRun  # pylint: disable=cyclic-import
 
-        return SandboxBuildBoxRun(*args, **kwargs)
-
-    def _setup_buildboxrun_sandbox(self):
-        from ..sandbox._sandboxbuildboxrun import SandboxBuildBoxRun  # pylint: disable=cyclic-import
-
-        self._check_sandbox(SandboxBuildBoxRun)
-        self.check_sandbox_config = self._check_sandbox_config_buildboxrun
-        self.create_sandbox = self._create_buildboxrun_sandbox
-        return True
-
-    # Dummy sandbox methods
-    @staticmethod
-    def _check_dummy_sandbox_config(config):
-        pass
+        if self.dummy_reasons:
+            dummy_reasons = " and ".join(self.dummy_reasons)
+        else:
+            try:
+                SandboxBuildBoxRun.check_sandbox_config(kwargs['config'])
+                return SandboxBuildBoxRun(*args, **kwargs)
+            except SandboxError as e:
+                dummy_reasons = e.message

Review comment:
       Yup, even if this is simply stylistic (it *might* be `e.message` ?), I agree we should use `str(e)` here for consistency.
   




-- 
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