[live-images] Fix crash when repo_from is not a list
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
98a9e02b1b
commit
6e8970e648
@ -22,7 +22,7 @@ import pipes
|
||||
import shutil
|
||||
|
||||
from kobo.threads import ThreadPool, WorkerThread
|
||||
from kobo.shortcuts import run, save_to_file
|
||||
from kobo.shortcuts import run, save_to_file, force_list
|
||||
from productmd.images import Image
|
||||
|
||||
from pungi.wrappers.kojiwrapper import KojiWrapper
|
||||
@ -106,7 +106,7 @@ class LiveImagesPhase(PhaseBase):
|
||||
|
||||
# additional repos
|
||||
repos.extend(data.get("additional_repos", []))
|
||||
repos.extend(self._get_extra_repos(arch, variant, data.get('repo_from', [])))
|
||||
repos.extend(self._get_extra_repos(arch, variant, force_list(data.get('repo_from', []))))
|
||||
return repos
|
||||
|
||||
def _get_release(self, image_conf):
|
||||
|
@ -59,6 +59,49 @@ class TestLiveImagesPhase(PungiTestCase):
|
||||
compose.variants['Client'],
|
||||
'amd64'))])
|
||||
|
||||
@mock.patch('pungi.phases.live_images.ThreadPool')
|
||||
def test_live_image_build_single_repo_from(self, ThreadPool):
|
||||
compose = DummyCompose(self.topdir, {
|
||||
'live_images': [
|
||||
('^Client$', {
|
||||
'amd64': {
|
||||
'kickstart': 'test.ks',
|
||||
'additional_repos': ['http://example.com/repo/'],
|
||||
'repo_from': 'Everything',
|
||||
'release': None,
|
||||
}
|
||||
})
|
||||
],
|
||||
})
|
||||
|
||||
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',
|
||||
'dest_dir': self.topdir + '/compose/Client/amd64/iso',
|
||||
'scratch': False,
|
||||
'repos': [self.topdir + '/compose/Client/amd64/os',
|
||||
'http://example.com/repo/',
|
||||
self.topdir + '/compose/Everything/amd64/os'],
|
||||
'label': '',
|
||||
'name': None,
|
||||
'filename': 'image-name',
|
||||
'version': None,
|
||||
'specfile': None,
|
||||
'sign': False,
|
||||
'type': 'live',
|
||||
'release': '20151203.0',
|
||||
'ksurl': None},
|
||||
compose.variants['Client'],
|
||||
'amd64'))])
|
||||
|
||||
@mock.patch('pungi.phases.live_images.ThreadPool')
|
||||
def test_live_image_build_without_rename(self, ThreadPool):
|
||||
compose = DummyCompose(self.topdir, {
|
||||
|
Loading…
Reference in New Issue
Block a user