summaryrefslogtreecommitdiffstats
path: root/src/yum/providers/LMI_YumInstalledPackage.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/yum/providers/LMI_YumInstalledPackage.py')
-rw-r--r--src/yum/providers/LMI_YumInstalledPackage.py37
1 files changed, 28 insertions, 9 deletions
diff --git a/src/yum/providers/LMI_YumInstalledPackage.py b/src/yum/providers/LMI_YumInstalledPackage.py
index cf956aa..f4c4cba 100644
--- a/src/yum/providers/LMI_YumInstalledPackage.py
+++ b/src/yum/providers/LMI_YumInstalledPackage.py
@@ -26,7 +26,8 @@ import itertools
import pywbem
import socket
from pywbem.cim_provider2 import CIMProvider2
-from LMI_YumPackage import LMI_YumPackage, pkg2model
+from LMI_YumPackage import pkg2model
+from LMI_YumFileCheck import filecheck2model
from util.common import *
def get_computer_system_op():
@@ -117,7 +118,6 @@ class LMI_YumInstalledPackage(CIMProvider2):
# we set property values on the model.
model.path.update({'System': None, 'Software': None})
- yum_package = LMI_YumPackage(env)
yum_package_path = pywbem.CIMInstanceName("LMI_YumPackage",
namespace=model.path.namespace,
host=model.path.host)
@@ -325,13 +325,32 @@ class LMI_YumInstalledPackage(CIMProvider2):
logger.log_debug('Entering %s.cim_method_checkintegrity()' \
% self.__class__.__name__)
- # TODO do something
- raise pywbem.CIMError(pywbem.CIM_ERR_METHOD_NOT_AVAILABLE) # Remove to implemented
- out_params = []
- #out_params+= [pywbem.CIMParameter('failed', type='reference',
- # value=[pywbem.CIMInstanceName(classname='LMI_YumFileCheck', ...),])] # TODO
- #rval = # TODO (type pywbem.Uint32 self.Values.CheckIntegrity)
- return (rval, out_params)
+ failed = []
+ with YumDB.getInstance(env):
+ pkg = YumPackage.object_path2pkg(env, object_name['Software'])
+ vpkg = yum.packages._RPMVerifyPackage(
+ pkg, pkg.hdr.fiFromHeader(),
+ pkg.yumdb_info.checksum_type, [], True)
+ filecheck_model = pywbem.CIMInstanceName(
+ classname='LMI_YumFileCheck',
+ namespace=object_name.namespace,
+ host=object_name.host)
+ csum = YumFileCheck.checksumtype_str2pywbem(
+ pkg.yumdb_info.checksum_type)
+ for vpf in vpkg:
+ fc = YumFileCheck.test_file(env, csum, vpf)
+ if ( fc.exists
+ and all( v[0] == v[1]
+ for v in fc if isinstance(v, tuple))):
+ continue
+ failed.append(filecheck2model(
+ vpkg, vpf.filename, env, keys_only=True,
+ model=filecheck_model, fc=fc))
+ out_params = [ pywbem.CIMParameter('Failed', type='reference',
+ value=failed) ]
+ return ( getattr(self.Values.CheckIntegrity,
+ 'Pass' if len(failed) == 0 else 'Not_passed')
+ , out_params )
def cim_method_update(self, env, object_name,
param_epoch=None,