From be8605ac9113aafaaad9422d2c0298cefde05410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Fri, 11 Mar 2016 08:55:21 +0100 Subject: [PATCH] Remove check for disc type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will get validated in productmd anyway, no need to duplicate the check in Pungi itself. Signed-off-by: Lubomír Sedlář --- pungi/compose.py | 2 -- tests/test_compose.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/pungi/compose.py b/pungi/compose.py index 8a2593fa..74c2c11b 100644 --- a/pungi/compose.py +++ b/pungi/compose.py @@ -309,8 +309,6 @@ class Compose(kobo.log.LoggingBase): if arch == "src": arch = "source" - if disc_type not in ("cd", "dvd", "ec2", "live", "boot"): - raise RuntimeError("Unsupported disc type: %s" % disc_type) if disc_num: disc_num = int(disc_num) else: diff --git a/tests/test_compose.py b/tests/test_compose.py index e0ff7c56..e2c2b76e 100755 --- a/tests/test_compose.py +++ b/tests/test_compose.py @@ -71,6 +71,34 @@ 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_type_netinst(self, ci): + conf = {} + variant = mock.Mock(uid='Server', type='variant') + 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' + + compose = Compose(conf, self.tmp_dir) + + keys = ['arch', 'compose_id', 'date', 'disc_num', 'disc_type', + 'label', 'label_major_version', 'release_short', 'respin', + 'suffix', 'type', 'type_suffix', 'variant', 'version'] + format = '-'.join(['%(' + k + ')s' for k in keys]) + name = compose.get_image_name('x86_64', variant, format=format, + disc_num=7, disc_type='netinst', suffix='.iso') + + self.assertEqual(name, '-'.join(['x86_64', 'compose_id', '20160107', '7', 'netinst', + 'RC-1.0', '1', 'rel_short', '2', '.iso', 'nightly', + '.n', 'Server', '3.0'])) + class StatusTest(unittest.TestCase): def setUp(self):