Bug 479111 - To add a sosplugin to collect lsb_release information
To add a sosplugin to collect lsb_release information
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: sos (Show other bugs)
All Linux
low Severity medium
: rc
: ---
Assigned To: Adam Stokes
: FutureFeature
Depends On:
Blocks: 557292
  Show dependency treegraph
Reported: 2009-01-07 05:24 EST by Vimal Kumar
Modified: 2012-11-02 14:31 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-03-30 04:07:42 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
sosplugin (1.21 KB, application/octet-stream)
2009-01-07 05:27 EST, Vimal Kumar
no flags Details

  None (edit)
Description Vimal Kumar 2009-01-07 05:24:06 EST
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.


How reproducible:

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' :

import sos.plugintools
import os

class lsbrelease(sos.plugintools.PluginBase):
    """Linux Standard Base information
    def diagnose(self):
        if not os.path.exists("/etc/redhat-release"):
            self.addDiagnose("/etc/redhat-release missing")
    def setup(self):
        self.collectExtOutput("/usr/bin/lsb_release -a")
        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>.

Additional info:

This has been tested on RHEL5/RHEL5.1/RHEL5.2 and RHEL4.6/RHEL4.7.
Comment 1 Vimal Kumar 2009-01-07 05:27:59 EST
Created attachment 328364 [details]
Comment 3 Suzanne Yeghiayan 2009-05-22 16:24:38 EDT
Since this FutureFeature was not resolved for RHEL 5.4 Beta, it has been moved to RHEL 5.5 for inclusion consideration.
Comment 8 errata-xmlrpc 2010-03-30 04:07:42 EDT
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.


Note You need to log in before you can comment on or make changes to this bug.