mirror of
https://github.com/vyos/vyos-build.git
synced 2025-10-01 20:28:40 +02:00
build: T3664: add a sanity check for image_format
and normalize it to a list if only one format is specified
This commit is contained in:
parent
c07268987c
commit
72c7c7ff99
@ -287,12 +287,23 @@ if __name__ == "__main__":
|
|||||||
if has_nonempty_key(build_config["architectures"], "packages"):
|
if has_nonempty_key(build_config["architectures"], "packages"):
|
||||||
build_config["packages"] += build_config["architectures"][arch]["packages"]
|
build_config["packages"] += build_config["architectures"][arch]["packages"]
|
||||||
|
|
||||||
|
## Check if image format is specified,
|
||||||
|
## else we have no idea what we are actually supposed to build.
|
||||||
|
if not has_nonempty_key(build_config, "image_format"):
|
||||||
|
print("E: image format is not specified in the build flavor file")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
## Add default boot settings if needed
|
## Add default boot settings if needed
|
||||||
if "boot_settings" not in build_config:
|
if "boot_settings" not in build_config:
|
||||||
build_config["boot_settings"] = defaults.boot_settings
|
build_config["boot_settings"] = defaults.boot_settings
|
||||||
else:
|
else:
|
||||||
build_config["boot_settings"] = merge_dicts(defaults.default_consolede, build_config["boot_settings"])
|
build_config["boot_settings"] = merge_dicts(defaults.default_consolede, build_config["boot_settings"])
|
||||||
|
|
||||||
|
## Convert the image_format field to a single-item list if it's a scalar
|
||||||
|
## (like `image_format = "iso"`)
|
||||||
|
if type(build_config["image_format"]) != list:
|
||||||
|
build_config["image_format"] = [ build_config["image_format"] ]
|
||||||
|
|
||||||
## Dump the complete config if the user enabled debug mode
|
## Dump the complete config if the user enabled debug mode
|
||||||
if debug:
|
if debug:
|
||||||
import json
|
import json
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user