From 1d6023e6d8563851370c2446a08682ac21c70e05 Mon Sep 17 00:00:00 2001 From: Jasmine Schladen Date: Wed, 24 Feb 2021 13:42:43 -0800 Subject: [PATCH] Reuse get_option --- lemur/plugins/lemur_aws/sns.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lemur/plugins/lemur_aws/sns.py b/lemur/plugins/lemur_aws/sns.py index cde9ed9c..f44f8702 100644 --- a/lemur/plugins/lemur_aws/sns.py +++ b/lemur/plugins/lemur_aws/sns.py @@ -11,6 +11,8 @@ import arrow import boto3 from flask import current_app +from lemur.plugins.lemur_aws.plugin import SNSNotificationPlugin + def publish(topic_arn, certificates, notification_type, options, **kwargs): sns_client = boto3.client("sns", **kwargs) @@ -64,8 +66,8 @@ def format_message(certificate, notification_type, options): def calculate_expiration_days(options): - unit = get_option(options, "unit") - interval = get_option(options, "interval") + unit = SNSNotificationPlugin.get_option("unit", options) + interval = SNSNotificationPlugin.get_option("interval", options) if unit == "weeks": return interval * 7 @@ -74,9 +76,3 @@ def calculate_expiration_days(options): elif unit == "days": return interval - - -def get_option(options, option_name): - for o in options: - if o.get("name") == option_name: - return o.get("value", o.get("default"))