[image-build] Koji expects arches as a comma separated string

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-02-11 07:50:02 +01:00
parent 8bf1b09641
commit 91faa0fafe
2 changed files with 19 additions and 2 deletions

View File

@ -122,6 +122,12 @@ class LiveMediaThread(WorkerThread):
% (output['task_id'], log_file))
return output
def _get_cmd(self, koji_wrapper, config):
"""Replace `arches` (as list) with `arch` as a comma-separated string."""
copy = dict(config)
copy['arch'] = ','.join(copy.pop('arches', []))
return koji_wrapper.get_live_media_cmd(copy)
def worker(self, compose, variant, config):
msg = 'Live media: %s (arches: %s, variant: %s)' % (config['name'],
' '.join(config['arches']),
@ -129,7 +135,7 @@ class LiveMediaThread(WorkerThread):
self.pool.log_info('[BEGIN] %s' % msg)
koji_wrapper = KojiWrapper(compose.conf['koji_profile'])
cmd = koji_wrapper.get_live_media_cmd(config)
cmd = self._get_cmd(koji_wrapper, config)
log_file = self._get_log_file(compose, variant, config)
output = self._run_command(koji_wrapper, cmd, compose, log_file)

View File

@ -222,7 +222,18 @@ class TestCreateImageBuildThread(unittest.TestCase):
self.assertEqual(run_blocking_cmd.mock_calls,
[mock.call('koji-spin-livemedia', log_file='/a/b/log/log_file')])
self.assertEqual(get_live_media_cmd.mock_calls,
[mock.call(config)])
[mock.call({'arch': 'amd64,x86_64',
'kickstart': 'file.ks',
'ksurl': 'git://example.com/repo.git',
'ksversion': None,
'name': 'Fedora Server Live',
'release': None,
'repo': ['/repo/$arch/Server'],
'scratch': False,
'skip_tag': None,
'target': 'f24',
'title': None,
'version': 'Rawhide'})])
self.assertEqual(get_image_paths.mock_calls,
[mock.call(1234)])
self.assertItemsEqual(makedirs.mock_calls,