From 20b8c2fd93ddedf71eb3ade29757d10dc9797736 Mon Sep 17 00:00:00 2001 From: Jasmine Schladen Date: Tue, 27 Oct 2020 08:56:28 -0700 Subject: [PATCH] PR feedback --- lemur/notifications/messaging.py | 2 +- lemur/plugins/lemur_aws/plugin.py | 2 +- lemur/plugins/lemur_aws/sns.py | 3 ++- lemur/plugins/lemur_aws/tests/test_sns.py | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lemur/notifications/messaging.py b/lemur/notifications/messaging.py index 3928689e..ba4f331c 100644 --- a/lemur/notifications/messaging.py +++ b/lemur/notifications/messaging.py @@ -108,7 +108,7 @@ def send_plugin_notification(event_type, data, recipients, notification): } status = FAILURE_METRIC_STATUS try: - current_app.logger.debug(log_data) + current_app.logger.info(log_data) notification.plugin.send(event_type, data, recipients, notification.options) status = SUCCESS_METRIC_STATUS except Exception as e: diff --git a/lemur/plugins/lemur_aws/plugin.py b/lemur/plugins/lemur_aws/plugin.py index 8a54b035..1be641b0 100644 --- a/lemur/plugins/lemur_aws/plugin.py +++ b/lemur/plugins/lemur_aws/plugin.py @@ -453,5 +453,5 @@ class SNSNotificationPlugin(ExpirationNotificationPlugin): f"{self.get_option('accountNumber', options)}:" \ f"{self.get_option('topicName', options)}" - current_app.logger.debug(f"Publishing {notification_type} notification to topic {topic_arn}") + current_app.logger.info(f"Publishing {notification_type} notification to topic {topic_arn}") sns.publish(topic_arn, message, notification_type, region_name=self.get_option("region", options)) diff --git a/lemur/plugins/lemur_aws/sns.py b/lemur/plugins/lemur_aws/sns.py index f9fd4a07..c98bbc0c 100644 --- a/lemur/plugins/lemur_aws/sns.py +++ b/lemur/plugins/lemur_aws/sns.py @@ -32,6 +32,7 @@ def publish_single(sns_client, topic_arn, certificate, notification_type): raise Exception(f"Failed to publish {notification_type} notification to SNS topic {topic_arn}. " f"SNS response: {response_code} {response}") + current_app.logger.info(f"AWS SNS message published to topic [{topic_arn}] with message ID {response['MessageId']}") current_app.logger.debug(f"AWS SNS message published to topic [{topic_arn}]: [{response}]") return response["MessageId"] @@ -47,7 +48,7 @@ def format_message(certificate, notification_type): json_message = { "notification_type": notification_type, "certificate_name": certificate["name"], - "expires": arrow.get(certificate["validityEnd"]).format("dddd, MMMM D, YYYY"), + "expires": arrow.get(certificate["validityEnd"]).format("YYYY-MM-ddTHH:mm:ss"), # 2047-12-T22:00:00 "endpoints_detected": len(certificate["endpoints"]), "details": create_certificate_url(certificate["name"]) } diff --git a/lemur/plugins/lemur_aws/tests/test_sns.py b/lemur/plugins/lemur_aws/tests/test_sns.py index df495f80..ce05c33c 100644 --- a/lemur/plugins/lemur_aws/tests/test_sns.py +++ b/lemur/plugins/lemur_aws/tests/test_sns.py @@ -20,7 +20,7 @@ def test_format(certificate, endpoint): expected_message = { "notification_type": "expiration", "certificate_name": certificate["name"], - "expires": arrow.get(certificate["validityEnd"]).format("dddd, MMMM D, YYYY"), + "expires": arrow.get(certificate["validityEnd"]).format("YYYY-MM-ddTHH:mm:ss"), "endpoints_detected": 0, "details": "https://lemur.example.com/#/certificates/{name}".format(name=certificate["name"]) }