mirror of
https://github.com/certbot/certbot.git
synced 2026-06-08 16:22:18 -04:00
Lint this entire monstrosity
- Doing some of @schoen's refactoring homework for him :)
This commit is contained in:
parent
f7b374531a
commit
4d8dbc9d81
3 changed files with 13 additions and 14 deletions
|
|
@ -746,6 +746,8 @@ def _restore_required_config_elements(full_path, config, renewalparams):
|
|||
"a non-numeric value for %s. Skipping.",
|
||||
full_path, config_item)
|
||||
raise
|
||||
|
||||
def _restore_plugin_configs(config, renewalparams):
|
||||
# Now use parser to get plugin-prefixed items with correct types
|
||||
# XXX: the current approach of extracting only prefixed items
|
||||
# related to the actually-used installer and authenticator
|
||||
|
|
@ -767,13 +769,12 @@ def _restore_required_config_elements(full_path, config, renewalparams):
|
|||
config.__setattr__(config_item, None)
|
||||
continue
|
||||
if config_item.startswith(plugin_prefix + "_"):
|
||||
for action in _parser.parser._actions:
|
||||
if action.dest == config_item:
|
||||
if action.type is not None:
|
||||
config.__setattr__(config_item, action.type(renewalparams[config_item]))
|
||||
break
|
||||
for action in _parser.parser._actions: # pylint: disable=protected-access
|
||||
if action.type is not None and action.dest == config_item:
|
||||
config.__setattr__(config_item, action.type(renewalparams[config_item]))
|
||||
break
|
||||
else:
|
||||
config.__setattr__(config_item, str(renewalparams[config_item]))
|
||||
config.__setattr__(config_item, str(renewalparams[config_item]))
|
||||
return True
|
||||
|
||||
|
||||
|
|
@ -808,6 +809,7 @@ def _reconstitute(full_path, config):
|
|||
# those elements are present.
|
||||
try:
|
||||
_restore_required_config_elements(full_path, config, renewalparams)
|
||||
_restore_plugin_configs(config, renewalparams)
|
||||
except ValueError:
|
||||
# There was a data type error which has already been
|
||||
# logged.
|
||||
|
|
@ -861,7 +863,7 @@ def renew(cli_config, plugins):
|
|||
# elements from within the renewal configuration file).
|
||||
try:
|
||||
renewal_candidate = _reconstitute(renewal_file, config)
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
# reconstitute encountered an unanticipated problem.
|
||||
logger.warning("Renewal configuration file %s produced an "
|
||||
"unexpected error: %s. Skipping.", renewal_file, e)
|
||||
|
|
@ -1356,7 +1358,7 @@ def prepare_and_parse_args(plugins, args):
|
|||
# parser (--help should display plugin-specific options last)
|
||||
_plugins_parsing(helpful, plugins)
|
||||
|
||||
global _parser
|
||||
global _parser # pylint: disable=global-statement
|
||||
_parser = helpful
|
||||
return helpful.parse_args()
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,6 @@ s.serve_forever()" """
|
|||
def prepare(self): # pylint: disable=missing-docstring,no-self-use
|
||||
if self.config.noninteractive_mode:
|
||||
raise errors.PluginError("Running manual mode non-interactively is not supported")
|
||||
pass # pragma: no cover
|
||||
|
||||
def more_info(self): # pylint: disable=missing-docstring,no-self-use
|
||||
return ("This plugin requires user's manual intervention in setting "
|
||||
|
|
|
|||
|
|
@ -531,7 +531,8 @@ class CLITest(unittest.TestCase): # pylint: disable=too-many-public-methods
|
|||
self._certonly_new_request_common, mock_client)
|
||||
|
||||
def _test_renewal_common(self, due_for_renewal, extra_args, log_out=None,
|
||||
args=None, renew=True, out=False):
|
||||
args=None, renew=True):
|
||||
# pylint: disable=too-many-locals
|
||||
cert_path = 'letsencrypt/tests/testdata/cert.pem'
|
||||
chain_path = '/etc/letsencrypt/live/foo.bar/fullchain.pem'
|
||||
mock_lineage = mock.MagicMock(cert=cert_path, fullchain=chain_path)
|
||||
|
|
@ -556,10 +557,7 @@ class CLITest(unittest.TestCase): # pylint: disable=too-many-public-methods
|
|||
args = ['-d', 'isnot.org', '-a', 'standalone', 'certonly']
|
||||
if extra_args:
|
||||
args += extra_args
|
||||
if out:
|
||||
self._call_stdout(args)
|
||||
else:
|
||||
self._call(args)
|
||||
self._call(args)
|
||||
|
||||
if log_out:
|
||||
with open(os.path.join(self.logs_dir, "letsencrypt.log")) as lf:
|
||||
|
|
|
|||
Loading…
Reference in a new issue