示例#1
0
 def test_redhat_6_install_unsupported(self):
     self.m_os_release.return_value = {'ID': 'redhat'}
     distroinfo = install_grub.distro.get_distroinfo()
     devices = ['/dev/disk-a-part1', '/dev/disk-b-part1']
     rhel_ver = '6'
     grub_name = 'grub-pc'
     grub_cmd = 'grub-install'
     with self.assertRaises(ValueError):
         install_grub.gen_install_commands(grub_name, grub_cmd, distroinfo,
                                           devices, rhel_ver)
示例#2
0
 def test_redhatp_7_or_8_install(self):
     self.m_os_release.return_value = {'ID': 'redhat'}
     distroinfo = install_grub.distro.get_distroinfo()
     devices = ['/dev/disk-a-part1', '/dev/disk-b-part1']
     rhel_ver = '7'
     grub_name = 'grub-pc'
     grub_cmd = 'grub2-install'
     expected_install = [[grub_cmd, dev] for dev in devices]
     expected_post = [['grub2-mkconfig', '-o', '/boot/grub2/grub.cfg']]
     self.assertEqual(
         (expected_install, expected_post),
         install_grub.gen_install_commands(grub_name, grub_cmd, distroinfo,
                                           devices, rhel_ver))
示例#3
0
 def test_ubuntu_install(self):
     distroinfo = install_grub.distro.get_distroinfo()
     devices = ['/dev/disk-a-part1', '/dev/disk-b-part1']
     rhel_ver = None
     grub_name = 'grub-pc'
     grub_cmd = 'grub-install'
     expected_install = [['dpkg-reconfigure', grub_name], ['update-grub']
                         ] + [[grub_cmd, dev] for dev in devices]
     expected_post = []
     self.assertEqual(
         (expected_install, expected_post),
         install_grub.gen_install_commands(grub_name, grub_cmd, distroinfo,
                                           devices, rhel_ver))