summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichal Minar <miminar@redhat.com>2012-12-07 10:32:19 +0100
committerMichal Minar <miminar@redhat.com>2012-12-07 10:32:19 +0100
commit3a0e901c2483df1f58d3ce5631a8bb88a9c31723 (patch)
tree1f9b7c219733a1c311b93e9b461f500c816084ad /src
parentee01a7c83b0fb9fcf0555007baeaad9fa421df63 (diff)
downloadopenlmi-providers-3a0e901c2483df1f58d3ce5631a8bb88a9c31723.tar.gz
openlmi-providers-3a0e901c2483df1f58d3ce5631a8bb88a9c31723.tar.xz
openlmi-providers-3a0e901c2483df1f58d3ce5631a8bb88a9c31723.zip
fixed package sorting errors
Wrong package could be selected for update due to wrong sorting mechanism.
Diffstat (limited to 'src')
-rw-r--r--src/software/openlmi/software/LMI_SoftwareInstalledPackage.py6
-rw-r--r--src/software/openlmi/software/LMI_SoftwarePackage.py2
-rw-r--r--src/software/openlmi/software/util/common.py5
3 files changed, 5 insertions, 8 deletions
diff --git a/src/software/openlmi/software/LMI_SoftwareInstalledPackage.py b/src/software/openlmi/software/LMI_SoftwareInstalledPackage.py
index b59121d..8914c47 100644
--- a/src/software/openlmi/software/LMI_SoftwareInstalledPackage.py
+++ b/src/software/openlmi/software/LMI_SoftwareInstalledPackage.py
@@ -461,14 +461,12 @@ class LMI_SoftwareInstalledPackage(CIMProvider2): #pylint: disable=R0904
(evr_str, object_name["Software"]["Name"]))
pkglist = ydb.doPackageLists('all', showdups=True)
+ # NOTE: available ∩ installed = ∅
exact, _, _ = yum.packages.parsePackages(
itertools.chain(pkglist.available, pkglist.installed),
[orig.name])
- # NOTE: available ∩ installed = ∅
- exact = sorted(exact, key=lambda a:a.evra)
-
try:
- pkg = [ p for p in exact
+ pkg = [ p for p in sorted(exact)
if (not param_epoch or param_epoch == p.epoch)
and (not param_version or param_version == p.ver)
and (not param_release or param_release == p.rel) ] [-1]
diff --git a/src/software/openlmi/software/LMI_SoftwarePackage.py b/src/software/openlmi/software/LMI_SoftwarePackage.py
index 01956ce..b595600 100644
--- a/src/software/openlmi/software/LMI_SoftwarePackage.py
+++ b/src/software/openlmi/software/LMI_SoftwarePackage.py
@@ -116,7 +116,7 @@ class LMI_SoftwarePackage(CIMProvider2): #pylint: disable=R0904
pkglist = ydb.doPackageLists('all', showdups=True)
pkglist = itertools.chain(pkglist.installed, pkglist.available)
# NOTE: available ∩ installed = ∅
- for pkg in sorted(pkglist, key=lambda a:a.evra):
+ for pkg in sorted(pkglist):
yield SoftwarePackage.pkg2model(env, pkg, keys_only, model)
def set_instance(self, env, instance, modify_existing):
diff --git a/src/software/openlmi/software/util/common.py b/src/software/openlmi/software/util/common.py
index 7deef32..a5b7c60 100644
--- a/src/software/openlmi/software/util/common.py
+++ b/src/software/openlmi/software/util/common.py
@@ -55,7 +55,7 @@ class YumDB(singletonmixin.Singleton):
# this is to inform Singleton, that __init__ should be called only once
ignoreSubsequent = True
- def __init__(self, env, *args, **kwargs):
+ def __init__(self, env, *args, **kwargs): #pylint: disable=W0231
if not isinstance(env, pycimmb.ProviderEnvironment):
raise TypeError("env must be instance of"
" pycimmb.ProviderEnvironment")
@@ -359,8 +359,7 @@ class SoftwarePackage:
[match_props['name']])
exact = yum.misc.unique(exact)
exact_orig = exact
- exact = sorted( [ p for p in exact if match_pkg(p, **match_props) ]
- , key=lambda a: a.evra)
+ exact = sorted([ p for p in exact if match_pkg(p, **match_props) ])
if len(exact) == 0:
logger.log_error('could not find any package for query: {}'
' in list: {}'