Skip to content

Commit f9f352d

Browse files
Merge pull request #828 from delphix/revert-822-dlpx/pr/mszak-perforce/9b5244db-c464-4305-bce8-306d3cb9513c
Revert "DLPX-93758 upgrade incorrectly masking already masked service"
2 parents e0858b6 + 39e441a commit f9f352d

File tree

1 file changed

+17
-23
lines changed

1 file changed

+17
-23
lines changed

upgrade/upgrade-scripts/common.sh

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ LOG_DIRECTORY="/var/tmp/delphix-upgrade"
2121
HOTFIX_PATH="/etc/hotfix"
2222

2323
#
24-
# The virtualization service uses a different umask than the default. Thus to
25-
# account for the fact that these scripts may be running with a non-default
26-
# umask, we explicitly change it back to the default value here. This helps
27-
# ensure any files and directories generated by these scripts, will be created
28-
# with the correct permissions, regardless of the umask of the calling process.
24+
# The virtualization service uses a different umask than the default. Thus to account for the
25+
# fact that these scripts may be running with a non-default umask, we explicitly change it back
26+
# to the default value here. This helps ensure any files and directories generated by these scripts,
27+
# will be created with the correct permissions, regardless of the umask of the calling process.
2928
#
3029
umask 0022
3130

@@ -391,11 +390,16 @@ function mask_service() {
391390
fi
392391
}
393392

394-
function is_svc_not_found_or_disabled() {
393+
function is_svc_new_or_masked_or_disabled() {
395394
local svc="$1"
396395

396+
systemctl cat "$svc" &>/dev/null
397+
if [ $? -eq 1 ]; then
398+
return 0
399+
fi
400+
397401
state=$(systemctl is-enabled "$svc")
398-
if [[ "$state" == not-found || "$state" == disabled ]]; then
402+
if [[ "$state" == masked || "$state" == disabled ]]; then
399403
return 0
400404
fi
401405

@@ -444,12 +448,11 @@ function fix_and_migrate_services() {
444448
fi
445449

446450
#
447-
# Due to https://github.com/influxdata/telegraf/issues/14052, telegraf
448-
# must be masked after packages are upgraded. The telegraf package
449-
# removes /etc/systemd/system/telegraf.service thus reversing the
450-
# `systemctl mask` operation performed before the packages are upgraded.
451-
# Once this issue is fixed and a version with the fix makes it into the
452-
# product, this can be removed.
451+
# Due to https://github.com/influxdata/telegraf/issues/14052, telegraf must be masked after
452+
# packages are upgraded. The telegraf package removes /etc/systemd/system/telegraf.service thus
453+
# reversing the `systemctl mask` operation performed before the packages are upgraded.
454+
# Once this issue is fixed and a version with the fix makes it into the product, this can be
455+
# removed.
453456
#
454457
if [[ "$(systemctl is-enabled telegraf)" == enabled ]]; then
455458
mask_service telegraf "$container"
@@ -480,17 +483,8 @@ function fix_and_migrate_services() {
480483
# or disabled, and that the logic that unmasks them will also
481484
# enable them.
482485
#
483-
# note that once a service is masked, even if it was a "new" service
484-
# (i.e. not-found) once masked, it will report as masked. Additionally,
485-
# any service, regardless of it being enabled or disabled, will always
486-
# report "masked" once it is masked.
487-
#
488-
# Also note, that up until 2025-4, this code would attempt to mask already
489-
# masked services, and if there was a transient problem with service
490-
# registration it would fail to re-mask and abort an upgrade. (DLPX-93758)
491-
#
492486
while read -r svc; do
493-
is_svc_not_found_or_disabled "$svc" &&
487+
is_svc_new_or_masked_or_disabled "$svc" &&
494488
mask_service "$svc" "$container"
495489
done <<-EOF
496490
delphix-fluentd.service

0 commit comments

Comments
 (0)