Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP5:GA
pacemaker.9287
bug-888726_pacemaker-crm_diff-no-version.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bug-888726_pacemaker-crm_diff-no-version.patch of Package pacemaker.9287
commit 77f6f6bb919409e541a7a3d47361a81d0fba2391 Author: Gao,Yan <ygao@suse.com> Date: Wed Aug 6 15:51:42 2014 +0800 Feature: crm_diff: Support generating a difference without versions details if --no-version/-u is supplied Index: pacemaker/tools/xml_diff.c =================================================================== --- pacemaker.orig/tools/xml_diff.c +++ pacemaker/tools/xml_diff.c @@ -53,6 +53,7 @@ static struct crm_option long_options[] {"cib", 0, 0, 'c', "\t\tCompare/patch the inputs as a CIB (includes versions details)"}, {"filter", 0, 0, 'f', "\t\tSuppress irrelevant differences between the two inputs"}, {"stdin", 0, 0, 's', NULL, 1}, + {"no-version", 0, 0, 'u', "\tGenerate the difference without versions details"}, {"-spacer-", 1, 0, '-', "\nExamples:", pcmk_option_paragraph}, {"-spacer-", 1, 0, '-', "Obtain the two different configuration files by running cibadmin on the two cluster setups to compare:", pcmk_option_paragraph}, {"-spacer-", 1, 0, '-', " cibadmin --query > cib-old.xml", pcmk_option_example}, @@ -76,6 +77,7 @@ main(int argc, char **argv) gboolean raw_2 = FALSE; gboolean use_stdin = FALSE; gboolean as_cib = FALSE; + gboolean no_version = FALSE; int argerr = 0; int flag; xmlNode *object_1 = NULL; @@ -125,6 +127,9 @@ main(int argc, char **argv) case 'c': as_cib = TRUE; break; + case 'u': + no_version = TRUE; + break; case 'V': crm_bump_log_level(argc, argv); break; @@ -216,6 +221,52 @@ main(int argc, char **argv) crm_info("Patch: --- %d.%d.%d %s", del[0], del[1], del[2], fmt); crm_info("Patch: +++ %d.%d.%d %s", add[0], add[1], add[2], digest); } + + } else if (output && no_version) { + int format = 1; + + crm_element_value_int(output, "format", &format); + if (format == 2) { + xmlNode *version_xml = find_xml_node(output, "version", FALSE); + + if (version_xml) { + free_xml(version_xml); + } + + } else { + int i = 0; + + const char *tags[] = { + XML_TAG_DIFF_REMOVED, + XML_TAG_DIFF_ADDED, + }; + + const char *vfields[] = { + XML_ATTR_GENERATION_ADMIN, + XML_ATTR_GENERATION, + XML_ATTR_NUMUPDATES, + }; + + for (i = 0; i < DIMOF(tags); i++) { + xmlNode *tmp = NULL; + + tmp = find_xml_node(output, tags[i], FALSE); + if (tmp) { + int lpc = 0; + + for (lpc = 0; lpc < DIMOF(vfields); lpc++) { + xml_remove_prop(tmp, vfields[lpc]); + } + + tmp = find_xml_node(tmp, XML_TAG_CIB, FALSE); + if (tmp) { + for (lpc = 0; lpc < DIMOF(vfields); lpc++) { + xml_remove_prop(tmp, vfields[lpc]); + } + } + } + } + } } xml_log_changes(LOG_INFO, __FUNCTION__, object_2); xml_log_patchset(LOG_NOTICE, __FUNCTION__, output);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor