Combined NFS exports

The NFS exports files are normally available to rules from both a single NFSExports object and zero or more NFSExportsD objects. This combiner turns those into one set of data.

Examples

>>> type(all_nfs)
<class 'insights.combiners.nfs_exports.AllNFSExports'>
>>> all_nfs.files  # List of files exporting NFS shares
['/etc/exports', '/etc/exports.d/mnt.exports']
>>> '/home/example' in all_nfs.exports  # All exports stored by path
True
>>> sorted(all_nfs.exports['/home/example'].keys())  # Each path is a dictionary of host specs and flags.
['@group', 'ins1.example.com', 'ins2.example.com']
>>> all_nfs.exports['/home/example']['ins2.example.com']  # Each host contains a list of flags.
['rw', 'sync', 'no_root_squash']
>>> '/home/example' in all_nfs.ignored_exports  # Ignored exports are remembered within one file
True
>>> list(all_nfs.ignored_exports['/home/example'].keys())  # Each ignored export is then stored by source file...
['/etc/exports']
>>> list(all_nfs.ignored_exports['/home/example']['/etc/exports'].keys())  # ... and then by host spec...
['ins2.example.com']
>>> all_nfs.ignored_exports['/home/example']['/etc/exports']['ins2.example.com']  # ... holding the values that were duplicated
['rw', 'sync', 'no_root_squash']
>>> '/home/insights/shared/rw'  in all_nfs.ignored_exports  # Ignored exports are remembered across files
True
class insights.combiners.nfs_exports.AllNFSExports(nfsexports, nfsexportsd)[source]

Bases: object

Combiner for accessing all the NFS export configuration files.

Exports are allowed to be listed multiple times, with all duplicate host after the first causing exportfs to emit a warning and ignore the host. So we combine the raw lines and ignored exports into structures listing the source file for each

files

the list of source files that contained NFS export definitions.

Type

list

exports

the NFS exports stored by export path, with each path storing a dictionary of host flag lists.

Type

dict of dicts

ignored_exports

A dictionary of exported paths that have host definitions that conflicted with a previous definition, stored by export path and then path of the file that defined it.

Type

dict

raw_lines

A dictionary of raw lines that define each exported path, with the lines stored by defining file.

Type

dict of dicts