FindmntPropagation - command findmnt -lo+PROPAGATION

This module provides status of propagation flag of filesystems using the output of command findmnt -lo+PROPAGATION.

class insights.parsers.findmnt.FindmntPropagation(context, extra_bad_lines=None)[source]

Bases: CommandParser

Parse output of findmnt -lo+PROPAGATION.

Typical output of findmnt -lo+PROPAGATION command is:

TARGET                                                          SOURCE                                FSTYPE          OPTIONS                                                                       PROPAGATION
/sys                                                            sysfs                                 sysfs           rw,nosuid,nodev,noexec,relatime,seclabel                                      shared
/proc                                                           proc                                  proc            rw,nosuid,nodev,noexec,relatime                                               shared
/dev                                                            devtmpfs                              devtmpfs        rw,nosuid,seclabel,size=8035516k,nr_inodes=2008879,mode=755                   shared
/sys/kernel/security                                            securityfs                            securityfs      rw,nosuid,nodev,noexec,relatime                                               shared
/dev/shm                                                        tmpfs                                 tmpfs           rw,nosuid,nodev,seclabel                                                      shared
/run/netns                                                      tmpfs[/netns]                         tmpfs           rw,nosuid,nodev,seclabel,mode=755                                             shared
/netns                                                          tmpfs[/netns]                         tmpfs           rw,nosuid,nodev,seclabel,mode=755                                             shared
/run/netns/qdhcp-08f32dab-927e-4a61-933d-57d425827b57           proc                                  proc            rw,nosuid,nodev,noexec,relatime                                               shared
/run/netns/qdhcp-fd138c0a-5ec7-44f8-88df-0501c4c7a968           proc                                  proc            rw,nosuid,nodev,noexec,relatime                                               shared

Examples

>>> output.search_target('shm') == [{'target': '/dev/shm', 'source': 'tmpfs', 'fstype': 'tmpfs', 'options': 'rw,nosuid,nodev,seclabel', 'propagation': 'shared'}]
True
>>> len(output.target_startswith('/run/netns')) == 3
True
>>> output.target_startswith('/run/netns')[0].get('propagation', None) == 'shared'
True
cols

List of key value pair derived from the command.

Type:

list

keywords

keywords(or TARGETs) present in the command

Type:

list

parse_content(content)[source]

This method must be implemented by classes based on this class.

search_target(target)[source]

Similar to __contains__() but returns the list of targets.

Example

>>> output.search_target('shm') == [{'target': '/dev/shm', 'source': 'tmpfs', 'fstype': 'tmpfs', 'options': 'rw,nosuid,nodev,seclabel', 'propagation': 'shared'}]
True
target_startswith(target)[source]

Return all the targets that starts with ‘target’. Useful to find the mountpoints.

Example

>>> len(output.target_startswith('/run/netns')) == 3
True