def parse_embeddedObject(val): if isinstance(val, list): return [parse_embeddedObject(obj) for obj in val] if val is None: return None tt = xml_to_tupletree(val) if tt[0] == 'INSTANCE': return parse_instance(tt) elif tt[0] == 'CLASS': return parse_class(tt) else: raise ParseError('Error parsing embedded object')
# Get XML response try: resp_xml = cim_http.wbem_request(self.url, req_xml.toxml(), self.creds, headers, x509 = self.x509, verify_callback = self.verify_callback) except cim_http.Error, arg: # Convert cim_http exceptions to CIMError exceptions raise CIMError(0, str(arg)) if self.debug: self.last_reply = resp_xml tt = parse_cim(xml_to_tupletree(resp_xml)) if tt[0] != 'CIM': raise CIMError(0, 'Expecting CIM element, got %s' % tt[0]) tt = tt[2] if tt[0] != 'MESSAGE': raise CIMError(0, 'Expecting MESSAGE element, got %s' % tt[0]) tt = tt[2] if len(tt) != 1 or tt[0][0] != 'SIMPLERSP': raise CIMError(0, 'Expecting one SIMPLERSP element') tt = tt[0][2] if tt[0] != 'METHODRESPONSE': raise CIMError(