File pacemaker#3628-0001-Fix-libcrmcommon-Detect-newly-created-alerts-section.patch of Package pacemaker.36799

From 562745575a4d8dc00c239e674714856c51cac6ef Mon Sep 17 00:00:00 2001
From: Reid Wahl <nrwahl@protonmail.com>
Date: Wed, 28 Aug 2024 19:12:20 -0700
Subject: [PATCH] Fix: libcrmcommon: Detect newly created alerts section

This fixes a regression introduced by 20ad1a9.

If the CIB does not already contain an alerts element, creating a new
alert requires creating the alerts element. This is included in the
patchset as a create operation. (Adding a new alert to an existing
alerts element is a modify operation.)

Prior to this commit, we were checking whether cib_op="create". We
should be checking whether operation="create".

As a result, if a new alert was created in a CIB that did not previously
contain an alerts element, the controller would not detect the change
and would not process the new alert.

Fixes T865
Fixes RHEL-55458

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
---
 lib/cib/cib_utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: pacemaker-2.1.7+20231219.0f7f88312/lib/cib/cib_utils.c
===================================================================
--- pacemaker-2.1.7+20231219.0f7f88312.orig/lib/cib/cib_utils.c
+++ pacemaker-2.1.7+20231219.0f7f88312/lib/cib/cib_utils.c
@@ -171,7 +171,7 @@ element_in_patchset_v2(const xmlNode *pa
     for (const xmlNode *change = first_named_child(patchset, XML_DIFF_CHANGE);
          change != NULL; change = crm_next_same_xml(change)) {
 
-        const char *op = crm_element_value(change, F_CIB_OPERATION);
+        const char *op = crm_element_value(change, XML_DIFF_OP);
         const char *diff_xpath = crm_element_value(change, XML_DIFF_PATH);
 
         if (pcmk__str_eq(diff_xpath, element_regex, pcmk__str_regex)) {
openSUSE Build Service is sponsored by