MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / expand_idref

Function expand_idref

lib/common/xml.c:2840–2872  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2838}
2839
2840xmlNode *expand_idref(xmlNode *input, xmlNode *top)
2841{
2842 const char *tag = NULL;
2843 const char *ref = NULL;
2844 xmlNode *result = input;
2845 char *xpath_string = NULL;
2846
2847 if(result == NULL) {
2848 return NULL;
2849
2850 } else if(top == NULL) {
2851 top = input;
2852 }
2853
2854 tag = crm_element_name(result);
2855 ref = crm_element_value(result, XML_ATTR_IDREF);
2856
2857 if(ref != NULL) {
2858 int xpath_max = 512, offset = 0;
2859 xpath_string = calloc(1, xpath_max);
2860
2861 offset += snprintf(xpath_string + offset, xpath_max - offset, "//%s[@id='%s']", tag, ref);
2862 result = get_xpath_object(xpath_string, top, LOG_ERR);
2863 if(result == NULL) {
2864 char *nodePath = (char *)xmlGetNodePath(top);
2865 crm_err("No match for %s found in %s: Invalid configuration", xpath_string, crm_str(nodePath));
2866 free(nodePath);
2867 }
2868 }
2869
2870 free(xpath_string);
2871 return result;
2872}
2873
2874xmlNode*
2875get_xpath_object_relative(const char *xpath, xmlNode *xml_obj, int error_level)

Callers 7

test_ruleFunction · 0.85
common_unpackFunction · 0.85
generate_location_ruleFunction · 0.85
unpack_rsc_orderFunction · 0.85
unpack_rsc_colocationFunction · 0.85
unpack_rsc_ticketFunction · 0.85

Calls 2

crm_element_valueFunction · 0.85
get_xpath_objectFunction · 0.85

Tested by 1

test_ruleFunction · 0.68