Blob Blame History Raw
From 612fcbb399cfaa558504eeaa6ab16064e9013238 Mon Sep 17 00:00:00 2001
From: Ken Gaillot <kgaillot@redhat.com>
Date: Tue, 7 Aug 2018 11:56:06 -0500
Subject: [PATCH] Feature: tools: enable 2.0 behavior of crm_resource clean-up

---
 tools/crm_resource.c | 49 +++++----------
 1 file changed, 20 insertions(+), 29 deletions(-)

diff --git a/tools/crm_resource.c b/tools/crm_resource.c
index 128d075..bbdba25 100644
--- a/tools/crm_resource.c
+++ b/tools/crm_resource.c
@@ -214,8 +214,6 @@ static struct crm_option long_options[] = {
     },
     {
         "cleanup", no_argument, NULL, 'C',
-#if 0
-        // new behavior disabled until 2.0.0
         "\t\tIf resource has any past failures, clear its history and fail count.\n"
         "\t\t\t\tOptionally filtered by --resource, --node, --operation, and --interval (otherwise all).\n"
         "\t\t\t\t--operation and --interval apply to fail counts, but entire history is always cleared,\n"
@@ -221,7 +219,6 @@ static struct crm_option long_options[] = {
     },
     {
         "refresh", no_argument, NULL, 'R',
-#endif
         "\t\tDelete resource's history (including failures) so its current state is rechecked.\n"
         "\t\t\t\tOptionally filtered by --resource and --node (otherwise all). If the named resource is\n"
         "\t\t\t\tpart of a group, or one numbered instance of a clone or bundled resource, the clean-up\n"
@@ -352,13 +349,11 @@ static struct crm_option long_options[] = {
     },
     {
         "operation", required_argument, NULL, 'n',
-        "\tOperation to clear instead of all (with -C -r)",
-        pcmk_option_hidden // only used with 2.0 -C behavior
+        "\tOperation to clear instead of all (with -C -r)"
     },
     {
         "interval", required_argument, NULL, 'I',
-        "\tInterval of operation to clear (default 0) (with -C -r -n)",
-        pcmk_option_hidden // only used with 2.0 -C behavior
+        "\tInterval of operation to clear (default 0) (with -C -r -n)"
     },
     {
         "set-name", required_argument, NULL, 's',
@@ -388,7 +383,6 @@ static struct crm_option long_options[] = {
     {"un-migrate", no_argument, NULL, 'U', NULL, pcmk_option_hidden},
     {"un-move", no_argument, NULL, 'U', NULL, pcmk_option_hidden},
 
-    {"refresh",    0, 0, 'R', NULL, pcmk_option_hidden}, // remove this line for 2.0.0
     {"reprobe", no_argument, NULL, 'P', NULL, pcmk_option_hidden},
 
     {"-spacer-", 1, NULL, '-', "\nExamples:", pcmk_option_paragraph},
@@ -630,15 +624,16 @@ main(int argc, char **argv)
                 require_resource = FALSE;
                 break;
 
+            case 'P':
+                flag = 'R';
             case 'C':
             case 'R':
-            case 'P':
                 crm_log_args(argc, argv);
                 require_resource = FALSE;
                 if (cib_file == NULL) {
                     require_crmd = TRUE;
                 }
-                rsc_cmd = 'R'; // disable new behavior until 2.0
+                rsc_cmd = flag;
                 find_flags = pe_find_renamed|pe_find_anon;
                 break;
 
-- 
1.8.3.1