From 464ed61f15c7ef0b3c30496e721335881613a689 Mon Sep 17 00:00:00 2001 From: hacktobeer Date: Wed, 27 Sep 2023 15:09:43 +0000 Subject: [PATCH] Implement VERSION_CHECK configuration setting. --- docker/local/local-config.sed | 1 + turbinia/config/__init__.py | 1 + turbinia/config/turbinia_config_tmpl.py | 4 ++++ turbinia/workers/__init__.py | 17 +++++++++-------- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/docker/local/local-config.sed b/docker/local/local-config.sed index 47a1d9c3a..380fbd791 100644 --- a/docker/local/local-config.sed +++ b/docker/local/local-config.sed @@ -8,4 +8,5 @@ s/OUTPUT_DIR = .*/OUTPUT_DIR = '\/evidence'/g s/MOUNT_DIR_PREFIX = .*/MOUNT_DIR_PREFIX = '\/tmp\/turbinia-mounts'/g s/SHARED_FILESYSTEM = .*/SHARED_FILESYSTEM = True/g s/DEBUG_TASKS = .*/DEBUG_TASKS = True/g +s/VERSION_CHECK = .*/VERSION_CHECK = False/g s/DISABLED_JOBS = .*/DISABLED_JOBS = ['DfdeweyJob', 'VolatilityJob', 'HindsightJob']/g diff --git a/turbinia/config/__init__.py b/turbinia/config/__init__.py index 2e4db2ffa..dd74d9a62 100644 --- a/turbinia/config/__init__.py +++ b/turbinia/config/__init__.py @@ -60,6 +60,7 @@ 'MOUNT_DIR_PREFIX', 'SHARED_FILESYSTEM', 'DEBUG_TASKS', + 'VERSION_CHECK', 'DEPENDENCIES', 'DOCKER_ENABLED', 'DISABLED_JOBS', diff --git a/turbinia/config/turbinia_config_tmpl.py b/turbinia/config/turbinia_config_tmpl.py index 88d134705..928e3e98e 100644 --- a/turbinia/config/turbinia_config_tmpl.py +++ b/turbinia/config/turbinia_config_tmpl.py @@ -97,6 +97,10 @@ # problems. DEBUG_TASKS = False +# This indicates whether the server and worker version need to be the same. +# Makes sense to set to False while developing. +VERSION_CHECK = True + # Directory keeping all eligible recipes RECIPE_FILE_DIR = None diff --git a/turbinia/workers/__init__.py b/turbinia/workers/__init__.py index a8050fb17..19840281f 100644 --- a/turbinia/workers/__init__.py +++ b/turbinia/workers/__init__.py @@ -1061,14 +1061,15 @@ def run_wrapper(self, evidence): self.evidence_setup(evidence) - if self.turbinia_version != __version__: - message = ( - 'Worker and Server versions do not match: {0:s} != {1:s}'.format( - self.turbinia_version, __version__)) - self.result.log(message, level=logging.ERROR) - self.result.status = message - self.result.successful = False - return self.result.serialize() + if config.VERSION_CHECK: + if self.turbinia_version != __version__: + message = ( + 'Worker and Server versions do not match: {0:s} != {1:s}' + .format(self.turbinia_version, __version__)) + self.result.log(message, level=logging.ERROR) + self.result.status = message + self.result.successful = False + return self.result.serialize() self.result.update_task_status(self, 'running') self._evidence_config = evidence.config