1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00
Files
jc/docs/parsers/resolve_conf.md

86 lines
1.8 KiB
Markdown
Raw Normal View History

[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.resolve_conf"></a>
2024-03-14 22:46:52 -07:00
# jc.parsers.resolve_conf
jc - JSON Convert `/etc/resolve.conf` file parser
This parser may be more forgiving than the system parser. For example, if
multiple `search` lists are defined, this parser will append all entries to
the `search` field, while the system parser may only use the list from the
last defined instance.
Usage (cli):
$ cat /etc/resolve.conf | jc --resolve-conf
Usage (module):
import jc
result = jc.parse('resolve_conf', resolve_conf_output)
Schema:
{
"domain": string,
"search": [
string
],
"nameservers": [
string
],
"options": [
string
],
"sortlist": [
string
]
}
Examples:
$ cat /etc/resolve.conf | jc --resolve-conf -p
{
"search": [
"eng.myprime.com",
"dev.eng.myprime.com",
"labs.myprime.com",
"qa.myprime.com"
],
"nameservers": [
"10.136.17.15"
],
"options": [
"rotate",
"ndots:1"
]
}
<a id="jc.parsers.resolve_conf.parse"></a>
### parse
```python
2024-03-14 22:46:52 -07:00
def parse(data: str, raw: bool = False, quiet: bool = False) -> Dict[str, Any]
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary. Raw or processed structured data.
### Parser Information
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
2023-12-21 14:55:21 -08:00
Source: [`jc/parsers/resolve_conf.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/resolve_conf.py)
Version 1.0 by Kelly Brazil (kellyjonbrazil@gmail.com)