|
From: <ba...@us...> - 2008-04-07 15:19:28
|
Revision: 547
http://omc.svn.sourceforge.net/omc/?rev=547&view=rev
Author: bartw
Date: 2008-04-07 08:19:28 -0700 (Mon, 07 Apr 2008)
Log Message:
-----------
fixed to handle latin-1 encoded strings
Modified Paths:
--------------
pyprofiles/pysoftware/trunk/OMC_RPMSoftwareIdentity.py
Modified: pyprofiles/pysoftware/trunk/OMC_RPMSoftwareIdentity.py
===================================================================
--- pyprofiles/pysoftware/trunk/OMC_RPMSoftwareIdentity.py 2008-04-04 22:19:56 UTC (rev 546)
+++ pyprofiles/pysoftware/trunk/OMC_RPMSoftwareIdentity.py 2008-04-07 15:19:28 UTC (rev 547)
@@ -126,47 +126,48 @@
if hdr is None:
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND, id)
- #model['BuildNumber'] = # TODO (type = pywbem.Uint16)
- model['Caption'] = hdr[rpm.RPMTAG_SUMMARY]
- #model['ClassificationDescriptions'] = # TODO (type = [unicode,])
- model['Classifications'] = [self.Values.Classifications.Application_Software]
- model['Description'] = hdr[rpm.RPMTAG_DESCRIPTION]
- model['ElementName'] = '%s-%s-%s' % (hdr[rpm.RPMTAG_NAME],
+ ux = model.update_existing
+ #ux(BuildNumber = # TODO (type = pywbem.Uint16)
+ ux(Caption= hdr[rpm.RPMTAG_SUMMARY].decode('latin_1','xmlcharrefreplace'))
+ #ux(ClassificationDescriptions= # TODO (type = [unicode,]) )
+ ux(Classifications= [self.Values.Classifications.Application_Software])
+ ux(Description= hdr[rpm.RPMTAG_DESCRIPTION].decode('latin_1','xmlcharrefreplace'))
+ #ux(Description= hdr[rpm.RPMTAG_DESCRIPTION])
+ ux(ElementName= '%s-%s-%s' % (hdr[rpm.RPMTAG_NAME],
hdr[rpm.RPMTAG_VERSION],
- hdr[rpm.RPMTAG_RELEASE])
- #model['ExtendedResourceType'] = # TODO (type = pywbem.Uint16 self.Values.ExtendedResourceType)
- #model['HealthState'] = # TODO (type = pywbem.Uint16 self.Values.HealthState)
- #model['IdentityInfoType'] = # TODO (type = [unicode,])
- #model['IdentityInfoValue'] = # TODO (type = [unicode,])
- model['InstallDate'] = pywbem.CIMDateTime.fromtimestamp(hdr[rpm.RPMTAG_INSTALLTIME])
- model['IsEntity'] = True
- #model['Languages'] = # TODO (type = [unicode,])
- #model['MajorVersion'] = # TODO (type = pywbem.Uint16)
- model['Manufacturer'] = hdr[rpm.RPMTAG_VENDOR]
- #model['MinExtendedResourceTypeBuildNumber'] = # TODO (type = pywbem.Uint16)
- #model['MinExtendedResourceTypeMajorVersion'] = # TODO (type = pywbem.Uint16)
- #model['MinExtendedResourceTypeMinorVersion'] = # TODO (type = pywbem.Uint16)
- #model['MinExtendedResourceTypeRevisionNumber'] = # TODO (type = pywbem.Uint16)
- #model['MinorVersion'] = # TODO (type = pywbem.Uint16)
- model['Name'] = hdr['name']
- model['OperationalStatus'] = [self.Values.OperationalStatus.In_Service]
- #model['OtherExtendedResourceTypeDescription'] = # TODO (type = unicode)
- model['ReleaseDate'] = pywbem.CIMDateTime.fromtimestamp(hdr[rpm.RPMTAG_BUILDTIME])
- model['ReleaseString'] = hdr['release']
- #model['RevisionNumber'] = # TODO (type = pywbem.Uint16)
+ hdr[rpm.RPMTAG_RELEASE]))
+ #ux(ExtendedResourceType= # TODO (type = pywbem.Uint16 self.Values.ExtendedResourceType) )
+ #ux(HealthState= # TODO (type = pywbem.Uint16 self.Values.HealthState) )
+ #ux(IdentityInfoType= # TODO (type = [unicode,]) )
+ #ux(IdentityInfoValue= # TODO (type = [unicode,]) )
+ ux(InstallDate= pywbem.CIMDateTime.fromtimestamp(hdr[rpm.RPMTAG_INSTALLTIME]))
+ ux(IsEntity= True)
+ #ux(Languages= # TODO (type = [unicode,]) )
+ #ux(MajorVersion= # TODO (type = pywbem.Uint16) )
+ ux(Manufacturer= hdr[rpm.RPMTAG_VENDOR])
+ #ux(MinExtendedResourceTypeBuildNumber= # TODO (type = pywbem.Uint16) )
+ #ux(MinExtendedResourceTypeMajorVersion= # TODO (type = pywbem.Uint16) )
+ #ux(MinExtendedResourceTypeMinorVersion= # TODO (type = pywbem.Uint16) )
+ #ux(MinExtendedResourceTypeRevisionNumber= # TODO (type = pywbem.Uint16) )
+ #ux(MinorVersion= # TODO (type = pywbem.Uint16) )
+ ux(Name= hdr['name'])
+ ux(OperationalStatus= [self.Values.OperationalStatus.In_Service])
+ #ux(OtherExtendedResourceTypeDescription= # TODO (type = unicode) )
+ ux(ReleaseDate= pywbem.CIMDateTime.fromtimestamp(hdr[rpm.RPMTAG_BUILDTIME]))
+ ux(ReleaseString= hdr['release'])
+ #ux(RevisionNumber= # TODO (type = pywbem.Uint16) )
serial = hdr[rpm.RPMTAG_SERIAL]
if serial:
- model['SerialNumber'] = serial
- #model['Status'] = # TODO (type = unicode self.Values.Status)
- #model['StatusDescriptions'] = # TODO (type = [unicode,])
- #model['TargetOperatingSystems'] = # TODO (type = [unicode,])
- model['TargetOSTypes'] = [self.Values.TargetOSTypes.LINUX]
- model['TargetTypes'] = ['RPM']
- model['VersionString'] = hdr['version']
+ ux(SerialNumber= serial)
+ #ux(Status= # TODO (type = unicode self.Values.Status) )
+ #ux(StatusDescriptions= # TODO (type = [unicode,]) )
+ #ux(TargetOperatingSystems= # TODO (type = [unicode,]) )
+ ux(TargetOSTypes= [self.Values.TargetOSTypes.LINUX])
+ ux(TargetTypes= ['RPM'])
+ ux(VersionString= hdr['version'])
return model
- @classmethod
- def enum_instances(cls, env, model, cim_class, keys_only):
+ def enum_instances(self, env, model, cim_class, keys_only):
"""Enumerate instances.
The WBEM operations EnumerateInstances and EnumerateInstanceNames
@@ -192,7 +193,7 @@
logger = env.get_logger()
logger.log_debug('Entering %s.enum_instances()' \
- % cls.__class__.__name__)
+ % self.__class__.__name__)
ts = rpm.ts()
mi = ts.dbMatch()
@@ -209,7 +210,7 @@
yield model
else:
try:
- yield cls.get_instance(env, model, cim_class, hdr)
+ yield self.get_instance(env, model, cim_class, hdr)
except pywbem.CIMError, (num, msg):
if num not in (pywbem.CIM_ERR_NOT_FOUND,
pywbem.CIM_ERR_ACCESS_DENIED):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|