Skip to content

Commit

Permalink
Merge pull request #12 from transcom/mb-11557
Browse files Browse the repository at this point in the history
[MB-11557] Make Config Notifier fire only if there's something in the report to add
  • Loading branch information
chtakahashi authored Mar 9, 2022
2 parents 414e26f + 44f713b commit deac6d1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions notifier/notifier/notifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,13 @@ def prepare_sns_message(title="", report=None, additional_text=""):
message (str): the formatted string
"""
message = f"{title}\n```"
send_to_sns = False
if len(report) > 0:
send_to_sns = True
message += "\n".join([f"{result['resource_type']}: {result['count']}" for result in report])
LOGGER.info(f"message: {message}")
message += f"```\n{additional_text}"

send_to_sns = False
if len(message) > 0:
send_to_sns = True

return send_to_sns, message

def send_sns_message(topic_arn="", payload=""):
Expand Down

0 comments on commit deac6d1

Please sign in to comment.