GrubConf - The valid GRUB configuration
Combiner for Red Hat Grub v1 Grub v2, and BLS 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.
insights.parsers.grub_env.GrubEnv.
It determines which parser was used by checking one of the following
parsers/combiners:
insights.parsers.installed_rpms.InstalledRpms,
insights.parsers.cmdline.CmdLine,
insights.parsers.ls_sys_firmware.LsSysFirmware or
insights.parsers.ls.LSlanFiltered
- class insights.combiners.grub_conf.BootLoaderEntries(grub_bles, grubenv, is_uefi)[source]
Bases:
objectCombine all
insights.parsers.grub_conf.BootLoaderEntriesparsers into one Combiner- 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
- Raises:
SkipComponent -- when no any BootLoaderEntries Parsers.
- class insights.combiners.grub_conf.GrubConf(grubby, grub1, grub2, grub1_efi, grub2_efi, grub_bles, rpms, cmdline, is_uefi)[source]
Bases:
objectProcess grubby command and Grub configuration v1, v2, and BLS files based on which type is passed in.
- 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
- Raises:
Exception -- when cannot find any valid grub configuration.
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('') []
- 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.BootEntryobjects 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.