check for missed define statements at the end of parsing

This commit is contained in:
Noah Swartz 2015-12-03 12:12:38 -08:00
parent d76cd9c315
commit ce2ce697bd

View file

@ -35,6 +35,7 @@ class ApacheParser(object):
# https://httpd.apache.org/docs/2.4/mod/core.html#ifdefine
# This only handles invocation parameters and Define directives!
self.variables = {}
self.unparsable = False
self.update_runtime_variables(ctl)
self.aug = aug
@ -58,6 +59,10 @@ class ApacheParser(object):
# Must also attempt to parse sites-available or equivalent
# Sites-available is not included naturally in configuration
self._parse_file(os.path.join(self.root, "sites-available") + "/*")
#TODO check to see if there were unparsed define statements
if self.unparsable:
if self.find_dir("Define", exclude=False):
raise errors.PluginError("Error parsing runtime variables")
def init_modules(self):
"""Iterates on the configuration until no new modules are loaded.
@ -100,7 +105,9 @@ class ApacheParser(object):
try:
matches.remove("DUMP_RUN_CFG")
except ValueError:
raise errors.PluginError("Unable to parse runtime variables")
self.unparsable = True
return
#raise errors.PluginError("Unable to parse runtime variables")
for match in matches:
if match.count("=") > 1: