[sos-devel] [PATCH v3] sosreport: Check for rpm database corruption during initialization

Aruna Balakrishnaiah aruna at linux.vnet.ibm.com
Thu Dec 11 06:45:30 UTC 2014


On Wednesday 10 December 2014 11:02 PM, Bryn M. Reeves wrote:
> Hi Aruna,
>
> Sorry for taking so long to get back to this. The sos/utilities.py
> changes all look fine now but I think there are still a few
> improvements I'd like to see in the PackageManager changes:
>
> On Wed, Oct 15, 2014 at 04:12:38PM +0530, Aruna Balakrishnaiah wrote:
>> -    def __init__(self, query_command=None):
>> +    def __init__(self, query_command=None, timeout=180):
> Is there a need to make the timeout configurable here (and does it
> make sense to do so)?
>
> We're discussing adding a --timeout option to allow the user to
> control the timeouts used to collect data but I'm not sure it should
> be passed through to the PackageManager initialiser (as you then
> could set it so low that the tool always fails).
>
>> diff --git a/sos/policies/redhat.py b/sos/policies/redhat.py
>> index 2219246..e5a3f3f 100644
>> --- a/sos/policies/redhat.py
>> +++ b/sos/policies/redhat.py
>> @@ -21,6 +21,7 @@ import sys
>>   from sos.plugins import RedHatPlugin
>>   from sos.policies import LinuxPolicy, PackageManager
>>   from sos import _sos as _
>> +from distutils.log import error
> Why use distutils.log here? It's not used anywhere else in sos; it
> would be cleaner to just print to stderr:
>
>      print(error_message, file=sys.stderr)

Bryn,

This is available only since Python 3.0, lower versions are not supporting this.


>
> There is also the Policy._print() method (which also obeys the
> setting of --quiet).

Is there a need to create a new Policy instance just to print?Can I just use 
print_ ?
And should we not print this error message even if its in quiet mode.

Regards,
Aruna


>
>> +        # If rpm query timed out after timeout duration exit
>> +        if not pkgs:
>> +            error("Could not obtain installed package list")
>> +            sys.exit(1)
>> +
> Regards,
> Bryn.
>




More information about the sos-devel mailing list