[live-media] Put images into iso dir

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-02-11 10:11:38 +01:00
parent 91faa0fafe
commit 0c4bd42f80
2 changed files with 10 additions and 16 deletions

View File

@ -159,10 +159,10 @@ class LiveMediaThread(WorkerThread):
linker = Linker(logger=compose._logger) linker = Linker(logger=compose._logger)
link_type = compose.conf.get("link_type", "hardlink-or-copy") link_type = compose.conf.get("link_type", "hardlink-or-copy")
for image_info in image_infos: for image_info in image_infos:
image_dir = compose.paths.compose.image_dir(variant) % {"arch": image_info['arch']} image_dir = compose.paths.compose.iso_dir(variant) % {"arch": image_info['arch']}
makedirs(image_dir) makedirs(image_dir)
relative_image_dir = ( relative_image_dir = (
compose.paths.compose.image_dir(variant, relative=True) % {"arch": image_info['arch']} compose.paths.compose.iso_dir(variant, relative=True) % {"arch": image_info['arch']}
) )
# let's not change filename of koji outputs # let's not change filename of koji outputs

View File

@ -35,18 +35,12 @@ class _DummyCompose(object):
repository=mock.Mock( repository=mock.Mock(
side_effect=lambda arch, variant, create_dir=False: os.path.join('/repo', arch, variant.uid) side_effect=lambda arch, variant, create_dir=False: os.path.join('/repo', arch, variant.uid)
), ),
image_dir=mock.Mock( iso_dir=mock.Mock(
side_effect=lambda variant, relative=False: os.path.join( side_effect=lambda variant, relative=False: os.path.join(
'' if relative else '/', 'image_dir', variant.uid, '%(arch)s' '' if relative else '/', 'iso_dir', variant.uid, '%(arch)s'
) )
) )
), ),
work=mock.Mock(
image_build_conf=mock.Mock(
side_effect=lambda variant, image_name, image_type:
'-'.join([variant.uid, image_name, image_type])
)
),
log=mock.Mock( log=mock.Mock(
log_file=mock.Mock(return_value='/a/b/log/log_file') log_file=mock.Mock(return_value='/a/b/log/log_file')
) )
@ -237,20 +231,20 @@ class TestCreateImageBuildThread(unittest.TestCase):
self.assertEqual(get_image_paths.mock_calls, self.assertEqual(get_image_paths.mock_calls,
[mock.call(1234)]) [mock.call(1234)])
self.assertItemsEqual(makedirs.mock_calls, self.assertItemsEqual(makedirs.mock_calls,
[mock.call('/image_dir/Server/x86_64'), [mock.call('/iso_dir/Server/x86_64'),
mock.call('/image_dir/Server/amd64')]) mock.call('/iso_dir/Server/amd64')])
link = Linker.return_value.link link = Linker.return_value.link
self.assertItemsEqual(link.mock_calls, self.assertItemsEqual(link.mock_calls,
[mock.call('/koji/task/1235/Live-20160103.amd64.iso', [mock.call('/koji/task/1235/Live-20160103.amd64.iso',
'/image_dir/Server/amd64/Live-20160103.amd64.iso', '/iso_dir/Server/amd64/Live-20160103.amd64.iso',
link_type='hardlink-or-copy'), link_type='hardlink-or-copy'),
mock.call('/koji/task/1235/Live-20160103.x86_64.iso', mock.call('/koji/task/1235/Live-20160103.x86_64.iso',
'/image_dir/Server/x86_64/Live-20160103.x86_64.iso', '/iso_dir/Server/x86_64/Live-20160103.x86_64.iso',
link_type='hardlink-or-copy')]) link_type='hardlink-or-copy')])
image_relative_paths = [ image_relative_paths = [
'image_dir/Server/amd64/Live-20160103.amd64.iso', 'iso_dir/Server/amd64/Live-20160103.amd64.iso',
'image_dir/Server/x86_64/Live-20160103.x86_64.iso' 'iso_dir/Server/x86_64/Live-20160103.x86_64.iso'
] ]
self.assertEqual(len(compose.im.add.call_args_list), 2) self.assertEqual(len(compose.im.add.call_args_list), 2)