Configure image name per variant
Up to now it was possible to change the pattern for all images, but there are use-cases where different variants might want different names. For example there could be one main variant that should only have product name in the ISO filename, but addons should still be marked with variant name. JIRA: COMPOSE-3041 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
85bf5535bc
commit
fa752eb2b5
5 changed files with 72 additions and 3 deletions
|
|
@ -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_variant_mapping(self, ci):
|
||||
conf = {"image_name_format": {"^Server$": "whatever"}}
|
||||
variant = mock.Mock(uid='Server', type='variant')
|
||||
|
||||
compose = Compose(conf, self.tmp_dir)
|
||||
|
||||
name = compose.get_image_name(
|
||||
'x86_64', variant, disc_num=7, disc_type='live', suffix='.iso'
|
||||
)
|
||||
|
||||
self.assertEqual(name, "whatever")
|
||||
|
||||
@mock.patch('pungi.compose.ComposeInfo')
|
||||
def test_get_image_name_variant_mapping_no_match(self, ci):
|
||||
conf = {"image_name_format": {"^Client$": "whatever"}}
|
||||
variant = mock.Mock(uid='Server', type='variant')
|
||||
ci.return_value.compose.id = 'compose_id'
|
||||
|
||||
compose = Compose(conf, self.tmp_dir)
|
||||
name = compose.get_image_name(
|
||||
'x86_64', variant, disc_num=7, disc_type='live', suffix='.iso'
|
||||
)
|
||||
|
||||
self.assertEqual(name, "compose_id-Server-x86_64-live7.iso")
|
||||
|
||||
@mock.patch('pungi.compose.ComposeInfo')
|
||||
def test_get_image_name_layered_product(self, ci):
|
||||
conf = {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue