CmdLine - file
This parser reads the
/proc/cmdline file, which contains the arguments
given to the currently running kernel on boot.
- class insights.parsers.cmdline.CmdLine(context)¶
A parser class for parsing the Linux kernel command line as given in
Parses all elements in command line to a dict where the key is the element itself and the value is a list stores its corresponding values. If an element doesn't contain "=", set the corresponding value to `True`. If an element contains "=", set the corresponding value to the whole right value of the "=".
For special command line elements that include two “=”, e.g.
root=LABEL=/1, “root” will be the key and “LABEL=/1” will be the value in the returned list.
Some parameters (the returned keys) might be still effective even if there is ‘#’ before it, e.g.:
#rhgb. This should be checked by the rule.
BOOT_IMAGE=/vmlinuz-3.10.0-327.36.3.el7.x86_64 root=/dev/system_vg/Root ro rd.lvm.lv=system_vg/Root crashkernel=auto rd.lvm.lv=system_vg/Swap rhgb quiet LANG=en_GB.utf8
>>> cmd['BOOT_IMAGE'] ['/vmlinuz-3.10.0-327.36.3.el7.x86_64'] >>> cmd['rd.lvm.lv'] ['system_vg/Root', 'system_vg/Swap'] >>> 'autofs' in cmd False >>> cmd.get('autofs') is None True >>> 'quiet' in cmd True >>> cmd.get('quiet') [True] >>> cmd['crashkernel'] ['auto']
Parsed booting arguments are stored in this dictionary
The RAW line of the
This method must be implemented by classes based on this class.