Skip to content

Commit ac17ad6

Browse files
committed
[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 <damian.krolik@nordicsemi.no>
1 parent 16d6475 commit ac17ad6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def _generate_onboarding_data(self):
433433

434434

435435
def main():
436-
parser = argparse.ArgumentParser(description="NrfConnect Factory Data NVS generator tool")
436+
parser = argparse.ArgumentParser(description="nRF Connect Factory Data generator tool")
437437

438438
def allow_any_int(i): return int(i, 0)
439439
def base64_str(s): return base64.b64decode(s)
@@ -564,20 +564,20 @@ def base64_str(s): return base64.b64decode(s)
564564
if (exists(args.output + ".json") and not args.overwrite):
565565
log.error(("Output file: {} already exist, to create a new one add argument '--overwrite'. "
566566
"By default overwriting is disabled").format(args.output+".json"))
567-
return
567+
sys.exit(1)
568568

569569
if args.schema and no_jsonschema_module:
570570
log.error(("Requested verification of the JSON file using jsonschema, but the module is not installed. \n"
571571
"Install only the module by invoking: pip3 install jsonschema \n"
572572
"Alternatively, install it with all dependencies for Matter by invoking: pip3 install "
573573
"-r ./scripts/setup/requirements.nrfconnect.txt from the Matter root directory."))
574-
return
574+
sys.exit(1)
575575

576576
if args.generate_onboarding and no_onboarding_modules:
577577
log.error(("Requested generation of onboarding codes, but the some modules are not installed. \n"
578578
"Install all dependencies for Matter by invoking: pip3 install "
579579
"-r ./scripts/setup/requirements.nrfconnect.txt from the Matter root directory."))
580-
return
580+
sys.exit(1)
581581

582582
generator = FactoryDataGenerator(args)
583583
generator.generate_json()

0 commit comments

Comments
 (0)