SdkService/BuildPrebuilts: Expect to run in chroot
I just merged a proto change (https://crrev.com/c/4866772) that will
cause this endpoint to always run inside the chroot. Let's make it start
acting like it.
BUG=b:300321083
TEST=./run_tests
TEST=call the endpoint from outside the chroot
Change-Id: Ib66d865afdc8596a415557e4ae651aeff9ad37ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4866950
Tested-by: Greg Edelston <gredelston@google.com>
Reviewed-by: Anuj Jamwal <anujjamwal@google.com>
Commit-Queue: Greg Edelston <gredelston@google.com>
diff --git a/api/controller/sdk.py b/api/controller/sdk.py
index 8417dfa..31e5af2 100644
--- a/api/controller/sdk.py
+++ b/api/controller/sdk.py
@@ -270,9 +270,14 @@
@faux.all_empty
@validate.validation_complete
def BuildPrebuilts(input_proto, _output_proto, _config):
- """Build the binary packages that comprise the Chromium OS SDK."""
- chroot = controller_util.ParseChroot(input_proto.chroot)
- sdk.BuildPrebuilts(chroot, board=input_proto.build_target.name)
+ """Build the binary packages that comprise the Chromium OS SDK.
+
+ Raises:
+ cros_build_lib.Die: If called from outside the chroot. The RPC proto
+ definition guarantees that it should run inside.
+ """
+ cros_build_lib.AssertInsideChroot()
+ sdk.BuildPrebuilts(board=input_proto.build_target.name)
@faux.success(_BinhostCLs)