Skip to content

Commit

Permalink
DLPX-84565 telegraf.service restarts after upgrade when it should be …
Browse files Browse the repository at this point in the history
  • Loading branch information
palash-gandhi committed Sep 26, 2023
1 parent 0bdff1c commit 2bc9468
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion upgrade/upgrade-scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ function mask_service() {
chroot "/var/lib/machines/$container" systemctl mask "$svc" ||
die "failed to mask '$svc' in container '$container'"
else
systemctl mask "$svc" || die "failed to mask '$svc'"
systemctl mask --now "$svc" || die "failed to mask '$svc'"
fi
}

Expand Down Expand Up @@ -417,6 +417,18 @@ function is_svc_new_or_masked_or_disabled() {
function fix_and_migrate_services() {
local container="$1"

#
# telegraf was introduced in 6.0.15.0. If an engine was upgraded from a version <6.0.15.0 to
# >=6.0.15.0, the telegraf service is running because of it's postinst script. While fresh
# installs of engines >=6.0.15.0 ensured that the telegraf.service was disabled, the upgrade path
# did not. Since this function is first used to create an upgrade container and uses the state of
# services on the running system as the source of truth, it is the right place to disable the
# service on the engine if it is running.
#
if [[ -n "$container" ]] && [[ "$(systemctl is-enabled telegraf.service)" == enabled ]]; then
systemctl disable telegraf.service
fi

#
# This function must be called from outside an upgrade container as it
# uses the state of the services on the running system as the source of
Expand Down Expand Up @@ -483,5 +495,6 @@ function fix_and_migrate_services() {
snmpd.service
systemd-timesyncd.service
td-agent.service
telegraf.service
EOF
}

0 comments on commit 2bc9468

Please sign in to comment.