Blame SOURCES/0002-pacemaker-Handle-updated-exit-code-of-crm_ticket.patch

b9df40
From bb58699a47a7b9070d555490f980c33caa3066e9 Mon Sep 17 00:00:00 2001
b9df40
From: Jan Friesse <jfriesse@redhat.com>
b9df40
Date: Mon, 8 Jun 2020 15:38:06 +0200
b9df40
Subject: [PATCH] pacemaker: Handle updated exit code of crm_ticket
b9df40
b9df40
crm_ticket included since Pacemaker version 2.0.0-rc2 doesn't return
b9df40
EPERM (1) error code any longer when ticket is updated without using
b9df40
--force. Instead new value CRM_EX_INSUFFICIENT_PRIV (4) is used.
b9df40
b9df40
This return value is used in the test_atomicity function which is
b9df40
failing with new enough Pacemaker.
b9df40
b9df40
Solution is to check also for return code 4.
b9df40
b9df40
Also previously when unexpected code is returned, log contained full
b9df40
return value as returned by system call. This is not very readable so
b9df40
use only exit status (WEXITSTATUS) instead.
b9df40
b9df40
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
b9df40
---
b9df40
 src/pacemaker.c | 6 ++++--
b9df40
 1 file changed, 4 insertions(+), 2 deletions(-)
b9df40
b9df40
diff --git a/src/pacemaker.c b/src/pacemaker.c
b9df40
index 7e3f9e6..1582fa8 100644
b9df40
--- a/src/pacemaker.c
b9df40
+++ b/src/pacemaker.c
b9df40
@@ -59,6 +59,7 @@ enum atomic_ticket_supported atomicity = UNKNOWN;
b9df40
  *   - the old version asks for "Y/N" via STDIN, and returns 0
b9df40
  *     when reading "no";
b9df40
  *   - the new version just reports an error without asking.
b9df40
+ *     Since 2.0.0-rc2 error code is changed from 1 (EPERM) to 4 (CRM_EX_INSUFFICIENT_PRIV)
b9df40
  */
b9df40
 static void test_atomicity(void)
b9df40
 {
b9df40
@@ -86,7 +87,8 @@ static void test_atomicity(void)
b9df40
 		log_info("Old \"crm_ticket\" found, using non-atomic ticket updates.");
b9df40
 		break;
b9df40
 
b9df40
-	case 1:
b9df40
+	case 1: /* Pacemaker < 2.0.0-rc2 - EPERM */
b9df40
+	case 4: /* Pacemaker >= 2.0.0-rc2 - CRM_EX_INSUFFICIENT_PRIV */
b9df40
 		atomicity = YES;
b9df40
 		log_info("New \"crm_ticket\" found, using atomic ticket updates.");
b9df40
 		break;
b9df40
@@ -94,7 +96,7 @@ static void test_atomicity(void)
b9df40
 	default:
b9df40
 		log_error("Unexpected return value from \"crm_ticket\" (%d), "
b9df40
 				"falling back to non-atomic ticket updates.",
b9df40
-				rv);
b9df40
+				WEXITSTATUS(rv));
b9df40
 		atomicity = NO;
b9df40
 	}
b9df40
 
b9df40
-- 
b9df40
2.18.2
b9df40