Restore crm_attribute query behavior when attribute does not exist
- Resolves: rhbz2072108
This commit is contained in:
parent
0aace81bdd
commit
d64d4f1961
88
003-regression.patch
Normal file
88
003-regression.patch
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
From 9853f4d05a376062d60f2e4c90938e587992237b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chris Lumens <clumens@redhat.com>
|
||||||
|
Date: Mon, 27 Jun 2022 12:06:24 -0400
|
||||||
|
Subject: [PATCH 1/2] Fix: tools: Don't output "(null)" in crm_attribute's
|
||||||
|
quiet mode.
|
||||||
|
|
||||||
|
If the attribute queried for has no value, simply do not output
|
||||||
|
anything.
|
||||||
|
|
||||||
|
Regression in 2.1.3 introduced by 8c03553bbf
|
||||||
|
|
||||||
|
Fixes T502
|
||||||
|
See: rhbz#2099331
|
||||||
|
---
|
||||||
|
tools/crm_attribute.c | 4 +++-
|
||||||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/tools/crm_attribute.c b/tools/crm_attribute.c
|
||||||
|
index 0bd9dee81..b1463f906 100644
|
||||||
|
--- a/tools/crm_attribute.c
|
||||||
|
+++ b/tools/crm_attribute.c
|
||||||
|
@@ -56,7 +56,9 @@ attribute_text(pcmk__output_t *out, va_list args)
|
||||||
|
char *host G_GNUC_UNUSED = va_arg(args, char *);
|
||||||
|
|
||||||
|
if (out->quiet) {
|
||||||
|
- pcmk__formatted_printf(out, "%s\n", value);
|
||||||
|
+ if (value != NULL) {
|
||||||
|
+ pcmk__formatted_printf(out, "%s\n", value);
|
||||||
|
+ }
|
||||||
|
} else {
|
||||||
|
out->info(out, "%s%s %s%s %s%s value=%s",
|
||||||
|
scope ? "scope=" : "", scope ? scope : "",
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
||||||
|
|
||||||
|
From 16d00a9b3ef27afd09f5c046ea1be50fc664ed84 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chris Lumens <clumens@redhat.com>
|
||||||
|
Date: Mon, 27 Jun 2022 12:18:06 -0400
|
||||||
|
Subject: [PATCH 2/2] Test: cts: Add a test for querying an attribute that does
|
||||||
|
not exist.
|
||||||
|
|
||||||
|
---
|
||||||
|
cts/cli/regression.tools.exp | 4 ++++
|
||||||
|
cts/cts-cli.in | 5 +++++
|
||||||
|
2 files changed, 9 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/cts/cli/regression.tools.exp b/cts/cli/regression.tools.exp
|
||||||
|
index 0d1cfa2ab..464472d42 100644
|
||||||
|
--- a/cts/cli/regression.tools.exp
|
||||||
|
+++ b/cts/cli/regression.tools.exp
|
||||||
|
@@ -24,6 +24,10 @@ A new shadow instance was created. To begin using it paste the following into y
|
||||||
|
</cib>
|
||||||
|
=#=#=#= End test: Validate CIB - OK (0) =#=#=#=
|
||||||
|
* Passed: cibadmin - Validate CIB
|
||||||
|
+=#=#=#= Begin test: Query the value of an attribute that does not exist =#=#=#=
|
||||||
|
+crm_attribute: Error performing operation: No such device or address
|
||||||
|
+=#=#=#= End test: Query the value of an attribute that does not exist - No such object (105) =#=#=#=
|
||||||
|
+* Passed: crm_attribute - Query the value of an attribute that does not exist
|
||||||
|
=#=#=#= Begin test: Configure something before erasing =#=#=#=
|
||||||
|
=#=#=#= Current cib after: Configure something before erasing =#=#=#=
|
||||||
|
<cib epoch="2" num_updates="0" admin_epoch="0">
|
||||||
|
diff --git a/cts/cts-cli.in b/cts/cts-cli.in
|
||||||
|
index 8565c485a..b895d36ec 100755
|
||||||
|
--- a/cts/cts-cli.in
|
||||||
|
+++ b/cts/cts-cli.in
|
||||||
|
@@ -511,6 +511,10 @@ function test_tools() {
|
||||||
|
cmd="cibadmin -Q"
|
||||||
|
test_assert $CRM_EX_OK
|
||||||
|
|
||||||
|
+ desc="Query the value of an attribute that does not exist"
|
||||||
|
+ cmd="crm_attribute -n ABCD --query --quiet"
|
||||||
|
+ test_assert $CRM_EX_NOSUCH 0
|
||||||
|
+
|
||||||
|
desc="Configure something before erasing"
|
||||||
|
cmd="crm_attribute -n cluster-delay -v 60s"
|
||||||
|
test_assert $CRM_EX_OK
|
||||||
|
@@ -1980,6 +1984,7 @@ for t in $tests; do
|
||||||
|
-e 's/ end=\"[0-9][-+: 0-9]*Z*\"/ end=\"\"/' \
|
||||||
|
-e 's/ start=\"[0-9][-+: 0-9]*Z*\"/ start=\"\"/' \
|
||||||
|
-e 's/^Error checking rule: Device not configured/Error checking rule: No such device or address/' \
|
||||||
|
+ -e 's/Error performing operation: Device not configured/Error performing operation: No such device or address/' \
|
||||||
|
-e 's/\(Injecting attribute last-failure-ping#monitor_10000=\)[0-9]*/\1/' \
|
||||||
|
-e 's/^lt-//' \
|
||||||
|
-e 's/ocf::/ocf:/' \
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
||||||
@ -36,7 +36,7 @@
|
|||||||
## can be incremented to build packages reliably considered "newer"
|
## can be incremented to build packages reliably considered "newer"
|
||||||
## than previously built packages with the same pcmkversion)
|
## than previously built packages with the same pcmkversion)
|
||||||
%global pcmkversion 2.1.4
|
%global pcmkversion 2.1.4
|
||||||
%global specversion 1
|
%global specversion 2
|
||||||
|
|
||||||
## Upstream commit (full commit ID, abbreviated commit ID, or tag) to build
|
## Upstream commit (full commit ID, abbreviated commit ID, or tag) to build
|
||||||
%global commit dc6eb4362e67c1497a413434eba097063bf1ef83
|
%global commit dc6eb4362e67c1497a413434eba097063bf1ef83
|
||||||
@ -248,6 +248,7 @@ Source1: https://codeload.github.com/%{github_owner}/%{nagios_name}/tar.gz
|
|||||||
# upstream commits
|
# upstream commits
|
||||||
Patch001: 001-stonith-enabled.patch
|
Patch001: 001-stonith-enabled.patch
|
||||||
Patch002: 002-acl_group.patch
|
Patch002: 002-acl_group.patch
|
||||||
|
Patch003: 003-regression.patch
|
||||||
|
|
||||||
Requires: resource-agents
|
Requires: resource-agents
|
||||||
Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release}
|
Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release}
|
||||||
@ -845,6 +846,10 @@ exit 0
|
|||||||
%license %{nagios_name}-%{nagios_hash}/COPYING
|
%license %{nagios_name}-%{nagios_hash}/COPYING
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jun 28 2022 Ken Gaillot <kgaillot@redhat.com> - 2.1.4-2
|
||||||
|
- Restore crm_attribute query behavior when attribute does not exist
|
||||||
|
- Resolves: rhbz2072108
|
||||||
|
|
||||||
* Wed Jun 15 2022 Ken Gaillot <kgaillot@redhat.com> - 2.1.4-1
|
* Wed Jun 15 2022 Ken Gaillot <kgaillot@redhat.com> - 2.1.4-1
|
||||||
- Rebase pacemaker on upstream 2.1.4 final release
|
- Rebase pacemaker on upstream 2.1.4 final release
|
||||||
- Resolves: rhbz2072108
|
- Resolves: rhbz2072108
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user