upgrade-postgresql: Use tags to partially-apply configuration.

This uses the same technique used in 840884ec89, to only apply select
parts of the Puppet configuration.  This is more correct, and simpler,
than attempting to chop out some base puppet roles, and hack around
the `purge => true` supervisor.d configuration.
This commit is contained in:
Alex Vandiver
2025-05-07 10:24:48 -04:00
committed by Tim Abbott
parent 2dc5c6c50e
commit e13f82f048
4 changed files with 7 additions and 7 deletions

View File

@@ -47,12 +47,13 @@ class zulip::postgresql_base {
ensure => link,
require => Package[$postgresql],
target => $postgresql_dict_dict,
tag => ['postgresql_upgrade'],
}
file { "${tsearch_datadir}/en_us.affix":
ensure => link,
require => Package[$postgresql],
target => $postgresql_dict_affix,
tag => ['postgresql_upgrade'],
}
file { "${tsearch_datadir}/zulip_english.stop":
ensure => file,
@@ -61,6 +62,7 @@ class zulip::postgresql_base {
group => 'root',
mode => '0644',
source => 'puppet:///modules/zulip/postgresql/zulip_english.stop',
tag => ['postgresql_upgrade'],
}
zulip::nagios_plugins { 'zulip_postgresql': }
@@ -73,6 +75,7 @@ class zulip::postgresql_base {
Package[$postgresql],
Exec[$setup_system_deps]
],
tag => ['postgresql_upgrade'],
}
exec { 'pgroonga-config':
require => Package["${postgresql}-pgdg-pgroonga"],

View File

@@ -61,6 +61,7 @@ class zulip::postgresql_common {
zulip::safepackage { $postgresql_packages:
ensure => installed,
require => Exec['generate-default-snakeoil'],
tag => ['postgresql_upgrade'],
}
if $facts['os']['family'] == 'Debian' {

View File

@@ -12,15 +12,12 @@ class zulip::supervisor {
}
$conf_dir = $zulip::common::supervisor_conf_dir
# lint:ignore:quoted_booleans
$should_purge = $facts['leave_supervisor'] != 'true'
# lint:endignore
file { $conf_dir:
ensure => directory,
require => Package['supervisor'],
owner => 'root',
group => 'root',
purge => $should_purge,
purge => true,
recurse => true,
notify => Service[$supervisor_service],
}

View File

@@ -75,7 +75,6 @@ fi
cp /etc/zulip/zulip.conf "$TEMP_CONF_DIR"
ZULIP_CONF="${TEMP_CONF_DIR}/zulip.conf"
crudini --set "$ZULIP_CONF" postgresql version "$UPGRADE_TO"
crudini --set "$ZULIP_CONF" machine puppet_classes zulip::profile::base,zulip::postgresql_base
if [ -f "/usr/share/postgresql/$UPGRADE_FROM/pgroonga_setup.sql.applied" ]; then
# This file is intentionally blank, to trigger always running
@@ -83,7 +82,7 @@ fi
touch "/usr/share/postgresql/$UPGRADE_TO/pgroonga_setup.sql.applied"
fi
FACTER_LEAVE_SUPERVISOR=true "$ZULIP_PATH"/scripts/zulip-puppet-apply -f --config "$ZULIP_CONF"
"$ZULIP_PATH"/scripts/zulip-puppet-apply -f --config "$ZULIP_CONF" --tags postgresql_upgrade
rm -rf "$TEMP_CONF_DIR"
)