From: <ba...@us...> - 2008-10-21 23:29:54
|
Revision: 1120 http://omc.svn.sourceforge.net/omc/?rev=1120&view=rev Author: bartw Date: 2008-10-21 23:29:48 +0000 (Tue, 21 Oct 2008) Log Message: ----------- allow some instances to be created without a namespace, if the broker allows this. This is a workaround for sblim-sfcb bug 2185410 Modified Paths: -------------- cmpi-bindings/trunk/swig/cmpi_callbacks.i cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py Modified: cmpi-bindings/trunk/swig/cmpi_callbacks.i =================================================================== --- cmpi-bindings/trunk/swig/cmpi_callbacks.i 2008-10-21 23:04:10 UTC (rev 1119) +++ cmpi-bindings/trunk/swig/cmpi_callbacks.i 2008-10-21 23:29:48 UTC (rev 1120) @@ -250,7 +250,7 @@ return result; } - CMPIInstance* new_instance(const CMPIObjectPath* path) + CMPIInstance* new_instance(const CMPIObjectPath* path, int allow_null_ns) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIInstance* result; @@ -259,13 +259,16 @@ /* Raise exception if no namespace */ - if (!(ns = CMGetNameSpace(path, &st)) || st.rc || - !(str = CMGetCharsPtr(ns, NULL)) || *str == '\0') + if (!allow_null_ns) { - CMSetStatusWithChars($self, &st, CMPI_RC_ERR_FAILED, - "object path has no namespace"); - _raise_ex(&st); - return NULL; + if (!(ns = CMGetNameSpace(path, &st)) || st.rc || + !(str = CMGetCharsPtr(ns, NULL)) || *str == '\0') + { + CMSetStatusWithChars($self, &st, CMPI_RC_ERR_FAILED, + "object path has no namespace"); + _raise_ex(&st); + return NULL; + } } result = CMNewInstance($self, path, &st); Modified: cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py =================================================================== --- cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py 2008-10-21 23:04:10 UTC (rev 1119) +++ cmpi-bindings/trunk/swig/python/cmpi_pywbem_bindings.py 2008-10-21 23:29:48 UTC (rev 1120) @@ -346,8 +346,17 @@ return self.broker.modifyInstance(self.ctx, cop, inst) def DeliverIndication(self, ns, instance): - inst = self.proxy.pywbem2cmpi_inst(instance) - return self.broker.deliverIndication(self.ctx, ns, inst) + if self.broker.name() == 'Pegasus': + allow_null_ns = False + else: + allow_null_ns = True + if self.broker.name() == 'RequestHandler': + # Check sblim bug #2185410. + if instance.path is not None: + instance.path.namespace = None + inst = self.proxy.pywbem2cmpi_inst(instance, allow_null_ns) + rv = self.broker.deliverIndication(self.ctx, ns, inst) + return rv def is_subclass(self, ns, super, sub): subObjPath=self.broker.new_object_path(ns, sub) @@ -696,12 +705,17 @@ return cargs - def pywbem2cmpi_inst(self, pinst): + def pywbem2cmpi_inst(self, pinst, allow_null_ns=False): pcop = pinst.path - if pcop is None: - pcop = pywbem.CIMInstanceName(pinst.classname) + if not allow_null_ns: + if pcop is None or pcop.namespace is None: + raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_NAMESPACE, + "Instance must have a namespace") + else: + if pcop is None: + pcop = pywbem.CIMInstanceName(pinst.classname) cop = self.pywbem2cmpi_instname(pcop) - cinst = self.broker.new_instance(cop) + cinst = self.broker.new_instance(cop, allow_null_ns) if pinst.property_list is not None: cinst.set_property_filter(pinst.property_list) for prop in pinst.properties.values(): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |