Check dependencies after config validation

This way the checks can rely on default values from the config.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2021-11-04 10:17:02 +01:00 committed by lsedlar
parent 94ffa1c5c6
commit 80bd254347
3 changed files with 6 additions and 5 deletions

View File

@ -53,7 +53,7 @@ from . import util
def is_jigdo_needed(conf):
return conf.get("create_jigdo", False)
return conf.get("create_jigdo")
def is_isohybrid_needed(conf):
@ -93,7 +93,7 @@ def is_xorrisofs_needed(conf):
def is_createrepo_c_needed(conf):
return conf.get("createrepo_c", True)
return conf.get("createrepo_c")
# The first element in the tuple is package name expected to have the

View File

@ -265,8 +265,6 @@ def main():
# check if all requirements are met
import pungi.checks
if not pungi.checks.check(conf):
sys.exit(1)
pungi.checks.check_umask(logger)
if not pungi.checks.check_skip_phases(
logger, opts.skip_phase + conf.get("skip_phases", []), opts.just_phase
@ -297,6 +295,9 @@ def main():
fail_to_start("Config validation failed", errors=errors)
sys.exit(1)
if not pungi.checks.check(conf):
sys.exit(1)
if opts.target_dir:
compose_dir = Compose.get_compose_dir(
opts.target_dir, conf, compose_type=compose_type, compose_label=opts.label

View File

@ -147,7 +147,7 @@ class CheckDependenciesTestCase(unittest.TestCase):
with mock.patch("sys.stdout", new_callable=StringIO) as out:
with mock.patch("os.path.exists") as exists:
exists.side_effect = self.dont_find(["/usr/bin/createrepo_c"])
result = checks.check({})
result = checks.check({"createrepo_c": True})
self.assertIn("createrepo_c", out.getvalue())
self.assertFalse(result)