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 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) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user