Red Hat Bugzilla – Bug 479111
To add a sosplugin to collect lsb_release information
Last modified: 2012-11-02 14:31:11 EDT
Description of problem:
We have seen many cases and still are, in which the customer has a corrupt '/etc/redhat-release' file. This may be due to changing the 'redhat-release' package, editing the /etc/redhat-release' file manually, installing third party packages etc...Many times '/etc/redhat-release' output showed Fedora, CentOS etc..
We also can see cases in which the file '/etc/redhat-release' itself does not exist and due to this reason, the 'checksysreport' utility won't run. Instead of asking the customer for the exact release or to revert back with more information on this, it would be better to issue a warning on the missing file (or the corrupt content) and then run the checksysreport utility as usual.
In such a scenario, it would be good to have another criteria such as the output of the command 'lsb_release'. I am not sure if we can use LSB as a standard instead of '/etc/redhat-release', but having more than one reference to confirm the RHEL version would be ideal.
The following plug-in checks for the existence of the file /etc/redhat-release and generates a warning if it does not exist and also collects the 'lsb_release' output.
As a suggestion, if '/etc/redhat-release' does not exist (or has a content different from desired) and there is enough information from 'lsb_release', the checksysreport utility must run successfully. This would need editing of the 'checksysreport' utility but first we have to confirm if 'lsb_release' can be used as a standard.
Currently the sosreport utility or the existing plug-ins does not collect the output of the command 'lsb_release'.
Steps to Reproduce:
a) Create a new file named 'lsbrelease.py' in the sos plugins directory '/usr/lib/python2.4/site-packages/sos/plugins/'.
b) Add the following content in the file 'lsbrelease.py' :
"""Linux Standard Base information
if not os.path.exists("/etc/redhat-release"):
self.collectExtOutput("/usr/bin/lsb_release -d", suggest_filename = "lsb_release", root_symlink = "lsb-release")
c) The above steps will create the sos plugin named 'lsbrelease'. This plugin can be run individually using the command 'sosreport --only-plugins=lsbrelease'.
d) The collected details are :
(i) The output of the command 'lsb_release -a', which collects the details of all the switches available for 'lsb_release'.
(ii) The output of the command 'lsb_release -d' (which will give a description similar to the output of /etc/redhat-release) and create a link named 'lsb-release' under the main root folder of the sosreport.
(iii) Collect all the files/folders starting with the name 'lsb-release' under /etc/.
(iv) Creates a folder named 'lsbrelease' under 'sos_commands' with the output of the commands :
# lsb_release -a
# lsb_release -d
(v) If the file /etc/redhat-release does not exists, the message "/etc/redhat-release' is missing" is printed to 'stdout' and the same is stored in <sos_reports/diagnose.txt>.
This has been tested on RHEL5/RHEL5.1/RHEL5.2 and RHEL4.6/RHEL4.7.
Created attachment 328364 [details]
Since this FutureFeature was not resolved for RHEL 5.4 Beta, it has been moved to RHEL 5.5 for inclusion consideration.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.