summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build-vyos-image14
1 files changed, 11 insertions, 3 deletions
diff --git a/scripts/build-vyos-image b/scripts/build-vyos-image
index fb7eb540..3d287406 100755
--- a/scripts/build-vyos-image
+++ b/scripts/build-vyos-image
@@ -193,9 +193,17 @@ if __name__ == "__main__":
pre_build_config = merge_dicts({}, build_defaults)
flavor_config = {}
- with open(make_toml_path(defaults.BUILD_FLAVORS_DIR, args["build_flavor"]), 'rb') as f:
- flavor_config = tomli.load(f)
- pre_build_config = merge_dicts(flavor_config, pre_build_config)
+ build_flavor = args["build_flavor"]
+ try:
+ with open(make_toml_path(defaults.BUILD_FLAVORS_DIR, args["build_flavor"]), 'rb') as f:
+ flavor_config = tomli.load(f)
+ pre_build_config = merge_dicts(flavor_config, pre_build_config)
+ except FileNotFoundError:
+ print(f"E: Flavor '{build_flavor}' does not exist")
+ sys.exit(1)
+ except tomli.TOMLDecodeError as e:
+ print(f"E: Failed to parse TOML file for flavor '{build_flavor}': {e}")
+ sys.exit(1)
## Combine configs args > flavor > defaults
pre_build_config = merge_dicts(args, pre_build_config, skip_none=True)