def write_empty_module_blacklist_test(self, flags): """Test write kernel module blacklist to the install root -- empty list.""" with TemporaryDirectory() as temp: flags.cmdline = {} write_module_blacklist(temp) blacklist_file = os.path.join(temp, "etc/modprobe.d/anaconda-blacklist.conf") self.assertFalse(os.path.isfile(blacklist_file))
def write_module_blacklist_test(self, flags): """Test write kernel module blacklist to the install root.""" with TemporaryDirectory() as temp: flags.cmdline = {"modprobe.blacklist": "mod1 mod2 nonono_mod"} write_module_blacklist(temp) blacklist_file = os.path.join(temp, "etc/modprobe.d/anaconda-blacklist.conf") self.assertTrue(os.path.isfile(blacklist_file)) with open(blacklist_file, "rt") as f: expected_content = """ # Module blacklists written by anaconda blacklist mod1 blacklist mod2 blacklist nonono_mod """ self.assertEqual(dedent(expected_content).lstrip(), f.read())
def run(self): """Create a root and write module blacklist.""" create_root_dir(self._sysroot) write_module_blacklist(self._sysroot)