Modprobe configuration

The modprobe configuration files are normally available to rules as a list of ModProbe objects. This combiner turns those into one set of data, preserving the original file name that defined modprobe configuration line using a tuple.

class insights.combiners.modprobe.AllModProbe(modprobe)[source]

Bases: LegacyItemAccess

Combiner for accessing all the modprobe configuration files in one structure.

It’s important for our reporting and information purposes to know not only what the configuration was but where it was defined. Therefore, the format of the data in this combiner is slightly different compared to the ModProbe parser. Here, each ‘value’ is actually a 2-tuple, with the actual data first and the file name from whence the value came second. This does mean that you need to pull the value out of each item - e.g. using a list comprehension - but it means that every item is associated with the file it was defined in.

In line with the ModProbe configuration parser, the actual value is usually a list of the space-separated parts on the line, and the definitions for each module are similarly kept in a list, which makes

Thanks to the LegacyItemAccess class, this can also be treated as a dictionary for look-ups of data in the data attribute.

data

The combined data structures, with each item as a 2-tuple, as described above.

Type

dict

bad_lines

The list of unparseable lines from all files, with each line as a 2-tuple as described above.

Type

list

Sample data files:

/etc/modprobe.conf:
    # watchdog drivers
    blacklist i8xx_tco

    # Don't install the Firewire ethernet driver
    install eth1394 /bin/true

/etc/modprobe.conf.d/no_ipv6.conf:
    options ipv6 disable=1
    install ipv6 /bin/true

Examples

>>> all_modprobe = shared[AllModProbe]
>>> all_modprobe['alias']
[]
>>> all_modprobe['blacklist']
{'i8xx_tco': ModProbeValue(True, '/etc/modprobe.conf')}
>>> all_modprobe['install']
{'eth1394': ModProbeValue(['/bin/true'], '/etc/modprobe.conf'),
 'ipv6': ModProbeValue(['/bin/true'], '/etc/modprobe.conf.d/no_ipv6.conf')}
class insights.combiners.modprobe.ModProbeValue(value, source)

Bases: tuple

A value from a ModProbe source

property source
property value