PR feedback
This commit is contained in:
parent
645b45401d
commit
20b8c2fd93
|
@ -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:
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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"])
|
||||
}
|
||||
|
|
|
@ -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"])
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue