diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2013-04-29 19:36:48 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2013-04-29 19:36:48 +0100 |
commit | a89913b2d3ab40804d9805a7f45eb6b0c290f9dc (patch) | |
tree | b0a71395ba94fa05338c44de3ab6514eddbe50d7 | |
parent | 5fec1a3da441e69a292aa1d06c6ae582972a12c0 (diff) | |
download | sos-a89913b2d3ab40804d9805a7f45eb6b0c290f9dc.tar.gz |
Merge initrd and bootloader plug-ins into a single boot module
The existing initrd plug-in is default-disabled so it rarely
collects anything useful. The command used to extract the init
script from the initramfs image is also broken for modern systems
as the pattern ("initrd*") does not match and the file /init on
systems using systemd is actually a symbolic link to the systemd
binary.
Replace the collection of this file with a listing of the current
initramfs image (via lsinitrd). Optionally collect a listing from
each non-kdmump image present in /boot.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/boot.py (renamed from sos/plugins/bootloader.py) | 18 | ||||
-rw-r--r-- | sos/plugins/initrd.py | 30 |
2 files changed, 15 insertions, 33 deletions
diff --git a/sos/plugins/bootloader.py b/sos/plugins/boot.py index 8e5f50b3..6e62eac6 100644 --- a/sos/plugins/bootloader.py +++ b/sos/plugins/boot.py @@ -12,13 +12,18 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin +from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin +from glob import glob -class Bootloader(Plugin, RedHatPlugin, UbuntuPlugin): +class Boot(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): """Bootloader information """ - plugin_name = 'bootloader' + plugin_name = 'boot' + + option_list = [("all-images", + "collect a file listing for all initramfs images", "slow", + False)] def setup(self): self.add_copy_specs([ @@ -29,3 +34,10 @@ class Bootloader(Plugin, RedHatPlugin, UbuntuPlugin): "/boot/yaboot.conf" ]) self.add_cmd_output("ls -lanR /boot") + self.add_cmd_output("lsinitrd") + if self.get_option("all-images"): + for image in glob('/boot/initr*.img'): + if image[-9:] == "kdump.img": + continue + self.add_cmd_output("lsinitrd %s" % image) + diff --git a/sos/plugins/initrd.py b/sos/plugins/initrd.py deleted file mode 100644 index db40999c..00000000 --- a/sos/plugins/initrd.py +++ /dev/null @@ -1,30 +0,0 @@ -### This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. - -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. - -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin -from glob import glob - -class Initrd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin): - """initrd related information - """ - - plugin_name = 'initrd' - - def setup(self): - for initrd in glob('/boot/initrd-*.img'): - self.add_cmd_output("zcat "+initrd+" | cpio "+ - "--extract --to-stdout init" ) - - def default_enabled(self): - return False |