-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:DrDroidLab/PlayBooks into sandbox
- Loading branch information
Showing
14 changed files
with
100 additions
and
34 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
executor/migrations/0043_migrate_logs_task_executions_to_new_def.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Generated by Django 4.1.13 on 2024-07-23 15:59 | ||
|
||
from django.db import migrations | ||
from hashlib import md5 | ||
|
||
|
||
def transform_logs_task_execution_task(apps, schema_editor): | ||
PlayBookTaskExecutionLog = apps.get_model("executor", "PlayBookTaskExecutionLog") | ||
|
||
for db_task in PlayBookTaskExecutionLog.objects.filter(playbook_task_result__type="LOGS"): | ||
try: | ||
task_result = db_task.playbook_task_result | ||
task_table_result = task_result.get('table', {}) | ||
if task_table_result: | ||
task_result['logs'] = task_table_result | ||
task_result.pop('table') | ||
db_task.save() | ||
except Exception as e: | ||
print('skip task transformation for task id: ', db_task.id) | ||
print(f"Error transforming task {db_task.id}: {e}") | ||
continue | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
('executor', '0042_playbooktaskexecutionlog_execution_global_variable_set'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(transform_logs_task_execution_task, migrations.RunPython.noop) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters