Skip to content

Commit

Permalink
fixes bugs in update processors
Browse files Browse the repository at this point in the history
  • Loading branch information
droid-mohit committed Apr 25, 2024
1 parent 58851c4 commit 7a53064
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion executor/crud/playbooks_update_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,16 @@ def update_playbook(elem: PlayBook, update_op: UpdatePlaybookOp.UpdatePlaybook)
for task in tasks:
task.is_active = False
task.save(update_fields=['is_active'])
elem.is_active = False
elem.save(update_fields=['is_active'])
updated_playbook = update_op.playbook
updated_elem, err = create_db_playbook(elem.account, elem.created_by, updated_playbook)
if err:
raise Exception(err)
return updated_elem
except Exception as ex:
logger.exception(f"Error occurred updating playbook for {elem.name}")
raise Exception(f"Error occurred updating playbook status for {elem.name}")
return elem

@staticmethod
def update_playbook_alert_ops_trigger_status(elem: PlayBook,
Expand Down
8 changes: 5 additions & 3 deletions executor/workflows/crud/workflows_update_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,16 @@ def update_workflow(elem: Workflow, update_op: UpdateWorkflowOp.UpdateWorkflow)
for action_mapping in all_workflow_actions_mapping:
action_mapping.is_active = False
action_mapping.save(update_fields=['is_active'])
elem.is_active = False
elem.save(update_fields=['is_active'])
updated_workflow = update_op.workflow
updated_elem, err = create_db_workflow(elem.account, elem.created_by, updated_workflow)
if err:
raise Exception(err)
return updated_elem
except Exception as ex:
logger.exception(f"Error occurred updating workflow for {elem.name}")
raise Exception(f"Error occurred updating workflow status for {elem.name}")
return elem
logger.exception(f"Error occurred updating workflow for {elem.name}, {str(ex)}")
raise Exception(f"Error occurred updating workflow status for {elem.name}, {str(ex)}")

@staticmethod
def update_workflow_entry_point_status(elem: Workflow,
Expand Down

0 comments on commit 7a53064

Please sign in to comment.