summaryrefslogtreecommitdiffstats
path: root/src/software/openlmi/software/LMI_SoftwareFileCheck.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/software/openlmi/software/LMI_SoftwareFileCheck.py')
-rw-r--r--src/software/openlmi/software/LMI_SoftwareFileCheck.py47
1 files changed, 19 insertions, 28 deletions
diff --git a/src/software/openlmi/software/LMI_SoftwareFileCheck.py b/src/software/openlmi/software/LMI_SoftwareFileCheck.py
index c667352..63070fc 100644
--- a/src/software/openlmi/software/LMI_SoftwareFileCheck.py
+++ b/src/software/openlmi/software/LMI_SoftwareFileCheck.py
@@ -27,12 +27,10 @@ Instruments the CIM class LMI_SoftwareFileCheck
import pywbem
from pywbem.cim_provider2 import CIMProvider2
-from openlmi.software.util.common import *
+from openlmi.software.util import common
+from openlmi.software.util.common import SoftwareFileCheck
-filecheck2model = SoftwareFileCheck.filecheck_wrapper(
- 'root/cimv2', 'LMI_SoftwareFileCheck')
-
-class LMI_SoftwareFileCheck(CIMProvider2):
+class LMI_SoftwareFileCheck(CIMProvider2): # pylint: disable=R0904
"""Instrument the CIM class LMI_SoftwareFileCheck
Identifies a file contained by RPM package. It's located in directory
@@ -41,7 +39,7 @@ class LMI_SoftwareFileCheck(CIMProvider2):
"""
- def __init__ (self, env):
+ def __init__(self, env):
logger = env.get_logger()
logger.log_debug('Initializing provider %s from %s' \
% (self.__class__.__name__, __file__))
@@ -74,11 +72,10 @@ class LMI_SoftwareFileCheck(CIMProvider2):
logger.log_debug('Entering %s.get_instance()' \
% self.__class__.__name__)
- with YumDB.getInstance(env) as yb:
+ with common.YumDB.getInstance(env):
vpkg = SoftwareFileCheck.object_path2yumcheck(env, model.path)
- pkg = vpkg.po
- fi = pkg.hdr.fiFromHeader()
- return filecheck2model(vpkg, model['Name'], env, False)
+ return SoftwareFileCheck.filecheck2model(
+ vpkg, model['Name'], env, False)
def enum_instances(self, env, model, keys_only):
"""Enumerate instances.
@@ -106,8 +103,8 @@ class LMI_SoftwareFileCheck(CIMProvider2):
logger = env.get_logger()
logger.log_debug('Entering %s.enum_instances()' \
% self.__class__.__name__)
-
- raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement
+ # this won't be supported because of enormous amount of data
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
def set_instance(self, env, instance, modify_existing):
"""Return a newly created or modified instance.
@@ -139,9 +136,7 @@ class LMI_SoftwareFileCheck(CIMProvider2):
logger = env.get_logger()
logger.log_debug('Entering %s.set_instance()' \
% self.__class__.__name__)
- # TODO create or modify the instance
- raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement
- return instance
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
def delete_instance(self, env, instance_name):
"""Delete an instance.
@@ -169,8 +164,7 @@ class LMI_SoftwareFileCheck(CIMProvider2):
logger.log_debug('Entering %s.delete_instance()' \
% self.__class__.__name__)
- # TODO delete the resource
- raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
def cim_method_invoke(self, env, object_name):
"""Implements LMI_SoftwareFileCheck.Invoke()
@@ -214,17 +208,18 @@ class LMI_SoftwareFileCheck(CIMProvider2):
logger.log_debug('Entering %s.cim_method_invoke()' \
% self.__class__.__name__)
- with YumDB.getInstance(env) as yb:
+ with common.YumDB.getInstance(env):
vpkg = SoftwareFileCheck.object_path2yumcheck(env, object_name)
- fc = SoftwareFileCheck.test_file(env,
+ sfc = SoftwareFileCheck.test_file(env,
SoftwareFileCheck.pkg_checksum_type(vpkg.po),
vpkg._files[object_name["Name"]])
out_params = []
- ret = 0 if SoftwareFileCheck.filecheck_passed(fc) else 2
+ ret = 0 if SoftwareFileCheck.filecheck_passed(sfc) else 2
return (pywbem.Uint32(ret), out_params)
- def cim_method_invokeonsystem(self, env, object_name,
- param_targetsystem=None):
+ def cim_method_invokeonsystem(self, env,
+ object_name, #pylint: disable=W0613
+ param_targetsystem=None): #pylint: disable=W0613
"""Implements LMI_SoftwareFileCheck.InvokeOnSystem()
The InvokeOnSystem method evaluates this Check. The details of the
@@ -270,10 +265,7 @@ class LMI_SoftwareFileCheck(CIMProvider2):
% self.__class__.__name__)
# TODO do something
- raise pywbem.CIMError(pywbem.CIM_ERR_METHOD_NOT_AVAILABLE) # Remove to implemented
- out_params = []
- #rval = # TODO (type pywbem.Uint32)
- return (rval, out_params)
+ raise pywbem.CIMError(pywbem.CIM_ERR_METHOD_NOT_AVAILABLE)
class Values(object):
class TargetOperatingSystem(object):
@@ -406,8 +398,7 @@ class LMI_SoftwareFileCheck(CIMProvider2):
## end of class LMI_SoftwareFileCheckProvider
-## get_providers() for associating CIM Class Name to python provider class name
-
def get_providers(env):
+ """for associating CIM Class Name to python provider class name"""
lmi_softwarefilecheck_prov = LMI_SoftwareFileCheck(env)
return {'LMI_SoftwareFileCheck': lmi_softwarefilecheck_prov}