reconfigure.parsers¶
-
class
reconfigure.parsers.BaseParser[source]¶ A base parser class
-
parse(content)[source]¶ Parameters: content – string config content Returns: a reconfigure.nodes.Nodetree
-
stringify(tree)[source]¶ Parameters: tree – a reconfigure.nodes.NodetreeReturns: string config content
-
-
class
reconfigure.parsers.BIND9Parser[source]¶ A parser for named.conf
-
token_section_end= '};'¶
-
tokens= [('(acl|key|masters|server|trusted-keys|managed-keys|controls|logging|lwres|options|view|zone|channel|category|listen-on|search|avoid-v4-udp-ports|avoid-v6-udp-ports|blackhole|listen-on|listen-on-v6|allow-recursion|allow-recursion-on|sortlist|topology|rrset-order|dual-stack-servers|disable-algorithms|dns64|forwarders|rrset-order|update-policy|also-notify|allow-notify|rate-limit)\\s+?([^\\s{}]*\\s*)*{', <function <lambda> at 0xb67f8b8c>), ('\\#.*?\\n', <function <lambda> at 0xb67f8dbc>), ('//.*?\\n', <function <lambda> at 0xb67f8df4>), ('/\\*.*?\\*/', <function <lambda> at 0xb67f8e2c>), ('((([^\\s{};#]+)|({\\s*([^\\s{};#]+;\\s*)*}))\\s*?)+;', <function <lambda> at 0xb67f8e64>), ('\\s', <function <lambda> at 0xb67f8e9c>), ('$^', <function <lambda> at 0xb67f8ed4>), ('\\};', <function <lambda> at 0xb67f8f0c>)]¶
-
-
class
reconfigure.parsers.IniFileParser(sectionless=False, nullsection='__default__')[source]¶ A parser for standard
.iniconfig files.Parameters: sectionless – if True, allows a section-less attributes appear in the beginning of file
-
class
reconfigure.parsers.IPTablesParser[source]¶ A parser for
iptablesconfiguration as produced byiptables-save
-
class
reconfigure.parsers.NginxParser[source]¶ A parser for nginx configs
-
token_comment= '#'¶
-
token_section_end= '}'¶
-
tokens= [('[\\w_]+\\s*?.*?{', <function <lambda> at 0xb67f8bc4>), ('[\\w_]+?.+?;', <function <lambda> at 0xb67f8bfc>), ('\\s', <function <lambda> at 0xb67f8c34>), ('$^', <function <lambda> at 0xb67f8c6c>), ('\\#.*?\\n', <function <lambda> at 0xb67f8ca4>), ('\\}', <function <lambda> at 0xb67f8cdc>)]¶
-
-
class
reconfigure.parsers.ShellParser(*args, **kwargs)[source]¶ A parser for shell scripts with variables
-
class
reconfigure.parsers.SSVParser(separator=None, maxsplit=-1, comment='#', continuation=None, *args, **kwargs)[source]¶ A parser for files containing space-separated value (notably,
/etc/fstaband friends)Parameters: - separator – separator character, defaults to whitespace
- maxsplit – max number of tokens per line, defaults to infinity
- comment – character denoting comments
- continuation – line continuation character, None to disable