diff options
author | Michal Minar <miminar@redhat.com> | 2013-03-20 12:59:49 +0100 |
---|---|---|
committer | Michal Minar <miminar@redhat.com> | 2013-03-20 12:59:49 +0100 |
commit | eed3cc9b4b2a78e238ece6dab185e7c76ab13142 (patch) | |
tree | 8df1d6b3a3a60e42a27882e3d8003de8cddfa92c /src/software/openlmi/software/LMI_MemberOfSoftwareCollection.py | |
parent | 19ab3372fe708be3e937df5d1ed6945ac813b51c (diff) | |
download | openlmi-providers-eed3cc9b4b2a78e238ece6dab185e7c76ab13142.tar.gz openlmi-providers-eed3cc9b4b2a78e238ece6dab185e7c76ab13142.tar.xz openlmi-providers-eed3cc9b4b2a78e238ece6dab185e7c76ab13142.zip |
added new providers, allowed for asynchronous jobs
new providers:
LMI_SoftwareInstallationJob
LMI_SoftwareInstallationService
Diffstat (limited to 'src/software/openlmi/software/LMI_MemberOfSoftwareCollection.py')
-rw-r--r-- | src/software/openlmi/software/LMI_MemberOfSoftwareCollection.py | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/src/software/openlmi/software/LMI_MemberOfSoftwareCollection.py b/src/software/openlmi/software/LMI_MemberOfSoftwareCollection.py index e9f73b5..80a10fe 100644 --- a/src/software/openlmi/software/LMI_MemberOfSoftwareCollection.py +++ b/src/software/openlmi/software/LMI_MemberOfSoftwareCollection.py @@ -26,8 +26,8 @@ from pywbem.cim_provider2 import CIMProvider2 from openlmi.common import cmpi_logging from openlmi.software.core import generate_references -from openlmi.software.core import SystemSoftwareCollection -from openlmi.software.core import SoftwareIdentity +from openlmi.software.core import SystemCollection +from openlmi.software.core import Identity from openlmi.software.yumdb import YumDB @cmpi_logging.trace_function @@ -35,17 +35,16 @@ def generate_collection_referents(env, object_name, model, _keys_only): """ Handler for referents enumeration request. """ - SystemSoftwareCollection.check_path(env, object_name, "collection") + SystemCollection.check_path(env, object_name, "collection") pkg_model = pywbem.CIMInstanceName( classname='LMI_SoftwareIdentity', namespace="root/cimv2", host=model.path.host) - model["Collection"] = SystemSoftwareCollection.get_path() + model["Collection"] = SystemCollection.get_path() with YumDB.get_instance() as ydb: for pkg_info in ydb.get_package_list('available', allow_duplicates=True, sort=True): - model["Member"] = SoftwareIdentity.pkg2model( - pkg_info, model=pkg_model) + model["Member"] = Identity.pkg2model(pkg_info, model=pkg_model) yield model @cmpi_logging.trace_function @@ -54,15 +53,14 @@ def generate_member_referents(_env, object_name, model, _keys_only): Handler for referents enumeration request. """ try: - pkg_info = SoftwareIdentity.object_path2pkg( - object_name, kind="available") - model['Member'] = SoftwareIdentity.pkg2model(pkg_info) - model["Collection"] = SystemSoftwareCollection.get_path() + pkg_info = Identity.object_path2pkg(object_name, kind="available") + model['Member'] = Identity.pkg2model(pkg_info) + model["Collection"] = SystemCollection.get_path() except pywbem.CIMError as exc: if exc.args[0] == pywbem.CIM_ERR_NOT_FOUND: msg = "Could not find requested package%s." if "InstanceID" in object_name: - msg = msg % (' with InstanceID="%s"' %object_name["InstanceID"]) + msg = msg % (' with InstanceID="%s"'%object_name["InstanceID"]) else: msg = msg % "" raise pywbem.CIMError(pywbem.CIM_ERR_FAILED, msg) @@ -73,9 +71,8 @@ def generate_member_referents(_env, object_name, model, _keys_only): class LMI_MemberOfSoftwareCollection(CIMProvider2): """Instrument the CIM class LMI_MemberOfSoftwareCollection - LMI_MemberOfSoftwareCollection is an aggregation used to establish membership - of ManagedElements in a Collection. - + LMI_MemberOfSoftwareCollection is an aggregation used to establish + membership of ManagedElements in a Collection. """ def __init__(self, _env): @@ -105,7 +102,7 @@ class LMI_MemberOfSoftwareCollection(CIMProvider2): CIM_ERR_FAILED (some other unspecified error occurred) """ - SystemSoftwareCollection.check_path_property(env, model, "Collection") + SystemCollection.check_path_property(env, model, "Collection") if not 'Member' in model: raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_PARAMETER, @@ -114,11 +111,10 @@ class LMI_MemberOfSoftwareCollection(CIMProvider2): raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_PARAMETER, "Expected object path for Member!") - model['Collection'] = SystemSoftwareCollection.get_path() + model['Collection'] = SystemCollection.get_path() with YumDB.get_instance(): - pkg_info = SoftwareIdentity.object_path2pkg( - model['Member'], 'available') - model['Member'] = SoftwareIdentity.pkg2model(pkg_info) + pkg_info = Identity.object_path2pkg(model['Member'], 'available') + model['Member'] = Identity.pkg2model(pkg_info) return model @cmpi_logging.trace_method @@ -148,7 +144,7 @@ class LMI_MemberOfSoftwareCollection(CIMProvider2): # we set property values on the model. model.path.update({'Member': None, 'Collection': None}) - model['Collection'] = SystemSoftwareCollection.get_path() + model['Collection'] = SystemCollection.get_path() member_model = pywbem.CIMInstanceName( classname="LMI_SoftwareIdentity", namespace="root/cimv2") @@ -157,8 +153,7 @@ class LMI_MemberOfSoftwareCollection(CIMProvider2): allow_duplicates=True, sort=True) for pkg in pl: - model['Member'] = SoftwareIdentity.pkg2model( - pkg, model=member_model) + model['Member'] = Identity.pkg2model(pkg, model=member_model) yield model @cmpi_logging.trace_method |