From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <f.gruenbichler@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id AB71E94D7E
 for <pve-devel@lists.proxmox.com>; Thu, 11 Apr 2024 12:11:16 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 8BEC51F06E
 for <pve-devel@lists.proxmox.com>; Thu, 11 Apr 2024 12:10:46 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pve-devel@lists.proxmox.com>; Thu, 11 Apr 2024 12:10:46 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id CFEF3449C6
 for <pve-devel@lists.proxmox.com>; Thu, 11 Apr 2024 12:10:45 +0200 (CEST)
From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Thu, 11 Apr 2024 12:10:44 +0200
Message-Id: <20240411101044.304124-1-f.gruenbichler@proxmox.com>
X-Mailer: git-send-email 2.39.2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.057 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: [pve-devel] [PATCH ha-manager] d/postinst: make deb-systemd-invoke
 non-fatal
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 11 Apr 2024 10:11:16 -0000

else this can break an upgrade for unrelated reasons.

this also mimics debhelper behaviour more (which we only not use here because
of lack of reload support) - restructured the snippet to be more similar with
an explicit `if` as well.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 debian/pve-ha-manager.postinst | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/debian/pve-ha-manager.postinst b/debian/pve-ha-manager.postinst
index 94ab797..5c8f0cd 100644
--- a/debian/pve-ha-manager.postinst
+++ b/debian/pve-ha-manager.postinst
@@ -5,11 +5,13 @@ set -e
 #DEBHELPER#
 
 if [ "$1" = "triggered" ]; then
-    systemctl --quiet is-active pve-ha-lrm.service &&
-      deb-systemd-invoke reload-or-try-restart pve-ha-lrm.service
+    if systemctl --quiet is-active pve-ha-lrm.service; then
+      deb-systemd-invoke reload-or-try-restart pve-ha-lrm.service || true
+    fi
 
-    systemctl --quiet is-active pve-ha-crm.service &&
-      deb-systemd-invoke reload-or-try-restart pve-ha-crm.service
+    if systemctl --quiet is-active pve-ha-crm.service; then
+      deb-systemd-invoke reload-or-try-restart pve-ha-crm.service || true
+    fi
 fi
 
 exit 0
-- 
2.39.2