Call paper with customizable vhost root parameter

This commit is contained in:
Joona Hoikkala
2015-12-07 01:15:29 +02:00
parent b11f091023
commit e58c0a530f
2 changed files with 10 additions and 5 deletions
@@ -148,7 +148,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
self.config_test() self.config_test()
self.parser = parser.ApacheParser( self.parser = parser.ApacheParser(
self.aug, self.conf("server-root"), self.conf("ctl")) self.aug, self.conf("server-root"), self.conf("vhost-root"), self.conf("ctl"))
# Check for errors in parsing files with Augeas # Check for errors in parsing files with Augeas
self.check_parsing_errors("httpd.aug") self.check_parsing_errors("httpd.aug")
@@ -28,7 +28,7 @@ class ApacheParser(object):
arg_var_interpreter = re.compile(r"\$\{[^ \}]*}") arg_var_interpreter = re.compile(r"\$\{[^ \}]*}")
fnmatch_chars = set(["*", "?", "\\", "[", "]"]) fnmatch_chars = set(["*", "?", "\\", "[", "]"])
def __init__(self, aug, root, ctl): def __init__(self, aug, root, vhostroot, ctl):
# Note: Order is important here. # Note: Order is important here.
# This uses the binary, so it can be done first. # This uses the binary, so it can be done first.
@@ -44,6 +44,8 @@ class ApacheParser(object):
self.loc = {"root": self._find_config_root()} self.loc = {"root": self._find_config_root()}
self._parse_file(self.loc["root"]) self._parse_file(self.loc["root"])
self.vhostroot = os.path.abspath(vhostroot)
# This problem has been fixed in Augeas 1.0 # This problem has been fixed in Augeas 1.0
self.standardize_excl() self.standardize_excl()
@@ -56,9 +58,12 @@ class ApacheParser(object):
# Set up rest of locations # Set up rest of locations
self.loc.update(self._set_locations()) self.loc.update(self._set_locations())
# Must also attempt to parse sites-available or equivalent # Take the CentOS layout into account, httpd.conf not in httpd root
# Sites-available is not included naturally in configuration self._parse_file(os.path.join(self.root, "conf") + "/httpd.conf")
self._parse_file(os.path.join(self.root, "sites-available") + "/*")
# Must also attempt to parse virtual host root
self._parse_file(self.vhostroot + "/*")
def init_modules(self): def init_modules(self):
"""Iterates on the configuration until no new modules are loaded. """Iterates on the configuration until no new modules are loaded.