Skip to content

Commit

Permalink
Fix the way to update status
Browse files Browse the repository at this point in the history
  • Loading branch information
TOUFIKIzakarya committed Jul 30, 2024
1 parent f15f14b commit 2cbfbc2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,19 @@ def post_comment(alert_short_id: str, comment: Optional[str], author: str):
)


def update_status(MirrorEnable: str, alert_short_id: str, new_status: str):
if MirrorEnable in ["Out", "Both"]:
execute_command("setIncident", {"sekoiaalertstatus": new_status})
elif MirrorEnable == "In":
execute_command(
"sekoia-xdr-update-status-alert",
{"id": alert_short_id, "status": new_status},
)
else:
execute_command(
"sekoia-xdr-update-status-alert",
{"id": alert_short_id, "status": new_status},
)
execute_command("setIncident", {"sekoiaalertstatus": new_status})
def update_status(new_status: str):
execute_command("setIncident", {"sekoiaalertstatus": new_status})


def main():
incident = demisto.incidents()[0] # type: ignore
isMirrorEnable = incident.get("dbotMirrorDirection")
alert_short_id = demisto.args()["short_id"]
new_status = demisto.args()["status"]
comment = demisto.args().get("comment")

if new_status in ["Ongoing", "Acknowledged"]:
if comment:
post_comment(alert_short_id, comment, get_username())
update_status(isMirrorEnable, alert_short_id, new_status)
update_status(alert_short_id)
readable_output = f"### Status of the alert changed to:\n {new_status}"
return_results(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ def test_get_username(mocker):


def test_main(mocker):
mocker.patch.object(
demisto, "incidents", return_value=[{"dbotMirrorDirection": "In"}]
)
mocker.patch.object(
demisto,
"args",
Expand Down

0 comments on commit 2cbfbc2

Please sign in to comment.