From ac17ad605af694f85416dbaac4ffab3335fe8dcf Mon Sep 17 00:00:00 2001 From: Damian Krolik Date: Mon, 3 Jun 2024 09:53:56 +0200 Subject: [PATCH] [nrfconnect] Raise error if factory data generation fails The factory data generator script would just return without an error code if any of the prerequisites is not met. Signed-off-by: Damian Krolik --- .../nrfconnect/generate_nrfconnect_chip_factory_data.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py b/scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py index 78212cefd81e6e..8c3683859abe6b 100644 --- a/scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py +++ b/scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py @@ -433,7 +433,7 @@ def _generate_onboarding_data(self): def main(): - parser = argparse.ArgumentParser(description="NrfConnect Factory Data NVS generator tool") + parser = argparse.ArgumentParser(description="nRF Connect Factory Data generator tool") def allow_any_int(i): return int(i, 0) def base64_str(s): return base64.b64decode(s) @@ -564,20 +564,20 @@ def base64_str(s): return base64.b64decode(s) if (exists(args.output + ".json") and not args.overwrite): log.error(("Output file: {} already exist, to create a new one add argument '--overwrite'. " "By default overwriting is disabled").format(args.output+".json")) - return + sys.exit(1) if args.schema and no_jsonschema_module: log.error(("Requested verification of the JSON file using jsonschema, but the module is not installed. \n" "Install only the module by invoking: pip3 install jsonschema \n" "Alternatively, install it with all dependencies for Matter by invoking: pip3 install " "-r ./scripts/setup/requirements.nrfconnect.txt from the Matter root directory.")) - return + sys.exit(1) if args.generate_onboarding and no_onboarding_modules: log.error(("Requested generation of onboarding codes, but the some modules are not installed. \n" "Install all dependencies for Matter by invoking: pip3 install " "-r ./scripts/setup/requirements.nrfconnect.txt from the Matter root directory.")) - return + sys.exit(1) generator = FactoryDataGenerator(args) generator.generate_json()