ResolvConf - file
- class insights.parsers.resolv_conf.ResolvConf(context)¶
/etc/resolv.conffile into a dictionary of keywords and their values. This is made available via the
dataproperty but the object itself can be used as a dictionary thanks to the
Each keyword found in the file is stored as a key in the data dictionary, storing the list of values given (in order) on all occurrences of that keyword in the file.
According to the man page, the ‘domain’ and ‘search’ keywords are mutually exclusive. If more than one instance of these keywords is present, whichever is last becomes the active resolution method. So, the
activekey stores which of these keywords was the last present in the file.
Sample file content:
; generated by /sbin/dhclient-script # This file is being maintained by Puppet. # DO NOT EDIT search a.b.com b.c.com options timeout:2 attempts:2 nameserver 10.160.224.51 nameserver 10.61.193.11
>>> resolv = shared[ResolvConf] >>> resolv['active'] 'search' >>> resolv['nameserver'] ["10.160.224.51", "10.61.193.11" ] >>> resolv['search'] ["a.b.com", "b.c.com"] >>> resolv.data["options"] # old style access ["timeout:2", "attempts:2"]
This method must be implemented by classes based on this class.