|
From: <ba...@us...> - 2008-09-16 01:39:53
|
Revision: 980
http://omc.svn.sourceforge.net/omc/?rev=980&view=rev
Author: bartw
Date: 2008-09-16 01:40:00 +0000 (Tue, 16 Sep 2008)
Log Message:
-----------
more porting to new interface
Modified Paths:
--------------
pybase/trunk/OMC_Base.sfcb.reg
pybase/trunk/OMC_LogicalFile.py
Modified: pybase/trunk/OMC_Base.sfcb.reg
===================================================================
--- pybase/trunk/OMC_Base.sfcb.reg 2008-09-15 23:35:39 UTC (rev 979)
+++ pybase/trunk/OMC_Base.sfcb.reg 2008-09-16 01:40:00 UTC (rev 980)
@@ -4,6 +4,7 @@
type: instance method
namespace: root/cimv2
+# Operating System
[OMC_OperatingSystem]
provider: OMC_OperatingSystem
location: pyCmpiProvider
@@ -22,6 +23,7 @@
type: instance association
namespace: root/cimv2
+# Unix Process
[OMC_UnixProcess]
provider: OMC_UnixProcess
location: pyCmpiProvider
@@ -40,3 +42,60 @@
type: instance association
namespace: root/cimv2
+# Logical File
+[OMC_LinuxDirectoryContainsFile]
+ provider: OMC_LogicalFile
+ location: pyCmpiProvider
+ type: instance association
+ namespace: root/cimv2
+
+[OMC_LinuxFileIdentity]
+ provider: OMC_LogicalFile
+ location: pyCmpiProvider
+ type: instance association
+ namespace: root/cimv2
+
+[OMC_LinuxFile]
+ provider: OMC_LogicalFile
+ location: pyCmpiProvider
+ type: instance
+ namespace: root/cimv2
+
+[OMC_LinuxDataFile]
+ provider: OMC_LogicalFile
+ location: pyCmpiProvider
+ type: instance method
+ namespace: root/cimv2
+
+[OMC_LinuxSocketFile]
+ provider: OMC_LogicalFile
+ location: pyCmpiProvider
+ type: instance
+ namespace: root/cimv2
+
+[OMC_LinuxDeviceFile]
+ provider: OMC_LogicalFile
+ location: pyCmpiProvider
+ type: instance
+ namespace: root/cimv2
+
+[OMC_LinuxDirectory]
+ provider: OMC_LogicalFile
+ location: pyCmpiProvider
+ type: instance
+ namespace: root/cimv2
+
+[OMC_LinuxFIFOPipeFile]
+ provider: OMC_LogicalFile
+ location: pyCmpiProvider
+ type: instance
+ namespace: root/cimv2
+
+[OMC_LinuxSymbolicLink]
+ provider: OMC_LogicalFile
+ location: pyCmpiProvider
+ type: instance
+ namespace: root/cimv2
+
+
+
Modified: pybase/trunk/OMC_LogicalFile.py
===================================================================
--- pybase/trunk/OMC_LogicalFile.py 2008-09-15 23:35:39 UTC (rev 979)
+++ pybase/trunk/OMC_LogicalFile.py 2008-09-16 01:40:00 UTC (rev 980)
@@ -195,7 +195,7 @@
# DMTF_Reserved = ..
# Vendor_Reserved = 0x8000..
- def get_instance (self, env, model, cim_class, stat=None):
+ def get_instance (self, env, model, stat=None):
"""Return an instance.
Keyword arguments:
@@ -205,7 +205,6 @@
instanceName that was requested. The properties of the model
are already filtered according to the PropertyList from the
request.
- cim_class -- The CIMClass
Possible Errors:
CIM_ERR_ACCESS_DENIED
@@ -274,7 +273,7 @@
model['FileInodeNumber'] = str(stat[ST_INO])
return model
- def enum_instances(self, env, model, cim_class, keys_only):
+ def enum_instances(self, env, model, keys_only):
""" Enumerate instances.
The WBEM operations EnumerateInstances and EnumerateInstanceNames
@@ -286,7 +285,6 @@
model -- A template of the CIMInstances to be generated. The
properties of the model are already filtered according to the
PropertyList from the request.
- cim_class -- The CIMClass
keys_only -- A boolean. True if only the key properties should be
set on the generated instances.
@@ -296,6 +294,9 @@
"""
_scanmounts()
+ model.path.update({
+ 'LFName':None,'LFCreationClassName':None,'CSCreationClassName':None,
+ 'FSCreationClassName':None,'FSName':None,'CSName':None})
dirs = ['/' + dir for dir in os.listdir('/')]
for dir in ['/'] + dirs:
stat = os.lstat(dir)
@@ -304,13 +305,13 @@
yield model
else:
try:
- yield self.get_instance(env, model, cim_class, stat=stat)
+ yield self.get_instance(env, model, stat=stat)
except pywbem.CIMError, (num, msg):
if num not in (pywbem.CIM_ERR_NOT_FOUND,
pywbem.CIM_ERR_ACCESS_DENIED):
raise
- def set_instance(self, env, instance, previous_instance, cim_class):
+ def set_instance(self, env, instance, modify_existing):
""" Return a newly created or modified instance.
Keyword arguments:
@@ -318,9 +319,8 @@
instance -- The new CIMInstance. If modifying an existing instance,
the properties on this instance have been filtered by the
PropertyList from the request.
- previous_instance -- The previous instance if modifying an existing
+ modify_existing -- The previous instance if modifying an existing
instance. None if creating a new instance.
- cim_class -- The CIMClass
Return the new instance. The keys must be set on the new instance.
@@ -330,17 +330,16 @@
CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
- valid if previous_instance is None, indicating that the operation
+ valid if modify_existing is None, indicating that the operation
was CreateInstance)
CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
- if previous_instance is not None, indicating that the operation
+ if modify_existing is not None, indicating that the operation
was ModifyInstance)
CIM_ERR_FAILED (some other unspecified error occurred)
"""
- # TODO create or modify the instance
- if previous_instance is None:
+ if not modify_existing:
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED,
'CreateInstance not supported')
stat = os.lstat(instance['lfname'])
@@ -442,7 +441,7 @@
"""
- def get_instance (self, env, model, cim_class, stat=None):
+ def get_instance (self, env, model, stat=None):
"""Return an instance.
Keyword arguments:
@@ -452,7 +451,6 @@
instanceName that was requested. The properties of the model
are already filtered according to the PropertyList from the
request.
- cim_class -- The CIMClass
Possible Errors:
CIM_ERR_ACCESS_DENIED
@@ -479,7 +477,7 @@
print '\n***** ', model['CreationClassName']
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
- ux = model.update_existing
+ ux = model.update
mode = stat[ST_MODE]
ux(Writeable= bool(mode & S_IWUSR))
ux(HealthState= pywbem.Uint16(5))
@@ -502,9 +500,9 @@
ux(CreationDate= pywbem.CIMDateTime.fromtimestamp(stat[ST_CTIME]))
if model.classname.lower() == 'omc_linuxdevicefile':
if S_ISCHR(mode):
- ux(DeviceFileType=3)
+ ux(DeviceFileType=pywbem.Uint16(3))
elif S_ISBLK(mode):
- ux(DeviceFileType=2)
+ ux(DeviceFileType=pywbem.Uint16(2))
ux(DeviceId=str(stat.st_rdev))
ux(DeviceMajor=str(os.major(stat.st_rdev)))
ux(DeviceMinor=str(os.minor(stat.st_rdev)))
@@ -513,7 +511,7 @@
return model
- def enum_instances(self, env, model, cim_class, keys_only):
+ def enum_instances(self, env, model, keys_only):
""" Enumerate instances.
The WBEM operations EnumerateInstances and EnumerateInstanceNames
@@ -525,7 +523,6 @@
model -- A template of the CIMInstances to be generated. The
properties of the model are already filtered according to the
PropertyList from the request.
- cim_class -- The CIMClass
keys_only -- A boolean. True if only the key properties should be
set on the generated instances.
@@ -541,6 +538,10 @@
# return the top level dirs. Other directories and files
# can be reached by navigation via the DirectoryContainsFile
# association.
+ model.path.update({
+ 'Name':None,'CreationClassName':None,'CSCreationClassName':None,
+ 'FSCreationClassName':None,'FSName':None,'CSName':None})
+
dirs = ['/' + dir for dir in os.listdir('/')]
for dir in ['/'] + dirs:
stat = os.lstat(dir)
@@ -551,13 +552,13 @@
yield model
else:
try:
- yield self.get_instance(env, model, cim_class, stat=stat)
+ yield self.get_instance(env, model, stat=stat)
except pywbem.CIMError, (num, msg):
if num not in (pywbem.CIM_ERR_NOT_FOUND,
pywbem.CIM_ERR_ACCESS_DENIED):
raise
- def set_instance(self, env, instance, previous_instance, cim_class):
+ def set_instance(self, env, instance, modify_existing):
""" Return a newly created or modified instance.
Keyword arguments:
@@ -565,9 +566,8 @@
instance -- The new CIMInstance. If modifying an existing instance,
the properties on this instance have been filtered by the
PropertyList from the request.
- previous_instance -- The previous instance if modifying an existing
+ modify_existing -- The previous instance if modifying an existing
instance. None if creating a new instance.
- cim_class -- The CIMClass
Return the new instance. The keys must be set on the new instance.
@@ -577,10 +577,10 @@
CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
or otherwise incorrect parameters)
CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
- valid if previous_instance is None, indicating that the operation
+ valid if modify_existing is None, indicating that the operation
was CreateInstance)
CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
- if previous_instance is not None, indicating that the operation
+ if modify_existing is not None, indicating that the operation
was ModifyInstance)
CIM_ERR_FAILED (some other unspecified error occurred)
@@ -622,7 +622,7 @@
"""
- def get_instance (self, env, model, cim_class):
+ def get_instance (self, env, model):
"""Return an instance.
Keyword arguments:
@@ -632,7 +632,6 @@
instanceName that was requested. The properties of the model
are already filtered according to the PropertyList from the
request.
- cim_class -- The CIMClass
Possible Errors:
CIM_ERR_ACCESS_DENIED
@@ -648,7 +647,7 @@
# and that they are indeed associated
return model
- def enum_instances(self, env, model, cim_class, keys_only):
+ def enum_instances(self, env, model, keys_only):
""" Enumerate instances.
The WBEM operations EnumerateInstances and EnumerateInstanceNames
@@ -660,7 +659,6 @@
model -- A template of the CIMInstances to be generated. The
properties of the model are already filtered according to the
PropertyList from the request.
- cim_class -- The CIMClass
keys_only -- A boolean. True if only the key properties should be
set on the generated instances.
@@ -673,7 +671,7 @@
yield None
- def references(self, env, object_name, model, assoc_class,
+ def references(self, env, object_name, model,
result_class_name, role, result_role, keys_only):
"""Instrument Associations.
@@ -688,7 +686,6 @@
model -- A template CIMInstance to serve as a model
of the objects to be returned. Only properties present on this
model need to be returned.
- assoc_class -- The CIMClass
result_class_name -- If not None, acts as a filter on the returned set
of Objects by mandating that each returned Object MUST be either
an Instance of this Class (or one of its subclasses) or be this
@@ -718,6 +715,8 @@
"""
+ model.path.update({'SystemElement':None, 'SameElement':None})
+ is_subclass = env.get_cimom_handle().is_subclass
if object_name.classname.lower() == 'omc_linuxfile':
model['SameElement'] = object_name
try:
@@ -736,7 +735,8 @@
namespace=object_name.namespace,
keybindings=keybindings)
yield model
- else:
+ elif is_subclass(object_name.namespace, sub=object_name.classname,
+ super='CIM_LogicalFile'):
model['SystemElement'] = object_name
try:
keybindings = {
@@ -763,7 +763,7 @@
"""
- def get_instance (self, env, model, cim_class):
+ def get_instance (self, env, model):
"""Return an instance.
Keyword arguments:
@@ -773,7 +773,6 @@
instanceName that was requested. The properties of the model
are already filtered according to the PropertyList from the
request.
- cim_class -- The CIMClass
Possible Errors:
CIM_ERR_ACCESS_DENIED
@@ -789,7 +788,7 @@
# and that they are indeed associated
return model
- def enum_instances(self, env, model, cim_class, keys_only):
+ def enum_instances(self, env, model, keys_only):
""" Enumerate instances.
The WBEM operations EnumerateInstances and EnumerateInstanceNames
@@ -801,7 +800,6 @@
model -- A template of the CIMInstances to be generated. The
properties of the model are already filtered according to the
PropertyList from the request.
- cim_class -- The CIMClass
keys_only -- A boolean. True if only the key properties should be
set on the generated instances.
@@ -819,14 +817,14 @@
yield model
else:
try:
- yield self.get_instance(env, model, cim_class)
+ yield self.get_instance(env, model)
except pywbem.CIMError, (num, msg):
if num not in (pywbem.CIM_ERR_NOT_FOUND,
pywbem.CIM_ERR_ACCESS_DENIED):
raise
- def references(self, env, object_name, model, assoc_class,
+ def references(self, env, object_name, model,
result_class_name, role, result_role, keys_only):
"""Instrument Associations.
@@ -841,7 +839,6 @@
model -- A template CIMInstance to serve as a model
of the objects to be returned. Only properties present on this
model need to be returned.
- assoc_class -- The CIMClass
result_class_name -- If not None, acts as a filter on the returned set
of Objects by mandating that each returned Object MUST be either
an Instance of this Class (or one of its subclasses) or be this
@@ -871,7 +868,12 @@
"""
+ is_subclass = env.get_cimom_handle().is_subclass
+ if not is_subclass(object_name.namespace, sub=object_name.classname,
+ super = 'CIM_LogicalFile'):
+ return
_scanmounts()
+ model.path.update({'GroupComponent':None, 'PartComponent':None})
try:
objname = object_name['name']
if (not role or role.lower() == 'partcomponent') \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|