From 32624c59b1b856663362e6185c4d16f07bafcbf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Thu, 20 Jun 2019 13:59:07 +0200 Subject: [PATCH] config: Report validation warning if variants fail to load MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ář --- bin/pungi-config-validate | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/bin/pungi-config-validate b/bin/pungi-config-validate index e54990fb..5e20a91e 100755 --- a/bin/pungi-config-validate +++ b/bin/pungi-config-validate @@ -8,7 +8,6 @@ import json import os import sys -import kobo.conf import six here = sys.path[0] @@ -35,6 +34,7 @@ class ValidationCompose(pungi.compose.Compose): self.has_old_composes = has_old self.paths = pungi.paths.Paths(self) self.variants = {} + self.all_variants = {} @property def old_composes(self): @@ -70,7 +70,6 @@ def read_variants(compose, config): parser = VariantsXmlParser(file_obj, tree_arches, tree_variants) compose.variants = parser.parse() - compose.all_variants = {} for variant in compose.variants.values(): compose.all_variants[variant.uid] = variant for child in variant.get_variants(): @@ -92,9 +91,8 @@ def run(config, topdir, has_old, offline): read_variants(compose, config) except VariantsValidationError as exc: errors.extend(str(exc).splitlines()) - except: - # Failed to read variants, no big deal. - pass + except RuntimeError as exc: + print("WARNING: Failed to load variants: %s" % exc) pkgset_phase = pungi.phases.PkgsetPhase(compose) buildinstall_phase = pungi.phases.BuildinstallPhase(compose)