Add type annotations to the certbot package (part 1) (#9084)

* Extract from #9084

* Cast/ignore types during the transition

* Fix after review

* Fix lint
This commit is contained in:
Adrien Ferrand
2021-11-12 14:27:46 +11:00
committed by GitHub
parent 4756b66089
commit d20e42562c
34 changed files with 347 additions and 230 deletions
@@ -2437,10 +2437,9 @@ class ApacheConfigurator(common.Installer, interfaces.Authenticator):
except errors.SubprocessError as err:
logger.warning("Unable to restart apache using %s",
self.options.restart_cmd)
alt_restart = self.options.restart_cmd_alt
if alt_restart:
if self.options.restart_cmd_alt:
logger.debug("Trying alternative restart command: %s",
alt_restart)
self.options.restart_cmd_alt)
# There is an alternative restart command available
# This usually is "restart" verb while original is "graceful"
try:
@@ -118,7 +118,8 @@ class DebianConfigurator(configurator.ApacheConfigurator):
# Generate reversal command.
# Try to be safe here... check that we can probably reverse before
# applying enmod command
if not util.exe_exists(self.options.dismod):
if (self.options.dismod is None or self.options.enmod is None
or not util.exe_exists(self.options.dismod)):
raise errors.MisconfigurationError(
"Unable to find a2dismod, please make sure a2enmod and "
"a2dismod are configured correctly for certbot.")