| 35 | #include <crm/common/xml.h> |
| 36 | |
| 37 | int |
| 38 | cib_process_query(const char *op, int options, const char *section, xmlNode * req, xmlNode * input, |
| 39 | xmlNode * existing_cib, xmlNode ** result_cib, xmlNode ** answer) |
| 40 | { |
| 41 | xmlNode *obj_root = NULL; |
| 42 | int result = pcmk_ok; |
| 43 | |
| 44 | crm_trace("Processing \"%s\" event for section=%s", op, crm_str(section)); |
| 45 | |
| 46 | if (options & cib_xpath) { |
| 47 | return cib_process_xpath(op, options, section, req, input, |
| 48 | existing_cib, result_cib, answer); |
| 49 | } |
| 50 | |
| 51 | CRM_CHECK(*answer == NULL, free_xml(*answer)); |
| 52 | *answer = NULL; |
| 53 | |
| 54 | if (safe_str_eq(XML_CIB_TAG_SECTION_ALL, section)) { |
| 55 | section = NULL; |
| 56 | } |
| 57 | |
| 58 | obj_root = get_object_root(section, existing_cib); |
| 59 | |
| 60 | if (obj_root == NULL) { |
| 61 | result = -ENXIO; |
| 62 | |
| 63 | } else if (options & cib_no_children) { |
| 64 | const char *tag = TYPE(obj_root); |
| 65 | xmlNode *shallow = create_xml_node(*answer, tag); |
| 66 | |
| 67 | copy_in_properties(shallow, obj_root); |
| 68 | *answer = shallow; |
| 69 | |
| 70 | } else { |
| 71 | *answer = obj_root; |
| 72 | } |
| 73 | |
| 74 | if (result == pcmk_ok && *answer == NULL) { |
| 75 | crm_err("Error creating query response"); |
| 76 | result = -ENOMSG; |
| 77 | } |
| 78 | |
| 79 | return result; |
| 80 | } |
| 81 | |
| 82 | int |
| 83 | cib_process_erase(const char *op, int options, const char *section, xmlNode * req, xmlNode * input, |
nothing calls this directly
no test coverage detected