mirror of
https://github.com/certbot/certbot.git
synced 2026-08-02 19:22:16 +02:00
Use cli.DEFAULTS in storage.py
This commit is contained in:
+5
-19
@@ -162,30 +162,16 @@ def relevant_values(all_values):
|
|||||||
|
|
||||||
from certbot import cli
|
from certbot import cli
|
||||||
|
|
||||||
def _is_cli_default(option, value):
|
|
||||||
# Look through the CLI parser defaults and see if this option is
|
|
||||||
# both present and equal to the specified value. If not, return
|
|
||||||
# False.
|
|
||||||
# pylint: disable=protected-access
|
|
||||||
for x in cli.helpful_parser.parser._actions:
|
|
||||||
if x.dest == option:
|
|
||||||
if x.default == value:
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
break
|
|
||||||
return False
|
|
||||||
|
|
||||||
values = dict()
|
values = dict()
|
||||||
for option, value in all_values.iteritems():
|
for option, value in all_values.iteritems():
|
||||||
# Try to find reasons to store this item in the
|
# Try to find reasons to store this item in the
|
||||||
# renewal config. It can be stored if it is relevant and
|
# renewal config. It can be stored if it is relevant and
|
||||||
# (it is set_by_cli() or flag_default() is different
|
# (it is set_by_cli(), we don't know the default value, or
|
||||||
# from the value or flag_default() doesn't exist).
|
# the current value differs from the default value).
|
||||||
if _relevant(option):
|
if _relevant(option):
|
||||||
if (cli.set_by_cli(option)
|
if (cli.set_by_cli(option) or
|
||||||
or not _is_cli_default(option, value)):
|
option not in cli.DEFAULTS or
|
||||||
# or option not in constants.CLI_DEFAULTS
|
cli.DEFAULTS[option] != value):
|
||||||
# or constants.CLI_DEFAULTS[option] != value):
|
|
||||||
values[option] = value
|
values[option] = value
|
||||||
return values
|
return values
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user