From 288d9ecc90f6ec1bf1bc180e253ea6e5f9ab9203 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: May 24 2018 11:25:34 +0000 Subject: Make ostree_installer check if buildinstall is skipped correctly The _skipped attribute is only set after the buildinstall phase is started. Fixes: #909 Signed-off-by: Patrick Uiterwijk --- diff --git a/pungi/phases/buildinstall.py b/pungi/phases/buildinstall.py index 007233c..af4dee9 100644 --- a/pungi/phases/buildinstall.py +++ b/pungi/phases/buildinstall.py @@ -48,12 +48,16 @@ class BuildinstallPhase(PhaseBase): self.buildinstall_method = self.compose.conf.get("buildinstall_method") self.used_lorax = self.buildinstall_method == 'lorax' + self.warned_skipped = False + def skip(self): if PhaseBase.skip(self): return True if not self.compose.conf.get("bootable"): - msg = "Not a bootable product. Skipping buildinstall." - self.compose.log_debug(msg) + if not self.warned_skipped: + msg = "Not a bootable product. Skipping buildinstall." + self.compose.log_debug(msg) + self.warned_skipped = True return True return False diff --git a/pungi/phases/ostree_installer.py b/pungi/phases/ostree_installer.py index 2eac49f..07aa6b3 100644 --- a/pungi/phases/ostree_installer.py +++ b/pungi/phases/ostree_installer.py @@ -24,7 +24,7 @@ class OstreeInstallerPhase(PhaseLoggerMixin, ConfigGuardedPhase): def validate(self): errors = [] - if not self.compose.conf['ostree_installer_overwrite'] and not self.bi._skipped: + if not self.compose.conf['ostree_installer_overwrite'] and not self.bi.skip(): for variant in self.compose.get_variants(): for arch in variant.arches: conf = util.get_arch_variant_data(self.compose.conf, self.name, diff --git a/tests/test_ostree_installer_phase.py b/tests/test_ostree_installer_phase.py index ee3294e..a46222c 100644 --- a/tests/test_ostree_installer_phase.py +++ b/tests/test_ostree_installer_phase.py @@ -55,7 +55,9 @@ class OstreeInstallerPhaseTest(helpers.PungiTestCase): ], }) - phase = ostree.OstreeInstallerPhase(compose, mock.Mock(_skipped=False)) + skipmock = mock.Mock() + skipmock.skip.return_value = False + phase = ostree.OstreeInstallerPhase(compose, skipmock) with self.assertRaises(ValueError) as ctx: phase.validate()