mirror of
https://github.com/certbot/certbot.git
synced 2026-06-05 14:54:24 -04:00
Do not suggest mod_macro vhost for the best vhost
This commit is contained in:
parent
aa0161fbec
commit
4bd0330ae7
1 changed files with 18 additions and 1 deletions
|
|
@ -307,6 +307,8 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
|
|||
best_points = 0
|
||||
|
||||
for vhost in self.vhosts:
|
||||
if vhost.modmacro is True:
|
||||
continue
|
||||
if target_name in vhost.get_names():
|
||||
points = 2
|
||||
elif any(addr.get_addr() == target_name for addr in vhost.addrs):
|
||||
|
|
@ -326,12 +328,27 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
|
|||
# No winners here... is there only one reasonable vhost?
|
||||
if best_candidate is None:
|
||||
# reasonable == Not all _default_ addrs
|
||||
reasonable_vhosts = self._non_default_vhosts()
|
||||
# remove mod_macro hosts from reasonable vhosts
|
||||
reasonable_vhosts = self._without_modmacro(
|
||||
self._non_default_vhosts())
|
||||
if len(reasonable_vhosts) == 1:
|
||||
best_candidate = reasonable_vhosts[0]
|
||||
|
||||
if best_candidate is not None and best_candidate.modmacro is True:
|
||||
return None
|
||||
return best_candidate
|
||||
|
||||
def _without_modmacro(self, vhosts):
|
||||
"""Return all non mod_macro vhosts
|
||||
|
||||
:param vhosts: List of VirtualHosts
|
||||
:type vhosts: (:class:`list` of :class:`~letsencrypt_apache.obj.VirtualHost`)
|
||||
|
||||
:returns: List of VirtualHosts without mod_macro
|
||||
:rtype: (:class:`list` of :class:`~letsencrypt_apache.obj.VirtualHost`)
|
||||
"""
|
||||
return [vh for vh in vhosts if vh.modmacro == False]
|
||||
|
||||
def _non_default_vhosts(self):
|
||||
"""Return all non _default_ only vhosts."""
|
||||
return [vh for vh in self.vhosts if not all(
|
||||
|
|
|
|||
Loading…
Reference in a new issue