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

Bryn M. Reeves bmr at redhat.com
Wed Dec 10 17:32:19 UTC 2014


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)  

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

> +        # 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