diff --git a/lemur/notifications/service.py b/lemur/notifications/service.py index e6e3ddf1..3c944580 100644 --- a/lemur/notifications/service.py +++ b/lemur/notifications/service.py @@ -59,13 +59,18 @@ def _deduplicate(messages): for m, r, o in roll_ups: if r == targets: - m.append(data) - current_app.logger.info( - "Sending expiration alert about {0} to {1}".format( - data['name'], ",".join(targets))) + for cert in m: + if cert['body'] == data['body']: + break + else: + m.append(data) + current_app.logger.info( + "Sending expiration alert about {0} to {1}".format( + data['name'], ",".join(targets))) break else: roll_ups.append(([data], targets, options)) + return roll_ups diff --git a/lemur/plugins/lemur_email/plugin.py b/lemur/plugins/lemur_email/plugin.py index 19dd50fe..f2166d78 100644 --- a/lemur/plugins/lemur_email/plugin.py +++ b/lemur/plugins/lemur_email/plugin.py @@ -53,12 +53,12 @@ class EmailNotificationPlugin(ExpirationNotificationPlugin): # jinja template depending on type template = env.get_template('{}.html'.format(event_type)) - body = template.render(**kwargs) + body = template.render(dict(messages=message, hostname=current_app.config.get('LEMUR_HOSTNAME'))) s_type = current_app.config.get("LEMUR_EMAIL_SENDER", 'ses').lower() if s_type == 'ses': conn = boto.connect_ses() - conn.send_email(current_app.config.get("LEMUR_EMAIL"), subject, body, ['kglisson@netflix.com'], format='html') + conn.send_email(current_app.config.get("LEMUR_EMAIL"), subject, body, targets, format='html') elif s_type == 'smtp': msg = Message(subject, recipients=targets) diff --git a/lemur/plugins/lemur_email/templates/expiration.html b/lemur/plugins/lemur_email/templates/expiration.html index f5459496..f3584bd2 100644 --- a/lemur/plugins/lemur_email/templates/expiration.html +++ b/lemur/plugins/lemur_email/templates/expiration.html @@ -52,8 +52,13 @@ Notice: Your SSL certificates are expiring!
+ Lemur, Netflix's SSL management portal has noticed that the following certificates are expiring soon, if you rely on these certificates + you should create new certificates to replace the certificates that are expiring. +
++ Visit https://{{ hostname }}/#/certificates/create to reissue them. +
{% for message in messages %} @@ -78,6 +83,12 @@