ostree-installer: Work with skipped buildinstall
Fixes: https://pagure.io/pungi/issue/909 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
076be762ec
commit
543154d597
@ -103,7 +103,7 @@ def run(config, topdir, has_old):
|
|||||||
pungi.phases.GatherPhase(compose, pkgset_phase),
|
pungi.phases.GatherPhase(compose, pkgset_phase),
|
||||||
pungi.phases.ExtraFilesPhase(compose, pkgset_phase),
|
pungi.phases.ExtraFilesPhase(compose, pkgset_phase),
|
||||||
pungi.phases.CreaterepoPhase(compose),
|
pungi.phases.CreaterepoPhase(compose),
|
||||||
pungi.phases.OstreeInstallerPhase(compose),
|
pungi.phases.OstreeInstallerPhase(compose, buildinstall_phase),
|
||||||
pungi.phases.OSTreePhase(compose),
|
pungi.phases.OSTreePhase(compose),
|
||||||
pungi.phases.ProductimgPhase(compose, pkgset_phase),
|
pungi.phases.ProductimgPhase(compose, pkgset_phase),
|
||||||
pungi.phases.CreateisoPhase(compose, buildinstall_phase),
|
pungi.phases.CreateisoPhase(compose, buildinstall_phase),
|
||||||
|
@ -290,7 +290,7 @@ def run_compose(compose, create_latest_link=True, latest_link_status=None):
|
|||||||
gather_phase = pungi.phases.GatherPhase(compose, pkgset_phase)
|
gather_phase = pungi.phases.GatherPhase(compose, pkgset_phase)
|
||||||
extrafiles_phase = pungi.phases.ExtraFilesPhase(compose, pkgset_phase)
|
extrafiles_phase = pungi.phases.ExtraFilesPhase(compose, pkgset_phase)
|
||||||
createrepo_phase = pungi.phases.CreaterepoPhase(compose)
|
createrepo_phase = pungi.phases.CreaterepoPhase(compose)
|
||||||
ostree_installer_phase = pungi.phases.OstreeInstallerPhase(compose)
|
ostree_installer_phase = pungi.phases.OstreeInstallerPhase(compose, buildinstall_phase)
|
||||||
ostree_phase = pungi.phases.OSTreePhase(compose)
|
ostree_phase = pungi.phases.OSTreePhase(compose)
|
||||||
productimg_phase = pungi.phases.ProductimgPhase(compose, pkgset_phase)
|
productimg_phase = pungi.phases.ProductimgPhase(compose, pkgset_phase)
|
||||||
createiso_phase = pungi.phases.CreateisoPhase(compose, buildinstall_phase)
|
createiso_phase = pungi.phases.CreateisoPhase(compose, buildinstall_phase)
|
||||||
|
@ -16,9 +16,10 @@ from ..wrappers import kojiwrapper, iso, lorax, scm
|
|||||||
class OstreeInstallerPhase(PhaseLoggerMixin, ConfigGuardedPhase):
|
class OstreeInstallerPhase(PhaseLoggerMixin, ConfigGuardedPhase):
|
||||||
name = 'ostree_installer'
|
name = 'ostree_installer'
|
||||||
|
|
||||||
def __init__(self, compose):
|
def __init__(self, compose, buildinstall_phase):
|
||||||
super(OstreeInstallerPhase, self).__init__(compose)
|
super(OstreeInstallerPhase, self).__init__(compose)
|
||||||
self.pool = ThreadPool(logger=self.logger)
|
self.pool = ThreadPool(logger=self.logger)
|
||||||
|
self.bi = buildinstall_phase
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
errors = []
|
errors = []
|
||||||
@ -27,6 +28,7 @@ class OstreeInstallerPhase(PhaseLoggerMixin, ConfigGuardedPhase):
|
|||||||
except ValueError as exc:
|
except ValueError as exc:
|
||||||
errors = exc.message.split('\n')
|
errors = exc.message.split('\n')
|
||||||
|
|
||||||
|
if not self.bi._skipped:
|
||||||
for variant in self.compose.get_variants():
|
for variant in self.compose.get_variants():
|
||||||
for arch in variant.arches:
|
for arch in variant.arches:
|
||||||
conf = util.get_arch_variant_data(self.compose.conf, self.name,
|
conf = util.get_arch_variant_data(self.compose.conf, self.name,
|
||||||
|
@ -33,7 +33,7 @@ class OstreeInstallerPhaseTest(helpers.PungiTestCase):
|
|||||||
|
|
||||||
pool = ThreadPool.return_value
|
pool = ThreadPool.return_value
|
||||||
|
|
||||||
phase = ostree.OstreeInstallerPhase(compose)
|
phase = ostree.OstreeInstallerPhase(compose, mock.Mock())
|
||||||
phase.run()
|
phase.run()
|
||||||
|
|
||||||
self.assertEqual(len(pool.add.call_args_list), 1)
|
self.assertEqual(len(pool.add.call_args_list), 1)
|
||||||
@ -45,9 +45,35 @@ class OstreeInstallerPhaseTest(helpers.PungiTestCase):
|
|||||||
compose = helpers.DummyCompose(self.topdir, {})
|
compose = helpers.DummyCompose(self.topdir, {})
|
||||||
compose.just_phases = None
|
compose.just_phases = None
|
||||||
compose.skip_phases = []
|
compose.skip_phases = []
|
||||||
phase = ostree.OstreeInstallerPhase(compose)
|
phase = ostree.OstreeInstallerPhase(compose, mock.Mock())
|
||||||
self.assertTrue(phase.skip())
|
self.assertTrue(phase.skip())
|
||||||
|
|
||||||
|
def test_validate_conflict_with_buildinstall(self):
|
||||||
|
compose = helpers.DummyCompose(self.topdir, {
|
||||||
|
'ostree_installer': [
|
||||||
|
('^Server$', {'x86_64': mock.Mock()})
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
phase = ostree.OstreeInstallerPhase(compose, mock.Mock(_skipped=False))
|
||||||
|
with self.assertRaises(ValueError) as ctx:
|
||||||
|
phase.validate()
|
||||||
|
|
||||||
|
self.assertEqual(str(ctx.exception),
|
||||||
|
'Can not generate ostree installer for Server.x86_64:'
|
||||||
|
' it has buildinstall running already and the files'
|
||||||
|
' would clash.')
|
||||||
|
|
||||||
|
def test_validate_buildinstall_skipped(self):
|
||||||
|
compose = helpers.DummyCompose(self.topdir, {
|
||||||
|
'ostree_installer': [
|
||||||
|
('^Server$', {'x86_64': mock.Mock()})
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
phase = ostree.OstreeInstallerPhase(compose, mock.Mock(_skipped=True))
|
||||||
|
phase.validate()
|
||||||
|
|
||||||
|
|
||||||
class OstreeThreadTest(helpers.PungiTestCase):
|
class OstreeThreadTest(helpers.PungiTestCase):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user