From 939053305c33ed5a61ee475a58d71798d1eb0cb3 Mon Sep 17 00:00:00 2001 From: yengliong Date: Tue, 1 Oct 2024 10:33:27 +0800 Subject: [PATCH] [NEXARL-306] Update prerm script to not disabling and stopping agents if it's an upgrade process This PR updates the prerm script to prevent them from disabling and stopping if it's an upgrade process. Signed-off-by: yengliong --- inbm/Changelog.md | 2 ++ inbm/cloudadapter-agent/scripts/before-remove.sh | 6 ++++++ inbm/configuration-agent/scripts/before-remove.sh | 6 ++++++ inbm/diagnostic-agent/scripts/before-remove.sh | 6 ++++++ inbm/dispatcher-agent/scripts/before-remove.sh | 6 ++++++ inbm/telemetry-agent/scripts/before-remove.sh | 6 ++++++ 6 files changed, 32 insertions(+) diff --git a/inbm/Changelog.md b/inbm/Changelog.md index d3bce7e6e..38f2dda82 100644 --- a/inbm/Changelog.md +++ b/inbm/Changelog.md @@ -9,6 +9,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). its status with INBS. - (NEXMANAGE- 610) Add functionality to INBM Cloudadapter-agent to support OOB AMT RPC command requests from INBS +### Changed + - (NEXARL-306) Update agents' prerm script to prevent them from disabling and stopping if it's an upgrade process ### Fixed - (NEXMANAGE-746) Add extra sleeptime in INBM tpm script to resolve ARL platform issue diff --git a/inbm/cloudadapter-agent/scripts/before-remove.sh b/inbm/cloudadapter-agent/scripts/before-remove.sh index c80270ca1..9068680b2 100644 --- a/inbm/cloudadapter-agent/scripts/before-remove.sh +++ b/inbm/cloudadapter-agent/scripts/before-remove.sh @@ -4,6 +4,12 @@ AGENT=inbm-cloudadapter echo "Running pre-remove steps for ${AGENT} agent..." +# If it is an upgrade, don't stop and disable the agent. +if [ "$1" = "upgrade" ]; then + echo "Upgrade in progress, not stopping or disabling ${AGENT} service." + exit 0 +fi + # Stop service if systemctl is-active ${AGENT} ; then echo "Stopping ${AGENT} agent." diff --git a/inbm/configuration-agent/scripts/before-remove.sh b/inbm/configuration-agent/scripts/before-remove.sh index 137d6a1a3..f1afc81a0 100644 --- a/inbm/configuration-agent/scripts/before-remove.sh +++ b/inbm/configuration-agent/scripts/before-remove.sh @@ -4,6 +4,12 @@ AGENT=inbm-configuration echo "Running pre-remove steps for ${AGENT} agent..." +# If it is an upgrade, don't stop and disable the agent. +if [ "$1" = "upgrade" ]; then + echo "Upgrade in progress, not stopping or disabling ${AGENT} service." + exit 0 +fi + # Stop service if systemctl is-active ${AGENT} ; then echo "Stopping ${AGENT} agent." diff --git a/inbm/diagnostic-agent/scripts/before-remove.sh b/inbm/diagnostic-agent/scripts/before-remove.sh index a85da2c09..f1a406021 100644 --- a/inbm/diagnostic-agent/scripts/before-remove.sh +++ b/inbm/diagnostic-agent/scripts/before-remove.sh @@ -4,6 +4,12 @@ AGENT=inbm-diagnostic echo "Running pre-remove steps for ${AGENT} agent..." +# If it is an upgrade, don't stop and disable the agent. +if [ "$1" = "upgrade" ]; then + echo "Upgrade in progress, not stopping or disabling ${AGENT} service." + exit 0 +fi + # Stop service if systemctl is-active ${AGENT} ; then echo "Stopping ${AGENT} agent." diff --git a/inbm/dispatcher-agent/scripts/before-remove.sh b/inbm/dispatcher-agent/scripts/before-remove.sh index 99b1fd084..63aad6f0f 100644 --- a/inbm/dispatcher-agent/scripts/before-remove.sh +++ b/inbm/dispatcher-agent/scripts/before-remove.sh @@ -4,6 +4,12 @@ AGENT=inbm-dispatcher echo "Running pre-remove steps for ${AGENT} agent..." +# If it is an upgrade, don't stop and disable the agent. +if [ "$1" = "upgrade" ]; then + echo "Upgrade in progress, not stopping or disabling ${AGENT} service." + exit 0 +fi + # Stop service if systemctl is-active ${AGENT} ; then echo "Stopping ${AGENT} agent." diff --git a/inbm/telemetry-agent/scripts/before-remove.sh b/inbm/telemetry-agent/scripts/before-remove.sh index 2e2bf6307..051f0b137 100644 --- a/inbm/telemetry-agent/scripts/before-remove.sh +++ b/inbm/telemetry-agent/scripts/before-remove.sh @@ -4,6 +4,12 @@ AGENT=inbm-telemetry echo "Running pre-remove steps for ${AGENT} agent..." +# If it is an upgrade, don't stop and disable the agent. +if [ "$1" = "upgrade" ]; then + echo "Upgrade in progress, not stopping or disabling ${AGENT} service." + exit 0 +fi + # Stop service if systemctl is-active ${AGENT} ; then echo "Stopping ${AGENT} agent."