[live-images] Build all images specified in config

Not just the first one.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-02-22 08:21:51 +01:00
parent 8ed44dd153
commit 32a966fc91
2 changed files with 119 additions and 60 deletions

View File

@ -98,11 +98,7 @@ class LiveImagesPhase(PhaseBase):
for variant in self.compose.variants.values():
for arch in variant.arches + ["src"]:
data = get_arch_variant_data(self.compose.conf, "live_images", arch, variant)
if not data:
continue
data = data[0]
for data in get_arch_variant_data(self.compose.conf, "live_images", arch, variant):
iso_dir = self.compose.paths.compose.iso_dir(arch, variant, symlink_to=symlink_isos_to)
if not iso_dir:
continue

View File

@ -101,6 +101,69 @@ class TestLiveImagesPhase(unittest.TestCase):
compose.variants['Client'],
'amd64'))])
@mock.patch('pungi.phases.live_images.ThreadPool')
def test_live_image_build_two_images(self, ThreadPool):
compose = _DummyCompose({
'live_images': [
('^Client$', {
'amd64': [{
'kickstart': 'test.ks',
'additional_repos': ['http://example.com/repo/'],
'repos_from': ['Everything'],
}, {
'kickstart': 'another.ks',
'additional_repos': ['http://example.com/repo/'],
'repos_from': ['Everything'],
}]
})
],
})
phase = LiveImagesPhase(compose)
phase.run()
# assert at least one thread was started
self.assertTrue(phase.pool.add.called)
self.maxDiff = None
self.assertItemsEqual(phase.pool.queue_put.mock_calls,
[mock.call((compose,
{'ks_file': 'test.ks',
'build_arch': 'amd64',
'wrapped_rpms_path': '/iso_dir/amd64/Client',
'scratch': False,
'repos': ['/repo/amd64/Client',
'http://example.com/repo/',
'/repo/amd64/Everything'],
'label': '',
'name': None,
'iso_path': '/iso_dir/amd64/Client/image-name',
'version': None,
'specfile': None,
'sign': False,
'type': 'live',
'ksurl': None},
compose.variants['Client'],
'amd64')),
mock.call((compose,
{'ks_file': 'another.ks',
'build_arch': 'amd64',
'wrapped_rpms_path': '/iso_dir/amd64/Client',
'scratch': False,
'repos': ['/repo/amd64/Client',
'http://example.com/repo/',
'/repo/amd64/Everything'],
'label': '',
'name': None,
'iso_path': '/iso_dir/amd64/Client/image-name',
'version': None,
'specfile': None,
'sign': False,
'type': 'live',
'ksurl': None},
compose.variants['Client'],
'amd64'))])
@mock.patch('pungi.phases.live_images.ThreadPool')
@mock.patch('pungi.phases.live_images.resolve_git_url')
def test_spin_appliance(self, resolve_git_url, ThreadPool):