diff --git a/insights/combiners/tests/test_httpd_conf_tree.py b/insights/combiners/tests/test_httpd_conf_tree.py index a3bf6e5f6d..f5203f281b 100644 --- a/insights/combiners/tests/test_httpd_conf_tree.py +++ b/insights/combiners/tests/test_httpd_conf_tree.py @@ -509,6 +509,8 @@ SetEnv GIT_HTTP_EXPORT_ALL DocumentRoot /var/www # ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/ + ProxyPass "http://backend.example.com/a-long-path-to-demonstrate" \ + connectiontimeout=1 retry=0 ScriptAliasMatch \ "(?x)^/git/(.*/(HEAD | \ info/refs | \ @@ -521,6 +523,10 @@ """ +INVALID_CONF = """ +<<<>>>><>KDLKJLDSF>> OneLineComment("#")).map(lambda x: None) + Cont = Char("\\") + EOL First = InSet(string.ascii_letters + "_/") Rest = String(string.ascii_letters + "_/" + string.digits) - Name = (First + Rest).map("".join) + FirstRest = (First + Rest).map("".join) + Name = (FirstRest << (Many(WSChar) + Cont)) | FirstRest Num = Number & (WSChar | LineEnd) StartName = WS >> PosMarker(StartTagName(Letters)) << WS EndName = WS >> EndTagName(Letters, ignore_case=True) << WS - Cont = Char("\\") + EOL AttrStart = Many(WSChar) AttrEnd = (Many(WSChar) + Cont) | Many(WSChar) BareAttr = String(set(string.printable) - (set(string.whitespace) | set("<>'\""))) OpAttr = (Literal("!=") | Literal("<=") | Literal(">=") | InSet("<>")) & WSChar + BareAttr EmptyAttr = String('"\'', min_length=2) - Attr = AttrStart >> (Num | QuotedString | OpAttr | BareAttr | EmptyAttr) << AttrEnd + Attr = AttrStart >> (Num | QuotedString.map(self.remove_cont) | OpAttr | BareAttr | EmptyAttr) << AttrEnd Attrs = Many(Attr) StartTag = (WS + LT) >> (StartName + Attrs) << (GT + WS) @@ -51,6 +52,9 @@ def __init__(self, ctx): self.Top = Doc + EOF + def remove_cont(self, val): + return "".join([x.strip().strip("\\") for x in val.split("\n")]) + def typed(self, val): try: v = val.lower() @@ -77,7 +81,7 @@ def __call__(self, content): try: return self.Top(content) except Exception: - raise ParseException("There was an exception when parsing the config file.") + raise ParseException("There was an exception when parsing one of the httpd config files.") class HttpdConfBase(ConfigParser):