[sos-devel] [RFC PATCH v2] sosreport: Check for rpm database corruption during initialization
Bryn M. Reeves
bmr at redhat.com
Wed Oct 15 10:07:32 UTC 2014
On Wed, Oct 15, 2014 at 03:29:11PM +0530, Aruna Balakrishnaiah wrote:
> On Wednesday 15 October 2014 03:24 PM, Bryn M. Reeves wrote:
> >If you want to avoid repeated typing of
> >'self.package_manager.all_pkgs()' just store it in variable local to
> >__init__.
>
> I stored the policy because calling all_pkgs twice will be calling
> the command twice so the timeout will be 600s ( 300s * 2).
No it won't:
107 def all_pkgs(self):
108 """
109 Return a list of all packages.
110 """
111 if not self.packages:
112 self.packages = self.get_pkg_list()
113 return self.packages
The PackageManager class caches the result of get_pkg_list() itself and
will only call out to query_command once.
> To avoid that stored it as a policy. Will use a local variable instead.
It's fine to use a local to improve readability but stuffing it into the
policy class just clutters it needlessly.
Regards,
Bryn.
More information about the sos-devel
mailing list