File pacemaker-crm_resource-cleanup-for-saved-configuration.patch of Package pacemaker.10130

commit 870ebe5152d586198366a791d67f4e218df0b743
Author: Andrew Beekhof <andrew@beekhof.net>
Date:   Wed Oct 11 13:27:32 2017 +1100

    Test: crm_resource: See what cleanup would have done for a saved configuration

Index: pacemaker-1.1.16+20170320.77ea74d/tools/crm_resource.c
===================================================================
--- pacemaker-1.1.16+20170320.77ea74d.orig/tools/crm_resource.c
+++ pacemaker-1.1.16+20170320.77ea74d/tools/crm_resource.c
@@ -786,7 +786,7 @@ main(int argc, char **argv)
     }
 
     /* Establish a connection to the CRMd if needed */
-    if (require_crmd) {
+    if (getenv("CIB_file") == NULL && require_crmd) {
         xmlNode *xml = NULL;
         mainloop_io_t *source =
             mainloop_add_ipc_client(CRM_SYSTEM_CRMD, G_PRIORITY_DEFAULT, 0, NULL, &crm_callbacks);
Index: pacemaker-1.1.16+20170320.77ea74d/tools/crm_resource_runtime.c
===================================================================
--- pacemaker-1.1.16+20170320.77ea74d.orig/tools/crm_resource_runtime.c
+++ pacemaker-1.1.16+20170320.77ea74d/tools/crm_resource_runtime.c
@@ -651,6 +651,11 @@ cli_resource_delete(crm_ipc_t *crmd_chan
         return -EOPNOTSUPP;
     }
 
+    if(getenv("CIB_file") != NULL) {
+        printf("Would have cleaned up %s on %s\n", rsc->id, host_uname);
+        return rc;
+     }
+
     /* Erase the resource's entire LRM history in the CIB, even if we're only
      * clearing a single operation's fail count. If we erased only entries for a
      * single operation, we might wind up with a wrong idea of the current
openSUSE Build Service is sponsored by