Blob Blame History Raw
From f17c99492c7ab9e639b940a34d2a48b55937b605 Mon Sep 17 00:00:00 2001
From: Ken Gaillot <kgaillot@redhat.com>
Date: Tue, 14 Jan 2020 16:00:36 -0600
Subject: [PATCH 03/18] Low: tools: improve crm_resource "why" messages

---
 tools/crm_resource_runtime.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c
index 9ae24b6..61ceee7 100644
--- a/tools/crm_resource_runtime.c
+++ b/tools/crm_resource_runtime.c
@@ -878,7 +878,7 @@ cli_cleanup_all(crm_ipc_t *crmd_channel, const char *node_name,
 void
 cli_resource_check(cib_t * cib_conn, resource_t *rsc)
 {
-    int need_nl = 0;
+    bool printed = false;
     char *role_s = NULL;
     char *managed = NULL;
     resource_t *parent = uber_parent(rsc);
@@ -897,23 +897,26 @@ cli_resource_check(cib_t * cib_conn, resource_t *rsc)
             // Treated as if unset
 
         } else if(role == RSC_ROLE_STOPPED) {
-            printf("\n  * The configuration specifies that '%s' should remain stopped\n", parent->id);
-            need_nl++;
+            printf("\n  * Configuration specifies '%s' should remain stopped\n",
+                   parent->id);
+            printed = true;
 
         } else if (is_set(parent->flags, pe_rsc_promotable)
                    && (role == RSC_ROLE_SLAVE)) {
-            printf("\n  * The configuration specifies that '%s' should not be promoted\n", parent->id);
-            need_nl++;
+            printf("\n  * Configuration specifies '%s' should not be promoted\n",
+                   parent->id);
+            printed = true;
         }
     }
 
-    if(managed && crm_is_true(managed) == FALSE) {
-        printf("%s  * The configuration prevents the cluster from stopping or starting '%s' (unmanaged)\n", need_nl == 0?"\n":"", parent->id);
-        need_nl++;
+    if (managed && !crm_is_true(managed)) {
+        printf("%s  * Configuration prevents cluster from stopping or starting unmanaged '%s'\n",
+               (printed? "" : "\n"), parent->id);
+        printed = true;
     }
     free(managed);
 
-    if(need_nl) {
+    if (printed) {
         printf("\n");
     }
 }
-- 
1.8.3.1