reconfigure.parsers

class reconfigure.parsers.BaseParser

A base parser class

parse(content)
Parameters:content – string config content
Returns:a reconfigure.nodes.Node tree
stringify(tree)
Parameters:tree – a reconfigure.nodes.Node tree
Returns:string config content
class reconfigure.parsers.BIND9Parser

A parser for named.conf

token_section_end = '};'
tokens = [('[\\w_]+\\s*?.*?{', <function <lambda> at 0x2d340c8>), ('[\\w_]+?.+?;', <function <lambda> at 0x2d34140>), ('\\s', <function <lambda> at 0x2d341b8>), ('$^', <function <lambda> at 0x2d34230>), ('\\#.*?\\n', <function <lambda> at 0x2d342a8>), ('//.*?\\n', <function <lambda> at 0x2d34320>), ('/\\*.*?\\*/', <function <lambda> at 0x2d34398>), ('\\};', <function <lambda> at 0x2d34410>)]
class reconfigure.parsers.CrontabParser(remove_comments=False)
parse(content)
stringify(tree)
stringify_env_setting(node)
stringify_normal_task(node)
stringify_special_task(node)
class reconfigure.parsers.ExportsParser(*args, **kwargs)

A parser for NFS’ /etc/exports

parse(content)
stringify(tree)
class reconfigure.parsers.IniFileParser(sectionless=False, nullsection='__default__')

A parser for standard .ini config files.

Parameters:sectionless – if True, allows a section-less attributes appear in the beginning of file
parse(content)
stringify(tree)
class reconfigure.parsers.IPTablesParser

A parser for iptables configuration as produced by iptables-save

parse(content)
stringify(tree)
class reconfigure.parsers.JsonParser

A parser for JSON files (using json module)

load_node_rec(node, json)
parse(content)
save_node_rec(node)
stringify(tree)
class reconfigure.parsers.NginxParser

A parser for nginx configs

parse(content)
stringify(tree)
stringify_rec(node)
token_comment = '#'
token_section_end = '}'
tokens = [('[\\w_]+?.+?;', <function <lambda> at 0x2c6cc08>), ('\\s', <function <lambda> at 0x2c6cc80>), ('$^', <function <lambda> at 0x2c6ccf8>), ('\\#.*?\\n', <function <lambda> at 0x2c6cd70>), ('[\\w_]+\\s*?.*?{', <function <lambda> at 0x2c6cde8>), ('\\}', <function <lambda> at 0x2c6ce60>)]
class reconfigure.parsers.NSDParser

A parser for NSD DNS server nsd.conf file

parse(content)
stringify(tree)
stringify_comment(line, comment)
class reconfigure.parsers.SSVParser(separator=None, maxsplit=-1, comment='#', continuation=None, *args, **kwargs)

A parser for files containing space-separated value (notably, /etc/fstab and 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
parse(content)
stringify(tree)
class reconfigure.parsers.SquidParser

A parser for Squid configs

parse(content)
stringify(tree)

Previous topic

reconfigure.configs

Next topic

reconfigure.nodes

This Page