Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/certbot/certbot.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'certbot-apache/certbot_apache/_internal/configurator.py')
-rw-r--r--certbot-apache/certbot_apache/_internal/configurator.py28
1 files changed, 20 insertions, 8 deletions
diff --git a/certbot-apache/certbot_apache/_internal/configurator.py b/certbot-apache/certbot_apache/_internal/configurator.py
index 4c68c5ae8..41209deb4 100644
--- a/certbot-apache/certbot_apache/_internal/configurator.py
+++ b/certbot-apache/certbot_apache/_internal/configurator.py
@@ -85,6 +85,10 @@ class OsOptions:
self.restart_cmd = ['apache2ctl', 'graceful'] if not restart_cmd else restart_cmd
self.restart_cmd_alt = restart_cmd_alt
self.conftest_cmd = ['apache2ctl', 'configtest'] if not conftest_cmd else conftest_cmd
+ syntax_tests_cmd_base = [ctl, '-t', '-D']
+ self.get_defines_cmd = syntax_tests_cmd_base + ['DUMP_RUN_CFG']
+ self.get_includes_cmd = syntax_tests_cmd_base + ['DUMP_INCLUDES']
+ self.get_modules_cmd = syntax_tests_cmd_base + ['DUMP_MODULES']
self.enmod = enmod
self.dismod = dismod
self.le_vhost_ext = le_vhost_ext
@@ -166,6 +170,17 @@ class ApacheConfigurator(common.Configurator):
return apache_util.find_ssl_apache_conf("old")
return apache_util.find_ssl_apache_conf("current")
+ def _override_cmds(self) -> None:
+ """
+ Set our various command binaries to whatever the user has overridden for apachectl
+ """
+ self.options.version_cmd[0] = self.options.ctl
+ self.options.restart_cmd[0] = self.options.ctl
+ self.options.conftest_cmd[0] = self.options.ctl
+ self.options.get_modules_cmd[0] = self.options.ctl
+ self.options.get_includes_cmd[0] = self.options.ctl
+ self.options.get_defines_cmd[0] = self.options.ctl
+
def _prepare_options(self) -> None:
"""
Set the values possibly changed by command line parameters to
@@ -181,10 +196,7 @@ class ApacheConfigurator(common.Configurator):
else:
setattr(self.options, o, getattr(self.OS_DEFAULTS, o))
- # Special cases
- self.options.version_cmd[0] = self.options.ctl
- self.options.restart_cmd[0] = self.options.ctl
- self.options.conftest_cmd[0] = self.options.ctl
+ self._override_cmds()
@classmethod
def add_parser_arguments(cls, add: Callable[..., None]) -> None:
@@ -476,9 +488,9 @@ class ApacheConfigurator(common.Configurator):
if HAS_APACHECONFIG:
apache_vars = {
- "defines": apache_util.parse_defines(self.options.ctl),
- "includes": apache_util.parse_includes(self.options.ctl),
- "modules": apache_util.parse_modules(self.options.ctl),
+ "defines": apache_util.parse_defines(self.options.get_defines_cmd),
+ "includes": apache_util.parse_includes(self.options.get_includes_cmd),
+ "modules": apache_util.parse_modules(self.options.get_modules_cmd),
}
metadata["apache_vars"] = apache_vars
@@ -800,7 +812,7 @@ class ApacheConfigurator(common.Configurator):
return self._find_best_vhost(target, filtered_vhosts, filter_defaults)
def _find_best_vhost(
- self, target_name: str, vhosts: List[obj.VirtualHost] = None,
+ self, target_name: str, vhosts: Optional[List[obj.VirtualHost]] = None,
filter_defaults: bool = True
) -> Optional[obj.VirtualHost]:
"""Finds the best vhost for a target_name.