mirror of
https://github.com/certbot/certbot.git
synced 2026-08-02 19:22:16 +02:00
Refactor storage.relevant_values
This commit is contained in:
+8
-15
@@ -7,8 +7,10 @@ import re
|
|||||||
import configobj
|
import configobj
|
||||||
import parsedatetime
|
import parsedatetime
|
||||||
import pytz
|
import pytz
|
||||||
|
import six
|
||||||
|
|
||||||
import certbot
|
import certbot
|
||||||
|
from certbot import cli
|
||||||
from certbot import constants
|
from certbot import constants
|
||||||
from certbot import crypto_util
|
from certbot import crypto_util
|
||||||
from certbot import errors
|
from certbot import errors
|
||||||
@@ -158,22 +160,13 @@ def relevant_values(all_values):
|
|||||||
:param dict all_values: The original values.
|
:param dict all_values: The original values.
|
||||||
|
|
||||||
:returns: A new dictionary containing items that can be used in renewal.
|
:returns: A new dictionary containing items that can be used in renewal.
|
||||||
:rtype dict:"""
|
:rtype dict:
|
||||||
|
|
||||||
from certbot import cli
|
"""
|
||||||
|
return dict(
|
||||||
values = dict()
|
(option, value)
|
||||||
for option, value in all_values.iteritems():
|
for option, value in six.iteritems(all_values)
|
||||||
# Try to find reasons to store this item in the
|
if _relevant(option) and cli.option_was_set(option, value))
|
||||||
# renewal config. It can be stored if it is relevant and
|
|
||||||
# (it is set_by_cli(), we don't know the default value, or
|
|
||||||
# the current value differs from the default value).
|
|
||||||
if _relevant(option):
|
|
||||||
if (cli.set_by_cli(option) or
|
|
||||||
option not in cli.DEFAULTS or
|
|
||||||
cli.DEFAULTS[option] != value):
|
|
||||||
values[option] = value
|
|
||||||
return values
|
|
||||||
|
|
||||||
|
|
||||||
class RenewableCert(object): # pylint: disable=too-many-instance-attributes
|
class RenewableCert(object): # pylint: disable=too-many-instance-attributes
|
||||||
|
|||||||
Reference in New Issue
Block a user