resource-agents-sap-hana-sc.../SOURCES/bz2026278-3-SAPHanaController-SAPHanaTopology-fix-list-unit-files-issue.patch

43 lines
1.8 KiB
Diff

From c005e8260b736df63985e303558e13aaa4d579f6 Mon Sep 17 00:00:00 2001
From: AngelaBriel <abriel@suse.com>
Date: Mon, 20 Dec 2021 10:53:07 +0100
Subject: [PATCH] The return value of 'systemctl list-unit-files <service>' is
not reliable on all SLE15 codestreams, so it is not usable for our resource
agents. We need to go back to parsing the command output instead and hoping,
that the output format will not change in the future, because that will
breake the solution again as well.
---
heartbeat/SAPHanaController | 3 ++-
heartbeat/SAPHanaTopology | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/heartbeat/SAPHanaController b/heartbeat/SAPHanaController
index 9b1c401..33ae6d6 100755
--- a/heartbeat/SAPHanaController
+++ b/heartbeat/SAPHanaController
@@ -1137,7 +1137,8 @@ function chk4systemdsupport() {
if [ -x "$SYSTEMCTL" ]; then
if [ -f /etc/systemd/system/"$systemd_unit_name" ]; then
rc=0
- elif $SYSTEMCTL list-unit-files "$systemd_unit_name" >/dev/null 2>&1; then
+ elif $SYSTEMCTL list-unit-files | \
+ awk '$1 == service { found=1 } END { if (! found) {exit 1}}' service="${systemd_unit_name}.service"; then
rc=0
else
rc=1
diff --git a/heartbeat/SAPHanaTopology b/heartbeat/SAPHanaTopology
index 304cea8..b9d5a03 100755
--- a/heartbeat/SAPHanaTopology
+++ b/heartbeat/SAPHanaTopology
@@ -574,7 +574,8 @@ function chk4systemdsupport() {
if [ -x "$SYSTEMCTL" ]; then
if [ -f /etc/systemd/system/"$systemd_unit_name" ]; then
rc=0
- elif $SYSTEMCTL list-unit-files "$systemd_unit_name" >/dev/null 2>&1; then
+ elif $SYSTEMCTL list-unit-files | \
+ awk '$1 == service { found=1 } END { if (! found) {exit 1}}' service="${systemd_unit_name}.service"; then
rc=0
else
rc=1