image-build: Accept formats in lists
If the config is loaded from JSON, we will get list instead of tuple. The validation rule does not really care whether it's a list or tuple, it only enforces there are two strings. The definition is renamed to be a bit more descriptive. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
6bd1e9da2a
commit
357f556d69
@ -516,7 +516,7 @@ def make_schema():
|
|||||||
"required": ["url", "target", "git_branch"]
|
"required": ["url", "target", "git_branch"]
|
||||||
},
|
},
|
||||||
|
|
||||||
"string_tuples": {
|
"string_pairs": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@ -940,7 +940,7 @@ def make_schema():
|
|||||||
},
|
},
|
||||||
|
|
||||||
"translate_paths": {
|
"translate_paths": {
|
||||||
"$ref": "#/definitions/string_tuples",
|
"$ref": "#/definitions/string_pairs",
|
||||||
"default": [],
|
"default": [],
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1145,7 +1145,7 @@ def make_schema():
|
|||||||
"format": {
|
"format": {
|
||||||
"anyOf": [
|
"anyOf": [
|
||||||
# The variant with explicit extension is deprecated.
|
# The variant with explicit extension is deprecated.
|
||||||
{"$ref": "#/definitions/string_tuples"},
|
{"$ref": "#/definitions/string_pairs"},
|
||||||
{"$ref": "#/definitions/strings"}
|
{"$ref": "#/definitions/strings"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -136,7 +136,7 @@ class ImageBuildPhase(base.PhaseLoggerMixin, base.ImageConfigMixin, base.ConfigG
|
|||||||
# just list of formats, or a single format.
|
# just list of formats, or a single format.
|
||||||
formats = []
|
formats = []
|
||||||
for format in force_list(image_conf["image-build"]["format"]):
|
for format in force_list(image_conf["image-build"]["format"]):
|
||||||
formats.append(format[0] if isinstance(format, tuple) else format)
|
formats.append(format[0] if isinstance(format, (tuple, list)) else format)
|
||||||
image_conf["image-build"]["format"] = formats
|
image_conf["image-build"]["format"] = formats
|
||||||
image_conf["image-build"]['repo'] = self._get_repo(image_conf['image-build'], variant)
|
image_conf["image-build"]['repo'] = self._get_repo(image_conf['image-build'], variant)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user