File pacemaker-tools-handle-multiple-values-properly-in-crm_attribute.patch of Package pacemaker.15719

commit b34bb37159bdd3363b2528771bcf72b4661fb330
Author: Ken Gaillot <kgaillot@redhat.com>
Date:   Thu May 10 12:23:15 2018 -0500

    Low: tools: handle multiple values properly in crm_attribute
    
    Regression introduced in db20d02 (1.1.10)

diff --git a/cts/cli/regression.tools.exp b/cts/cli/regression.tools.exp
index 2caf1c44f..73155fbab 100644
--- a/cts/cli/regression.tools.exp
+++ b/cts/cli/regression.tools.exp
@@ -256,10 +256,10 @@ Call failed: File exists
 =#=#=#= End test: Set duplicate cluster option - OK (0) =#=#=#=
 * Passed: crm_attribute  - Set duplicate cluster option
 =#=#=#= Begin test: Setting multiply defined cluster option should fail =#=#=#=
-Error performing operation: Name not unique on network
 Multiple attributes match name=cluster-delay
   Value: 60s 	(id=cib-bootstrap-options-cluster-delay)
   Value: 40s 	(id=duplicate-cluster-delay)
+Please choose from one of the matches above and supply the 'id' with --attr-id
 =#=#=#= Current cib after: Setting multiply defined cluster option should fail =#=#=#=
 <cib epoch="7" num_updates="0" admin_epoch="1">
   <configuration>
diff --git a/tools/crm_attribute.c b/tools/crm_attribute.c
index f0bfdd214..107dad016 100644
--- a/tools/crm_attribute.c
+++ b/tools/crm_attribute.c
@@ -309,7 +309,8 @@ main(int argc, char **argv)
         crm_info("Read %s=%s %s%s",
                  attr_name, crm_str(read_value), set_name ? "in " : "", set_name ? set_name : "");
 
-        if (rc == -EINVAL) {
+        if (rc == -ENOTUNIQ) {
+            // Multiple matches (already displayed) are not error for queries
             rc = pcmk_ok;
 
         } else if (BE_QUIET == FALSE) {
@@ -325,7 +326,7 @@ main(int argc, char **argv)
         free(read_value);
     }
 
-    if (rc == -EINVAL) {
+    if (rc == -ENOTUNIQ) {
         printf("Please choose from one of the matches above and supply the 'id' with --attr-id\n");
 
     } else if (rc != pcmk_ok) {
openSUSE Build Service is sponsored by