### Navigation

- index
- modules |
- next |
- previous |
- Reconfigure docs »

# 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` = [('(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 0x7fbe853c3aa0>), ('\\#.*?\\n', <function <lambda> at 0x7fbe853c3b18>), ('//.*?\\n', <function <lambda> at 0x7fbe853c3b90>), ('/\\*.*?\\*/', <function <lambda> at 0x7fbe853c3c08>), ('((([^\\s{};#]+)|({\\s*([^\\s{};#]+;\\s*)*}))\\s*?)+;', <function <lambda> at 0x7fbe853c3c80>), ('\\s', <function <lambda> at 0x7fbe853c3cf8>), ('$^', <function <lambda> at 0x7fbe853c3d70>), ('\\};', <function <lambda> at 0x7fbe853c3de8>)]

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_]+\\s*?.*?{', <function <lambda> at 0x7fbe853c3668>), ('[\\w_]+?.+?;', <function <lambda> at 0x7fbe853c36e0>), ('\\s', <function <lambda> at 0x7fbe853c3758>), ('$^', <function <lambda> at 0x7fbe853c37d0>), ('\\#.*?\\n', <function <lambda> at 0x7fbe853c3848>), ('\\}', <function <lambda> at 0x7fbe853c38c0>)]

class `reconfigure.parsers.``NSDParser`

  A parser for NSD DNS server nsd.conf file

  `parse`(content)
  `stringify`(tree)
  `stringify_comment`(line, comment)

class `reconfigure.parsers.``ShellParser`(*args, **kwargs)

  A parser for shell scripts with variables

  `parse`(content)
  `stringify`(tree)

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)

### Navigation

- index
- modules |
- next |
- previous |
- Reconfigure docs »