From b2c9601c44cfa420fb14646c57a220de6fdd90dc Mon Sep 17 00:00:00 2001 From: Joachim Metz Date: Thu, 21 May 2020 16:36:53 +0200 Subject: [PATCH] Renamed ReadPreprocessingInformation to ReadSystemConfiguration #109 --- plaso/cli/pinfo_tool.py | 2 +- plaso/multi_processing/psort.py | 4 ++-- plaso/storage/fake/writer.py | 12 ++++------ plaso/storage/file_interface.py | 28 ++++++++++------------ plaso/storage/interface.py | 36 ++++++++++++----------------- tests/multi_processing/psort.py | 8 +++---- tests/output/test_lib.py | 2 +- tests/storage/sqlite/sqlite_file.py | 2 +- 8 files changed, 41 insertions(+), 53 deletions(-) diff --git a/plaso/cli/pinfo_tool.py b/plaso/cli/pinfo_tool.py index ecbd78c779..68324a9de5 100644 --- a/plaso/cli/pinfo_tool.py +++ b/plaso/cli/pinfo_tool.py @@ -447,7 +447,7 @@ def _PrintPreprocessingInformation( """ knowledge_base_object = knowledge_base.KnowledgeBase() - storage_reader.ReadPreprocessingInformation(knowledge_base_object) + storage_reader.ReadSystemConfiguration(knowledge_base_object) lookup_identifier = session_identifier if lookup_identifier: diff --git a/plaso/multi_processing/psort.py b/plaso/multi_processing/psort.py index 75a79d3fb5..de2e7f8cc8 100644 --- a/plaso/multi_processing/psort.py +++ b/plaso/multi_processing/psort.py @@ -901,7 +901,7 @@ def AnalyzeEvents( # the ZIP storage file will remain locked as long as the worker processes # are alive. storage_writer.Open() - storage_writer.ReadPreprocessingInformation(knowledge_base_object) + storage_writer.ReadSystemConfiguration(knowledge_base_object) storage_writer.WriteSessionStart() try: @@ -984,7 +984,7 @@ def ExportEvents( self._processing_configuration = processing_configuration self._status_update_callback = status_update_callback - storage_reader.ReadPreprocessingInformation(knowledge_base_object) + storage_reader.ReadSystemConfiguration(knowledge_base_object) total_number_of_events = 0 for session in storage_reader.GetSessions(): diff --git a/plaso/storage/fake/writer.py b/plaso/storage/fake/writer.py index 514b102bfd..519e47fd29 100644 --- a/plaso/storage/fake/writer.py +++ b/plaso/storage/fake/writer.py @@ -427,16 +427,14 @@ def PrepareMergeTaskStorage(self, task): task.identifier)) # pylint: disable=unused-argument - def ReadPreprocessingInformation(self, knowledge_base): - """Reads preprocessing information. + def ReadSystemConfiguration(self, knowledge_base): + """Reads system configuration information. - The preprocessing information contains the system configuration which - contains information about various system specific configuration data, - for example the user accounts. + The system configuration contains information about various system specific + configuration data, for example the user accounts. Args: - knowledge_base (KnowledgeBase): is used to store the preprocessing - information. + knowledge_base (KnowledgeBase): is used to store the system configuration. Raises: IOError: if the storage type does not support writing preprocessing diff --git a/plaso/storage/file_interface.py b/plaso/storage/file_interface.py index edbcedcd20..b287302a7a 100644 --- a/plaso/storage/file_interface.py +++ b/plaso/storage/file_interface.py @@ -405,18 +405,16 @@ def HasWarnings(self): """ return self._storage_file.HasWarnings() - def ReadPreprocessingInformation(self, knowledge_base): - """Reads preprocessing information. + def ReadSystemConfiguration(self, knowledge_base): + """Reads system configuration information. - The preprocessing information contains the system configuration which - contains information about various system specific configuration data, - for example the user accounts. + The system configuration contains information about various system specific + configuration data, for example the user accounts. Args: - knowledge_base (KnowledgeBase): is used to store the preprocessing - information. + knowledge_base (KnowledgeBase): is used to store the system configuration. """ - self._storage_file.ReadPreprocessingInformation(knowledge_base) + self._storage_file.ReadSystemConfiguration(knowledge_base) def SetSerializersProfiler(self, serializers_profiler): """Sets the serializers profiler. @@ -882,16 +880,14 @@ def PrepareMergeTaskStorage(self, task): 'Unable to rename task storage file: {0:s} with error: ' '{1!s}').format(processed_storage_file_path, exception)) - def ReadPreprocessingInformation(self, knowledge_base): - """Reads preprocessing information. + def ReadSystemConfiguration(self, knowledge_base): + """Reads system configuration information. - The preprocessing information contains the system configuration which - contains information about various system specific configuration data, - for example the user accounts. + The system configuration contains information about various system specific + configuration data, for example the user accounts. Args: - knowledge_base (KnowledgeBase): is used to store the preprocessing - information. + knowledge_base (KnowledgeBase): is used to store the system configuration. Raises: IOError: when the storage writer is closed. @@ -900,7 +896,7 @@ def ReadPreprocessingInformation(self, knowledge_base): if not self._storage_file: raise IOError('Unable to read from closed storage writer.') - self._storage_file.ReadPreprocessingInformation(knowledge_base) + self._storage_file.ReadSystemConfiguration(knowledge_base) def RemoveProcessedTaskStorage(self, task): """Removes a processed task storage. diff --git a/plaso/storage/interface.py b/plaso/storage/interface.py index 0f5e753785..70db322b8f 100644 --- a/plaso/storage/interface.py +++ b/plaso/storage/interface.py @@ -385,16 +385,14 @@ def HasEventTags(self): def Open(self, **kwargs): """Opens the storage.""" - def ReadPreprocessingInformation(self, knowledge_base): - """Reads preprocessing information. + def ReadSystemConfiguration(self, knowledge_base): + """Reads system configuration information. - The preprocessing information contains the system configuration which - contains information about various system specific configuration data, - for example the user accounts. + The system configuration contains information about various system specific + configuration data, for example the user accounts. Args: - knowledge_base (KnowledgeBase): is used to store the preprocessing - information. + knowledge_base (KnowledgeBase): is used to store the system configuration. """ generator = self._GetAttributeContainers( self._CONTAINER_TYPE_SYSTEM_CONFIGURATION) @@ -802,16 +800,14 @@ def HasWarnings(self): """ @abc.abstractmethod - def ReadPreprocessingInformation(self, knowledge_base): - """Reads preprocessing information. + def ReadSystemConfiguration(self, knowledge_base): + """Reads system configuration information. - The preprocessing information contains the system configuration which - contains information about various system specific configuration data, - for example the user accounts. + The system configuration contains information about various system specific + configuration data, for example the user accounts. Args: - knowledge_base (KnowledgeBase): is used to store the preprocessing - information. + knowledge_base (KnowledgeBase): is used to store the system configuration. """ @abc.abstractmethod @@ -1033,16 +1029,14 @@ def PrepareMergeTaskStorage(self, task): raise NotImplementedError() @abc.abstractmethod - def ReadPreprocessingInformation(self, knowledge_base): - """Reads preprocessing information. + def ReadSystemConfiguration(self, knowledge_base): + """Reads system configuration information. - The preprocessing information contains the system configuration which - contains information about various system specific configuration data, - for example the user accounts. + The system configuration contains information about various system specific + configuration data, for example the user accounts. Args: - knowledge_base (KnowledgeBase): is used to store the preprocessing - information. + knowledge_base (KnowledgeBase): is used to store the system configuration. """ # pylint: disable=unused-argument diff --git a/tests/multi_processing/psort.py b/tests/multi_processing/psort.py index e619455af2..6ebbb26def 100644 --- a/tests/multi_processing/psort.py +++ b/tests/multi_processing/psort.py @@ -325,7 +325,7 @@ def testInternalAnalyzeEvents(self): storage_writer.StartTaskStorage() storage_writer.Open() - storage_writer.ReadPreprocessingInformation(knowledge_base_object) + storage_writer.ReadSystemConfiguration(knowledge_base_object) # TODO: implement, this currently loops infinite. # test_engine._AnalyzeEvents(storage_writer, [test_plugin]) @@ -343,7 +343,7 @@ def testInternalAnalyzeEvents(self): storage_writer.StartTaskStorage() storage_writer.Open() - storage_writer.ReadPreprocessingInformation(knowledge_base_object) + storage_writer.ReadSystemConfiguration(knowledge_base_object) # TODO: implement, this currently loops infinite. _ = test_engine @@ -379,7 +379,7 @@ def testInternalExportEvents(self): storage_reader = ( storage_factory.StorageFactory.CreateStorageReaderForFile(temp_file)) - storage_reader.ReadPreprocessingInformation(knowledge_base_object) + storage_reader.ReadSystemConfiguration(knowledge_base_object) test_engine._ExportEvents( storage_reader, output_module, deduplicate_events=False) @@ -412,7 +412,7 @@ def testInternalExportEventsDeduplicate(self): storage_reader = ( storage_factory.StorageFactory.CreateStorageReaderForFile(temp_file)) - storage_reader.ReadPreprocessingInformation(knowledge_base_object) + storage_reader.ReadSystemConfiguration(knowledge_base_object) test_engine._ExportEvents(storage_reader, output_module) diff --git a/tests/output/test_lib.py b/tests/output/test_lib.py index cc0846eed6..b12a192b48 100644 --- a/tests/output/test_lib.py +++ b/tests/output/test_lib.py @@ -82,7 +82,7 @@ def _CreateOutputMediator(self, storage_file=None): knowledge_base_object = knowledge_base.KnowledgeBase() if storage_file: - storage_file.ReadPreprocessingInformation(knowledge_base_object) + storage_file.ReadSystemConfiguration(knowledge_base_object) formatter_mediator = formatters_mediator.FormatterMediator() output_mediator = mediator.OutputMediator( diff --git a/tests/storage/sqlite/sqlite_file.py b/tests/storage/sqlite/sqlite_file.py index 0c08b8fca7..cc47ed682f 100644 --- a/tests/storage/sqlite/sqlite_file.py +++ b/tests/storage/sqlite/sqlite_file.py @@ -529,7 +529,7 @@ def testGetSortedEvents(self): # TODO: add tests for Open and Close - # TODO: add tests for ReadPreprocessingInformation + # TODO: add tests for ReadSystemConfiguration # TODO: add tests for WritePreprocessingInformation def testWriteSessionStartAndCompletion(self):