def get_config_files_content_test(self, get_config_files_paths_mock): """Test get_config_files_content.""" files = [ ("/file1", """ content1 """), ("/dir/file2", """ content2 """), ] expected_content = """ {}/file1: content1 {}/dir/file2: content2 """.format(self._root_dir, self._root_dir) self._dump_files(files, root_path=self._root_dir) get_config_files_paths_mock.return_value = [ "{}/file1".format(self._root_dir), "{}/dir/file2".format(self._root_dir), ] content = get_config_files_content(self._root_dir) self.assertEqual( dedent(content).strip(), dedent(expected_content).strip())
def log_configuration_state(self, msg_header, root_path=""): """Log the current network configuration state. Logs NM config files and NM connections """ log.debug("Dumping configuration state - %s", msg_header) for line in get_config_files_content(root_path=root_path).splitlines(): log.debug(line) if self.nm_available: for line in get_connections_dump(self.nm_client).splitlines(): log.debug(line)