From 6d0d439acf0c4a45f623afc8f8f026f230e8119b Mon Sep 17 00:00:00 2001 From: James Kasten Date: Wed, 17 Dec 2014 19:23:43 -0800 Subject: [PATCH] Fix #137 find_directive uses the unitialized member location in set_user_config when httpd.conf is present. I changed set_user_config_file to use the root path as a start. --- letsencrypt/client/apache_configurator.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/letsencrypt/client/apache_configurator.py b/letsencrypt/client/apache_configurator.py index 11a999e9b..2a2f77812 100644 --- a/letsencrypt/client/apache_configurator.py +++ b/letsencrypt/client/apache_configurator.py @@ -352,7 +352,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator): """ root = self._find_config_root() - default = self._set_user_config_file() + default = self._set_user_config_file(root) temp = os.path.join(self.server_root, "ports.conf") if os.path.isfile(temp): @@ -376,7 +376,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator): raise errors.LetsEncryptConfiguratorError( "Could not find configuration root") - def _set_user_config_file(self, filename=''): + def _set_user_config_file(self, root, filename=''): """Set the appropriate user configuration file .. todo:: This will have to be updated for other distros versions @@ -393,7 +393,8 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator): # httpd.conf was very common as a user file in Apache 2.2 if (os.path.isfile(self.server_root + 'httpd.conf') and self.find_directive( - case_i("Include"), case_i("httpd.conf"))): + case_i("Include"), case_i("httpd.conf"), + get_aug_path(root))): return os.path.join(self.server_root, 'httpd.conf') else: return os.path.join(self.server_root + 'apache2.conf')