diff --git a/pungi/phases/buildinstall.py b/pungi/phases/buildinstall.py index c66e6d45..ae74153b 100644 --- a/pungi/phases/buildinstall.py +++ b/pungi/phases/buildinstall.py @@ -125,6 +125,7 @@ class BuildinstallPhase(PhaseBase): version = self.compose.conf["release_version"] release = self.compose.conf["release_version"] buildinstall_method = self.compose.conf["buildinstall_method"] + disc_type = self.compose.conf.get('disc_types', {}).get('dvd', 'dvd') for arch in self.compose.get_arches(): commands = [] @@ -137,13 +138,13 @@ class BuildinstallPhase(PhaseBase): for variant in self.compose.get_variants(arch=arch, types=['variant']): if variant.is_empty: continue - volid = get_volid(self.compose, arch, variant=variant, disc_type="dvd") + volid = get_volid(self.compose, arch, variant=variant, disc_type=disc_type) commands.append( (variant, self._get_lorax_cmd(repo_baseurl, output_dir, variant, arch, buildarch, volid)) ) elif buildinstall_method == "buildinstall": - volid = get_volid(self.compose, arch, disc_type="dvd") + volid = get_volid(self.compose, arch, disc_type=disc_type) commands.append( (None, lorax.get_buildinstall_cmd(product, @@ -166,6 +167,7 @@ class BuildinstallPhase(PhaseBase): def copy_files(self): buildinstall_method = self.compose.conf["buildinstall_method"] + disc_type = self.compose.conf.get('disc_types', {}).get('dvd', 'dvd') # copy buildinstall files to the 'os' dir kickstart_file = get_kickstart_file(self.compose) @@ -187,7 +189,7 @@ class BuildinstallPhase(PhaseBase): os_tree = self.compose.paths.compose.os_tree(arch, variant) # TODO: label is not used label = "" - volid = get_volid(self.compose, arch, variant, escape_spaces=False, disc_type="dvd") + volid = get_volid(self.compose, arch, variant, escape_spaces=False, disc_type=disc_type) tweak_buildinstall(buildinstall_dir, os_tree, arch, variant.uid, label, volid, kickstart_file) link_boot_iso(self.compose, arch, variant) diff --git a/tests/test_buildinstall.py b/tests/test_buildinstall.py index 74e31790..560adf4e 100755 --- a/tests/test_buildinstall.py +++ b/tests/test_buildinstall.py @@ -57,7 +57,8 @@ class TestBuildinstallPhase(PungiTestCase): 'release_short': 't', 'release_version': '1', 'release_is_layered': False, - 'buildinstall_method': 'lorax' + 'buildinstall_method': 'lorax', + 'disc_types': {'dvd': 'DVD'}, }) get_volid.return_value = 'vol_id' @@ -91,9 +92,9 @@ class TestBuildinstallPhase(PungiTestCase): bugurl=None)]) self.assertItemsEqual( get_volid.mock_calls, - [mock.call(compose, 'x86_64', variant=compose.variants['Server'], disc_type='dvd'), - mock.call(compose, 'amd64', variant=compose.variants['Client'], disc_type='dvd'), - mock.call(compose, 'amd64', variant=compose.variants['Server'], disc_type='dvd')]) + [mock.call(compose, 'x86_64', variant=compose.variants['Server'], disc_type='DVD'), + mock.call(compose, 'amd64', variant=compose.variants['Client'], disc_type='DVD'), + mock.call(compose, 'amd64', variant=compose.variants['Server'], disc_type='DVD')]) @mock.patch('pungi.phases.buildinstall.ThreadPool') @mock.patch('pungi.phases.buildinstall.LoraxWrapper') @@ -141,7 +142,8 @@ class TestBuildinstallPhase(PungiTestCase): 'release_short': 't', 'release_version': '1', 'release_is_layered': False, - 'buildinstall_method': 'buildinstall' + 'buildinstall_method': 'buildinstall', + 'disc_types': {'dvd': 'DVD'}, }) get_volid.return_value = 'vol_id' @@ -165,8 +167,8 @@ class TestBuildinstallPhase(PungiTestCase): buildarch='amd64', is_final=True, volid='vol_id')]) self.assertItemsEqual( get_volid.mock_calls, - [mock.call(compose, 'x86_64', disc_type='dvd'), - mock.call(compose, 'amd64', disc_type='dvd')]) + [mock.call(compose, 'x86_64', disc_type='DVD'), + mock.call(compose, 'amd64', disc_type='DVD')]) def test_global_upgrade_with_lorax(self): compose = BuildInstallCompose(self.topdir, {