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 Oct 5, 2023
1 parent 118ab7f commit 0ee6761
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
12 changes: 11 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 @@ -442,6 +442,15 @@ function fix_and_migrate_services() {
fi
fi

#
# Due to https://github.com/influxdata/telegraf/issues/14052, telegraf must be masked after
# packages are upgraded. The telegraf package removes /etc/systemd/system/telegraf.service thus
# reversing the `systemctl mask` operation performed before the packages are upgraded.
#
if [[ "$(systemctl is-enabled telegraf)" == enabled ]]; then
mask_service telegraf "$container"
fi

#
# The services listed below are either permanently disabled or can be
# dynamically modified by the application(s) running on the appliance,
Expand Down Expand Up @@ -483,5 +492,6 @@ function fix_and_migrate_services() {
snmpd.service
systemd-timesyncd.service
td-agent.service
telegraf.service
EOF
}
9 changes: 9 additions & 0 deletions upgrade/upgrade-scripts/execute
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,15 @@ dpkg-query -Wf '${Conffiles}\n' | awk '$3 == "obsolete" {print $1}' |
die "failed to reinstall package '$package'"
done || die "failed to remove obsolete package configuration files"

#
# telegraf's postinst script recreates the service unit and attempts to enable the service,
# which means that the previous attempt to mask it is reversed. Due to this and DLPX-84565,
# telegraf must be masked after packages are upgraded.
#
if [[ "$(systemctl is-enabled telegraf)" == enabled ]]; then
systemctl mask --now telegraf.service
fi

#
# Unmask docker, which was masked at the beginning of the upgrade due
# to DLPX-77949.
Expand Down

0 comments on commit 0ee6761

Please sign in to comment.