Skip to content

Commit

Permalink
Implement VERSION_CHECK configuration setting.
Browse files Browse the repository at this point in the history
  • Loading branch information
hacktobeer committed Sep 27, 2023
1 parent c0041aa commit 464ed61
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions docker/local/local-config.sed
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions turbinia/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
'MOUNT_DIR_PREFIX',
'SHARED_FILESYSTEM',
'DEBUG_TASKS',
'VERSION_CHECK',
'DEPENDENCIES',
'DOCKER_ENABLED',
'DISABLED_JOBS',
Expand Down
4 changes: 4 additions & 0 deletions turbinia/config/turbinia_config_tmpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 9 additions & 8 deletions turbinia/workers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 464ed61

Please sign in to comment.