From 55841179be364438ef6700646f381e90b28ad161 Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Fri, 8 Dec 2023 14:11:40 +0100 Subject: [PATCH] Slack webhook: send some task results to #support --- lemarche/siaes/management/commands/sync_c2_c4.py | 8 ++++++-- .../management/commands/sync_with_emplois_inclusion.py | 2 +- .../management/commands/update_siae_super_badge_field.py | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lemarche/siaes/management/commands/sync_c2_c4.py b/lemarche/siaes/management/commands/sync_c2_c4.py index 31a46aa56..7de0f3dd0 100644 --- a/lemarche/siaes/management/commands/sync_c2_c4.py +++ b/lemarche/siaes/management/commands/sync_c2_c4.py @@ -82,10 +82,14 @@ def handle(self, dry_run=False, **options): f"ETP count updated: {siae_etp_updated_count}", ] self.stdout_messages_success(msg_success) - api_slack.send_message_to_channel("\n".join(msg_success)) + api_slack.send_message_to_channel( + "\n".join(msg_success), service_id=settings.SLACK_WEBHOOK_C4_SUPPORT_CHANNEL + ) except Exception as e: self.stdout_error(str(e)) - api_slack.send_message_to_channel("Erreur lors de la synchronisation C2 <-> C4") + api_slack.send_message_to_channel( + "Erreur lors de la synchronisation C2 <-> C4", service_id=settings.SLACK_WEBHOOK_C4_SUPPORT_CHANNEL + ) raise Exception(e) def c2_etp_export(self): diff --git a/lemarche/siaes/management/commands/sync_with_emplois_inclusion.py b/lemarche/siaes/management/commands/sync_with_emplois_inclusion.py index 807b28e66..c74639b35 100644 --- a/lemarche/siaes/management/commands/sync_with_emplois_inclusion.py +++ b/lemarche/siaes/management/commands/sync_with_emplois_inclusion.py @@ -152,7 +152,7 @@ def handle(self, dry_run=False, **options): f"Siae delisted: before {siae_delisted_before} / after {siae_delisted_after}", ] self.stdout_messages_success(msg_success) - api_slack.send_message_to_channel("\n".join(msg_success)) + api_slack.send_message_to_channel("\n".join(msg_success), service_id=settings.SLACK_WEBHOOK_C4_SUPPORT_CHANNEL) def c1_export(self): # noqa C901 try: diff --git a/lemarche/siaes/management/commands/update_siae_super_badge_field.py b/lemarche/siaes/management/commands/update_siae_super_badge_field.py index 08bca1e1c..a107ebc95 100644 --- a/lemarche/siaes/management/commands/update_siae_super_badge_field.py +++ b/lemarche/siaes/management/commands/update_siae_super_badge_field.py @@ -1,5 +1,6 @@ import calendar +from django.conf import settings from django.core.management.base import CommandError from django.utils import timezone @@ -77,4 +78,4 @@ def handle(self, *args, **options): f"Siaes with badge: before {siae_with_super_badge_count_before} / after {siae_with_super_badge_count_after}", # noqa ] self.stdout_messages_success(msg_success) - api_slack.send_message_to_channel("\n".join(msg_success)) + api_slack.send_message_to_channel("\n".join(msg_success), service_id=settings.SLACK_WEBHOOK_C4_SUPPORT_CHANNEL)