diff --git a/pungi/compose.py b/pungi/compose.py index 47bfbf9c..e62b9b9a 100644 --- a/pungi/compose.py +++ b/pungi/compose.py @@ -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: diff --git a/tests/data/dummy-pungi.conf b/tests/data/dummy-pungi.conf index d2de06f8..faaebb5b 100644 --- a/tests/data/dummy-pungi.conf +++ b/tests/data/dummy-pungi.conf @@ -104,7 +104,7 @@ bootable = False # CREATEISO createiso_skip = [ - ('^Server-Gluster$', { + ('^Server-ResilientStorage$', { '*': True, 'src': True }), diff --git a/tests/test_compose.py b/tests/test_compose.py index e4f82270..a8c1c76c 100755 --- a/tests/test_compose.py +++ b/tests/test_compose.py @@ -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 = {}