From d363a7870ad3378a1688d1ddb28969429e6a7529 Mon Sep 17 00:00:00 2001 From: Guilhem Marchand Date: Fri, 4 Oct 2024 12:21:49 +0100 Subject: [PATCH] Version 1.1.7 - Splunk UCC, SDK and other librairies refresh to very last versions - Switch http.status_code verification from an explicit list of 2* codes to allow any 2* code, this change is to allow a workaround using Power Automate Flow to allow the deprecation of message cards by Microsoft. --- docs/releasenotes.rst | 6 ++++++ .../modalert_ms_teams_publish_to_channel_helper.py | 6 +++--- ...lert_ms_teams_publish_to_channel_replay_helper.py | 12 ++++++------ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/docs/releasenotes.rst b/docs/releasenotes.rst index 189d1be..cd7bb1d 100644 --- a/docs/releasenotes.rst +++ b/docs/releasenotes.rst @@ -1,6 +1,12 @@ Release notes ############# +Version 1.1.7 +============= + +- Splunk UCC, SDK and other librairies refresh to very last versions +- Switch http.status_code verification from an explicit list of 2* codes to allow any 2* code, this change is to allow a workaround using Power Automate Flow to allow the deprecation of message cards by Microsoft. + Version 1.1.6 ============= diff --git a/package/bin/ta_ms_teams_alert_action/modalert_ms_teams_publish_to_channel_helper.py b/package/bin/ta_ms_teams_alert_action/modalert_ms_teams_publish_to_channel_helper.py index e85dfd6..e1adb7e 100644 --- a/package/bin/ta_ms_teams_alert_action/modalert_ms_teams_publish_to_channel_helper.py +++ b/package/bin/ta_ms_teams_alert_action/modalert_ms_teams_publish_to_channel_helper.py @@ -569,7 +569,7 @@ def process_event(helper, *args, **kwargs): use_proxy=opt_use_proxy, ) # No http exception, but http post was not successful - if response.status_code not in (200, 201, 204): + if not (200 <= response.status_code < 300): helper.log_error( "Microsoft Teams publish to channel has failed!. " @@ -613,7 +613,7 @@ def process_event(helper, *args, **kwargs): response = requests.post( record_url, headers=headers, data=record, verify=False ) - if response.status_code not in (200, 201, 204): + if not (200 <= response.status_code < 300): helper.log_error( "KVstore saving has failed!. url={}, data={}, HTTP Error={}, " "content={}".format( @@ -668,7 +668,7 @@ def process_event(helper, *args, **kwargs): response = requests.post( record_url, headers=headers, data=record, verify=False ) - if response.status_code not in (200, 201, 204): + if not (200 <= response.status_code < 300): helper.log_error( "KVstore saving has failed!. url={}, data={}, HTTP Error={}, " "content={}".format( diff --git a/package/bin/ta_ms_teams_alert_action/modalert_ms_teams_publish_to_channel_replay_helper.py b/package/bin/ta_ms_teams_alert_action/modalert_ms_teams_publish_to_channel_replay_helper.py index 33c0206..fbcdb94 100755 --- a/package/bin/ta_ms_teams_alert_action/modalert_ms_teams_publish_to_channel_replay_helper.py +++ b/package/bin/ta_ms_teams_alert_action/modalert_ms_teams_publish_to_channel_replay_helper.py @@ -134,7 +134,7 @@ def process_event(helper, *args, **kwargs): ) # No http exception, but http post was not successful - if response.status_code not in (200, 201, 204): + if not (200 <= response.status_code < 300): helper.log_error( "Microsoft Teams publish to channel has failed!. " "url={}, data={}, HTTP Error={}, HTTP Reason={}, HTTP content={}".format( @@ -181,7 +181,7 @@ def process_event(helper, *args, **kwargs): response = requests.post( record_url, headers=headers, data=record, verify=False ) - if response.status_code not in (200, 201, 204): + if not (200 <= response.status_code < 300): helper.log_error( "KVstore saving has failed!. url={}, data={}, HTTP Error={}, " "content={}".format( @@ -213,7 +213,7 @@ def process_event(helper, *args, **kwargs): # Splunk Cloud vetting note, this communication is a localhost communication to splunkd # and does not have to be verified response = requests.delete(record_url, headers=headers, verify=False) - if response.status_code not in (200, 201, 204): + if not (200 <= response.status_code < 300): helper.log_error( "KVstore delete operation has failed!. url={}, HTTP Error={}, " "content={}".format( @@ -265,7 +265,7 @@ def process_event(helper, *args, **kwargs): response = requests.post( record_url, headers=headers, data=record, verify=False ) - if response.status_code not in (200, 201, 204): + if not (200 <= response.status_code < 300): helper.log_error( "KVstore saving has failed!. url={}, data={}, HTTP Error={}, " "content={}".format( @@ -314,7 +314,7 @@ def process_event(helper, *args, **kwargs): # Splunk Cloud vetting note, this communication is a localhost communication to splunkd and # does not have to be verified response = requests.post(record_url, headers=headers, data=record, verify=False) - if response.status_code not in (200, 201, 204): + if not (200 <= response.status_code < 300): helper.log_error( "KVstore saving has failed!. url={}, data={}, HTTP Error={}, " "content={}".format( @@ -352,7 +352,7 @@ def process_event(helper, *args, **kwargs): # Splunk Cloud vetting note, this communication is a localhost communication to splunkd and # does not have to be verified response = requests.delete(record_url, headers=headers, verify=False) - if response.status_code not in (200, 201, 204): + if not (200 <= response.status_code < 300): helper.log_error( "KVstore delete operation has failed!. url={}, HTTP Error={}, " "content={}".format(record_url, response.status_code, response.text)