NSSwitchConf - file /etc/nsswitch.conf
¶
-
class
insights.parsers.nsswitch_conf.
NSSwitchConf
(context)[source]¶ Bases:
insights.core.Parser
,insights.core.LegacyItemAccess
Read the contents of the
/etc/nsswitch.conf
file.Each non-commented line is split into the service and its sources. The sources (e.g. ‘files sss’) are stored as is, as a string.
nsswitch.conf is case insensitive. This means that both the service and its sources are converted to lower case and searches should be done using lower case text.
-
data
¶ The service dictionary
Type: dict
-
errors
¶ Non-blank lines which don’t contain a ‘:’
Type: list
-
sources
¶ An unordered set of the sources seen in this file
Type: set
Sample content:
# Example: #passwd: db files nisplus nis #shadow: db files nisplus nis #group: db files nisplus nis passwd: files sss shadow: files sss group: files sss #initgroups: files #hosts: db files nisplus nis dns hosts: files dns myhostname
Examples
>>> nss = shared[NSSwitchConf] >>> 'passwd' in nss True >>> 'initgroups' in nss False >>> nss['passwd'] 'files nss' >>> 'files' in nss['hosts'] True >>> nss.errors [] >>> nss.sources set(['files', 'dns', 'sss', 'myhostname'])
-