def test_get_osfamily(self): for distro_name in distro.DISTRO_NAMES: self.mock_os_release.return_value = {'ID': distro_name} variant = distro.name_to_distro(distro_name) family = distro.DISTRO_TO_OSFAMILY[variant] distro_obj = distro.get_osfamily() self.assertEqual(family, distro_obj)
def get_grub_config_file(target=None, osfamily=None): """Return the filename used to configure grub. :param: osfamily: string specifying the target os family being configured :returns: string, path to the osfamily grub config file """ if not osfamily: osfamily = distro.get_osfamily(target=target) if osfamily == distro.DISTROS.debian: # to avoid tripping prompts on upgrade LP: #564853 return '/etc/default/grub.d/50-curtin-settings.cfg' return '/etc/default/grub'