Move resolving git reference to config validation
Instead of multiple places handling the same thing duplicating the logic, it's better to do it once upfront. This allows easy caching of the results. Additional advantage of this approach is that the config dump will include resolved URLs. The original reference will still be available in the copy of the original config. JIRA: COMPOSE-3065 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
444af0396e
commit
ca7d6256e5
14 changed files with 177 additions and 268 deletions
|
|
@ -77,11 +77,11 @@ def read_variants(compose, config):
|
|||
compose.all_variants[child.uid] = child
|
||||
|
||||
|
||||
def run(config, topdir, has_old):
|
||||
def run(config, topdir, has_old, offline):
|
||||
conf = kobo.conf.PyConfigParser()
|
||||
conf.load_from_file(config)
|
||||
|
||||
errors, warnings = pungi.checks.validate(conf)
|
||||
errors, warnings = pungi.checks.validate(conf, offline=offline)
|
||||
if errors or warnings:
|
||||
for error in errors + warnings:
|
||||
print(error)
|
||||
|
|
@ -146,10 +146,15 @@ def main(args=None):
|
|||
help='configuration file to validate')
|
||||
parser.add_argument('--old-composes', action='store_true',
|
||||
help='indicate if pungi-koji will be run with --old-composes option')
|
||||
parser.add_argument(
|
||||
"--offline",
|
||||
action="store_true",
|
||||
help="Do not validate git references in URLs",
|
||||
)
|
||||
opts = parser.parse_args(args)
|
||||
|
||||
with pungi.util.temp_dir() as topdir:
|
||||
errors = run(opts.config, topdir, opts.old_composes)
|
||||
errors = run(opts.config, topdir, opts.old_composes, opts.offline)
|
||||
|
||||
for msg in errors:
|
||||
print(msg)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue