Fix: cibsecret: Use 'ps axww' to avoid truncating issue

This commit is contained in:
zouzhimin 2024-04-28 16:52:38 +08:00
parent 34cace3d14
commit 636afb638d
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From 581e1bf3850a5e6a972ea02198bbbf2d99b29873 Mon Sep 17 00:00:00 2001
From: xin liang <xliang@suse.com>
Date: Wed, 6 Mar 2024 17:07:16 +0800
Subject: [PATCH] Fix: cibsecret: Use 'ps axww' to avoid truncating issue
When python program calling cibsecret with a small terminal width,
the command `ps -ef | grep '[p]acemaker-controld'` will return 1, see
>>> cmd = "ps -ef | grep '[p]acemaker-controld' >/dev/null"
>>> # When terminal width is small
>>> subprocess.call(cmd, shell=True)
1
>>> # When terminal is big enough
>>> subprocess.call(cmd, shell=True)
0
Use 'ps axww' can avoid this issue, also for BSD environment.
---
tools/cibsecret.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/cibsecret.in b/tools/cibsecret.in
index 4569863af..9df420126 100644
--- a/tools/cibsecret.in
+++ b/tools/cibsecret.in
@@ -171,7 +171,7 @@ check_env() {
else
fatal $CRM_EX_NOT_INSTALLED "please install pssh, pdsh, or ssh to run $PROG"
fi
- ps -ef | grep '[p]acemaker-controld' >/dev/null ||
+ ps axww | grep '[p]acemaker-controld' >/dev/null ||
fatal $CRM_EX_UNAVAILABLE "pacemaker not running? $PROG needs pacemaker"
}
--
2.25.1

View File

@ -17,7 +17,7 @@
## can be incremented to build packages reliably considered "newer"
## than previously built packages with the same pcmkversion)
%global pcmkversion 2.1.7
%global specversion 8
%global specversion 9
## Upstream commit (full commit ID, abbreviated commit ID, or tag) to build
%global commit 0f7f88312f7a1ccedee60bf768aba79ee13d41e0
@ -154,6 +154,7 @@ Patch1: 001-schema-glib.patch
Patch2: Doc-HealthSMART-fix-the-description-of-temp_lower.patch
Patch3: 002-schema-transfer.patch
Patch4: Improve-pacemaker-attrd-cache-management-and-logging.patch
Patch5: Fix-cibsecret-Use-ps-axww-to-avoid-truncating-issue.patch
Requires: resource-agents
Requires: %{pkgname_pcmk_libs} = %{version}-%{release}
@ -761,6 +762,9 @@ exit 0
%license %{nagios_name}-%{nagios_hash}/COPYING
%changelog
* Sun Apr 28 2024 zouzhimin <zouzhimin@kylinos.cn> - 2.1.7-9
- Fix: cibsecret: Use 'ps axww' to avoid truncating issue
* Mon Apr 01 2024 zouzhimin <zouzhimin@kylinos.cn> - 2.1.7-8
- Fixed the warning message during installation of pacemaker-cli