Skip to content

Commit

Permalink
Move "TASK_ID_CUSTOM" string into variable
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesbraun committed Sep 24, 2024
1 parent a2dbbdf commit 330b22c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utilities/safeexec.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,10 @@ def add_dir(path, read_only, volumes):
if settings.DOCKER_CONTAINER_EXTERNAL_DIR is not None:
external_dir = None
tmpl = string.Template(settings.DOCKER_CONTAINER_EXTERNAL_DIR)
requires_task_id_custom = "TASK_ID_CUSTOM" in tmpl.get_identifiers()
var_id = "TASK_ID_CUSTOM"
requires_task_id_custom = var_id in tmpl.get_identifiers()
if requires_task_id_custom:
task_id_custom = environment_variables.get('TASK_ID_CUSTOM')
task_id_custom = environment_variables.get(var_id)
if task_id_custom is not None and task_id_custom != "":
external_dir = string.Template(settings.DOCKER_CONTAINER_EXTERNAL_DIR).substitute(TASK_ID_CUSTOM=task_id_custom)
else:
Expand Down

0 comments on commit 330b22c

Please sign in to comment.