createiso: Include layered product name in iso name

When creating an ISO for a layered product, the name of the integrated
product should be included in the file name.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-10-17 15:15:01 +02:00
parent b2b5dd919b
commit b46af7acbb
3 changed files with 35 additions and 7 deletions

View File

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

View File

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

View File

@ -80,6 +80,32 @@ class ComposeTestCase(unittest.TestCase):
'RC-1.0', '1', 'rel_short', '2', '.iso', 'nightly', 'RC-1.0', '1', 'rel_short', '2', '.iso', 'nightly',
'.n', 'Server', '3.0'])) '.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') @mock.patch('pungi.compose.ComposeInfo')
def test_get_image_name_type_netinst(self, ci): def test_get_image_name_type_netinst(self, ci):
conf = {} conf = {}