Skip to content

Commit

Permalink
Release 0.15.5
Browse files Browse the repository at this point in the history
  • Loading branch information
wh1te909 committed Dec 8, 2022
2 parents 824cbdc + 483bf33 commit 4987482
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
33 changes: 33 additions & 0 deletions api/tacticalrmm/autotasks/migrations/0038_add_missing_env_vars.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from django.db import migrations


def migrate_env_vars(apps, schema_editor):
AutomatedTask = apps.get_model("autotasks", "AutomatedTask")
for task in AutomatedTask.objects.iterator(chunk_size=30):
try:
tmp = []
if isinstance(task.actions, list) and task.actions:
for t in task.actions:
if isinstance(t, dict):
if t["type"] == "script":
try:
t["env_vars"]
except KeyError:
t["env_vars"] = []
tmp.append(t)
if tmp:
task.actions = tmp
task.save(update_fields=["actions"])
except Exception as e:
print(f"ERROR: {e}")


class Migration(migrations.Migration):

dependencies = [
("autotasks", "0037_alter_taskresult_retcode"),
]

operations = [
migrations.RunPython(migrate_env_vars),
]
8 changes: 7 additions & 1 deletion api/tacticalrmm/autotasks/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@ def get_task_actions(self, obj):
# script doesn't exist so remove it
actions_to_remove.append(action["script"])
continue
# wrote a custom migration for env_vars but leaving this just in case.
# can be removed later
try:
env_vars = action["env_vars"]
except KeyError:
env_vars = []
tmp.append(
{
"type": "script",
Expand All @@ -241,7 +247,7 @@ def get_task_actions(self, obj):
"shell": script.shell,
"timeout": action["timeout"],
"run_as_user": script.run_as_user,
"env_vars": action["env_vars"],
"env_vars": env_vars,
}
)
if actions_to_remove:
Expand Down
2 changes: 1 addition & 1 deletion api/tacticalrmm/tacticalrmm/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
AUTH_USER_MODEL = "accounts.User"

# latest release
TRMM_VERSION = "0.15.4"
TRMM_VERSION = "0.15.5"

# https://github.com/amidaware/tacticalrmm-web
WEB_VERSION = "0.101.9"
Expand Down

0 comments on commit 4987482

Please sign in to comment.