config: Report validation warning if variants fail to load
In a real compose this would be a blocker issue and the compose would be aborted, but for validation it may make sense to continue. Instead of crashing, let's report a clear warning. JIRA: COMPOSE-3606 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
2f05a71c61
commit
32624c59b1
@ -8,7 +8,6 @@ import json
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import kobo.conf
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
here = sys.path[0]
|
here = sys.path[0]
|
||||||
@ -35,6 +34,7 @@ class ValidationCompose(pungi.compose.Compose):
|
|||||||
self.has_old_composes = has_old
|
self.has_old_composes = has_old
|
||||||
self.paths = pungi.paths.Paths(self)
|
self.paths = pungi.paths.Paths(self)
|
||||||
self.variants = {}
|
self.variants = {}
|
||||||
|
self.all_variants = {}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def old_composes(self):
|
def old_composes(self):
|
||||||
@ -70,7 +70,6 @@ def read_variants(compose, config):
|
|||||||
parser = VariantsXmlParser(file_obj, tree_arches, tree_variants)
|
parser = VariantsXmlParser(file_obj, tree_arches, tree_variants)
|
||||||
compose.variants = parser.parse()
|
compose.variants = parser.parse()
|
||||||
|
|
||||||
compose.all_variants = {}
|
|
||||||
for variant in compose.variants.values():
|
for variant in compose.variants.values():
|
||||||
compose.all_variants[variant.uid] = variant
|
compose.all_variants[variant.uid] = variant
|
||||||
for child in variant.get_variants():
|
for child in variant.get_variants():
|
||||||
@ -92,9 +91,8 @@ def run(config, topdir, has_old, offline):
|
|||||||
read_variants(compose, config)
|
read_variants(compose, config)
|
||||||
except VariantsValidationError as exc:
|
except VariantsValidationError as exc:
|
||||||
errors.extend(str(exc).splitlines())
|
errors.extend(str(exc).splitlines())
|
||||||
except:
|
except RuntimeError as exc:
|
||||||
# Failed to read variants, no big deal.
|
print("WARNING: Failed to load variants: %s" % exc)
|
||||||
pass
|
|
||||||
|
|
||||||
pkgset_phase = pungi.phases.PkgsetPhase(compose)
|
pkgset_phase = pungi.phases.PkgsetPhase(compose)
|
||||||
buildinstall_phase = pungi.phases.BuildinstallPhase(compose)
|
buildinstall_phase = pungi.phases.BuildinstallPhase(compose)
|
||||||
|
Loading…
Reference in New Issue
Block a user