GrubConf - The valid GRUB configuration¶
Combiner for Red Hat Grub v1 and Grub v2 information.
This combiner uses the parsers:
insights.parsers.grub_conf.Grub1Config
,
insights.parsers.grub_conf.Grub1EFIConfig
,
insights.parsers.grub_conf.Grub2Config
,
insights.parsers.grub_conf.Grub2EFIConfig
, and
insights.parsers.grub_conf.BootLoaderEntries
.
It determines which parser was used by checking one of the follwing
parsers/combiners:
insights.parsers.installed_rpms.InstalledRpms
,
insights.parsers.cmdline.CmdLine
,
insights.parsers.ls_sys_firmware.LsSysFirmware
, and
insights.combiners.redhat_release.RedHatRelease
.
-
class
insights.combiners.grub_conf.
BootLoaderEntries
(grub_bles, sys_firmware)[source]¶ Bases:
object
Combine all
insights.parsers.grub_conf.BootLoaderEntries
parsers into one Combiner- Raises
SkipComponent -- when no any BootLoaderEntries Parsers.
-
version
¶ The version of the GRUB configuration, 1 or 2
- Type
int
-
is_efi
¶ If the host is boot with EFI
- Type
bool
-
entries
¶ List of all boot entries in GRUB configuration.
- Type
list
-
boot_entries
¶ List of all boot entries which only contains the name and cmdline.
- Type
list
-
kernel_initrds
¶ Dict of the kernel and initrd files referenced in GRUB configuration files
- Type
dict
-
is_kdump_iommu_enabled
¶ If any kernel entry contains “intel_iommu=on”
- Type
bool
-
class
insights.combiners.grub_conf.
GrubConf
(grub1, grub2, grub1_efi, grub2_efi, grub_bles, rpms, cmdline, sys_firmware, rh_rel)[source]¶ Bases:
object
Process Grub configuration v1 or v2 based on which type is passed in.
Examples
>>> type(grub_conf) <class 'insights.combiners.grub_conf.GrubConf'> >>> grub_conf.version 2 >>> grub_conf.is_efi False >>> grub_conf.kernel_initrds {'grub_initrds': ['/initramfs-3.10.0-327.36.3.el7.x86_64.img'], 'grub_kernels': ['/vmlinuz-3.10.0-327.36.3.el7.x86_64']} >>> grub_conf.is_kdump_iommu_enabled False >>> grub_conf.get_grub_cmdlines('') []
- Raises
Exception -- when cannot find any valid grub configuration.
-
version
¶ returns 1 or 2, version of the GRUB configuration
- Type
int
-
is_efi
¶ returns True if the host is boot with EFI
- Type
bool
-
kernel_initrds
¶ returns a dict of the kernel and initrd files referenced in GRUB configuration files
- Type
dict
-
is_kdump_iommu_enabled
¶ returns True if any kernel entry contains “intel_iommu=on”
- Type
bool
-
get_grub_cmdlines
(search_text=None)[source]¶ Get the boot entries in which cmdline contains the search_text, return all the boot entries by default.
- Parameters
search_text (str) -- keyword to find in the cmdline, being set to None by default.
- Returns
A list of
insights.parsers.grub_conf.BootEntry
objects fo each boot entry in which the cmdline contains the search_text. When search_text is None, returns the objects of all of the boot entries.