From 7550c86b76cf4fc690924b649e298274ed6d239b Mon Sep 17 00:00:00 2001 From: mbushkov Date: Wed, 26 Feb 2025 14:11:53 +0100 Subject: [PATCH] Update client_build.py: fix the config check. --- .../grr_response_client_builder/client_build.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/grr/client_builder/grr_response_client_builder/client_build.py b/grr/client_builder/grr_response_client_builder/client_build.py index 7220d6ed0..323e866cc 100644 --- a/grr/client_builder/grr_response_client_builder/client_build.py +++ b/grr/client_builder/grr_response_client_builder/client_build.py @@ -423,9 +423,22 @@ def main(args): if args.subparser_name == "build": if grr_config.CONFIG.ContextApplied("Platform:Darwin"): - if not grr_config.CONFIG.Get("ClientBuilder.install_dir"): + # We know that the client builder is run on Darwin, so we can check that + # the required config options are set. But the builder config options use + # the "Target:Darwin" context, as they care about the target system that + # the template is built for, not the system that the builder is run on. + # The fact that we build macOS templates on Darwin is technically + # an implementation detail even though it is impossible to build macOS + # templates on any other platform. + if not grr_config.CONFIG.Get( + "ClientBuilder.install_dir", + context=[contexts.TARGET_DARWIN], + ): raise RuntimeError("ClientBuilder.install_dir must be set.") - if not grr_config.CONFIG.Get("ClientBuilder.fleetspeak_plist_path"): + if not grr_config.CONFIG.Get( + "ClientBuilder.fleetspeak_plist_path", + context=[contexts.TARGET_DARWIN], + ): raise RuntimeError("ClientBuilder.fleetspeak_plist_path must be set.") TemplateBuilder().BuildTemplate(context=context, output=args.output) elif args.subparser_name == "repack":