Merge #430 `createiso: Include layered product name in iso name`

This commit is contained in:
Dennis Gilmore 2016-10-19 16:36:07 +00:00
commit ff6c952094
3 changed files with 35 additions and 7 deletions

View File

@ -300,16 +300,18 @@ class Compose(kobo.log.LoggingBase):
else:
disc_num = ""
kwargs = {
'arch': arch,
'disc_type': disc_type,
'disc_num': disc_num,
'suffix': suffix
}
if variant.type == "layered-product":
variant_uid = variant.parent.uid
kwargs['compose_id'] = self.ci_base[variant.uid].compose_id
else:
variant_uid = variant.uid
args = get_format_substs(self,
variant=variant_uid,
arch=arch,
disc_type=disc_type,
disc_num=disc_num,
suffix=suffix)
args = get_format_substs(self, variant=variant_uid, **kwargs)
try:
return (format % args).format(**args)
except KeyError as err:

View File

@ -104,7 +104,7 @@ bootable = False
# CREATEISO
createiso_skip = [
('^Server-Gluster$', {
('^Server-ResilientStorage$', {
'*': True,
'src': True
}),

View File

@ -80,6 +80,32 @@ class ComposeTestCase(unittest.TestCase):
'RC-1.0', '1', 'rel_short', '2', '.iso', 'nightly',
'.n', 'Server', '3.0']))
@mock.patch('pungi.compose.ComposeInfo')
def test_get_image_name_layered_product(self, ci):
conf = {}
variant = mock.Mock(uid='Server-LP', type='layered-product')
variant.parent = mock.Mock(uid='Server')
ci.return_value.compose.respin = 2
ci.return_value.compose.id = 'compose_id'
ci.return_value.compose.date = '20160107'
ci.return_value.compose.type = 'nightly'
ci.return_value.compose.type_suffix = '.n'
ci.return_value.compose.label = 'RC-1.0'
ci.return_value.compose.label_major_version = '1'
ci.return_value.release.version = '3.0'
ci.return_value.release.short = 'rel_short'
ci.return_value['Server-LP'].compose_id = 'Gluster 1.0'
compose = Compose(conf, self.tmp_dir)
format = '{compose_id} {variant}'
name = compose.get_image_name('x86_64', variant, format=format,
disc_num=7, disc_type='live', suffix='.iso')
self.assertEqual(name, 'Gluster 1.0 Server')
@mock.patch('pungi.compose.ComposeInfo')
def test_get_image_name_type_netinst(self, ci):
conf = {}