From 1a9e6b1a8a8ce6fc53d4118c3a85a44e90e5bb9c Mon Sep 17 00:00:00 2001 From: sagi Date: Wed, 2 Dec 2015 01:06:48 +0000 Subject: [PATCH] add _is_rewrite_exists() --- .../letsencrypt_apache/configurator.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/letsencrypt-apache/letsencrypt_apache/configurator.py b/letsencrypt-apache/letsencrypt_apache/configurator.py index 16e7dc181..e4ba19e3d 100644 --- a/letsencrypt-apache/letsencrypt_apache/configurator.py +++ b/letsencrypt-apache/letsencrypt_apache/configurator.py @@ -915,6 +915,18 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator): raise errors.PluginEnhancementAlreadyPresent( "Let's Encrypt has already enabled redirection") + + def _is_rewrite_exists(self, host): + """Checks if there exists a rewriterule directive + + :param vhost: vhost to check + :type vhost: :class:`~letsencrypt_apache.obj.VirtualHost` + + """ + rewrite_path = self.parser.find_dir( + "RewriteRule", None, start=vhost.path) + return bool(rewrite_path) + def _create_redirect_vhost(self, ssl_vhost): """Creates an http_vhost specifically to redirect for the ssl_vhost.