Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

puppet: Purge all un-managed supervisor configuration files.

Alex Vandiver3ab9b31d2fb5
diff --git a/puppet/zulip/files/supervisor/supervisord.conf b/puppet/zulip/files/supervisor/supervisord.conf
index b010b718a84..52bdd0f0051 100644
--- a/puppet/zulip/files/supervisor/supervisord.conf
+++ b/puppet/zulip/files/supervisor/supervisord.conf
@@ -27,4 +27,4 @@ serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; include files themselves.
[include]
-files = /etc/supervisor/conf.d/*.conf
+files = /etc/supervisor/conf.d/*.conf /etc/supervisor/conf.d/zulip/*.conf
diff --git a/puppet/zulip/manifests/common.pp b/puppet/zulip/manifests/common.pp
index e5516dbc443..f64c039bc6a 100644
--- a/puppet/zulip/manifests/common.pp
+++ b/puppet/zulip/manifests/common.pp
@@ -5,7 +5,7 @@ class zulip::common {
$nagios_plugins = 'monitoring-plugins-basic'
$nagios_plugins_dir = '/usr/lib/nagios/plugins'
$nginx = 'nginx-full'
- $supervisor_conf_dir = '/etc/supervisor/conf.d'
+ $supervisor_system_conf_dir = '/etc/supervisor/conf.d'
$supervisor_conf_file = '/etc/supervisor/supervisord.conf'
$supervisor_service = 'supervisor'
$supervisor_start = '/etc/init.d/supervisor start'
@@ -15,7 +15,7 @@ class zulip::common {
$nagios_plugins = 'nagios-plugins'
$nagios_plugins_dir = '/usr/lib64/nagios/plugins'
$nginx = 'nginx'
- $supervisor_conf_dir = '/etc/supervisord.d/conf.d'
+ $supervisor_system_conf_dir = '/etc/supervisord.d/conf.d'
$supervisor_conf_file = '/etc/supervisord.conf'
$supervisor_service = 'supervisord'
$supervisor_start = 'systemctl start supervisord'
@@ -25,4 +25,5 @@ class zulip::common {
fail('osfamily not supported')
}
}
+ $supervisor_conf_dir = "${supervisor_system_conf_dir}/zulip"
}
diff --git a/puppet/zulip/manifests/supervisor.pp b/puppet/zulip/manifests/supervisor.pp
index f95a1a16567..00b1b42465c 100644
--- a/puppet/zulip/manifests/supervisor.pp
+++ b/puppet/zulip/manifests/supervisor.pp
@@ -1,15 +1,37 @@
class zulip::supervisor {
+ $supervisor_service = $zulip::common::supervisor_service
+
package { 'supervisor': ensure => 'installed' }
- if $::osfamily == 'redhat' {
- file { $zulip::common::supervisor_conf_dir:
- ensure => 'directory',
- owner => 'root',
- group => 'root',
- }
+ file { $zulip::common::supervisor_system_conf_dir:
+ ensure => 'directory',
+ require => Package['supervisor'],
+ owner => 'root',
+ group => 'root',
}
- $supervisor_service = $zulip::common::supervisor_service
+ file { $zulip::common::supervisor_conf_dir:
+ ensure => 'directory',
+ require => Package['supervisor'],
+ owner => 'root',
+ group => 'root',
+ purge => true,
+ recurse => true,
+ notify => Service[$supervisor_service],
+ }
+
+ # These files were moved from /etc/supervisor/conf.d/ into a zulip/
+ # subdirectory in 2020-10 in version 4.0; these lines can be removed
+ # in Zulip version 5.0 and later.
+ file { [
+ "${zulip::common::supervisor_system_conf_dir}/cron.conf",
+ "${zulip::common::supervisor_system_conf_dir}/nginx.conf",
+ "${zulip::common::supervisor_system_conf_dir}/thumbor.conf",
+ "${zulip::common::supervisor_system_conf_dir}/zulip_db.conf",
+ "${zulip::common::supervisor_system_conf_dir}/zulip.conf",
+ ]:
+ ensure => absent,
+ }
# In the dockervoyager environment, we don't want/need supervisor to be started/stopped
# /bin/true is used as a decoy command, to maintain compatibility with other
@@ -81,18 +103,4 @@ class zulip::supervisor {
source => 'puppet:///modules/zulip/supervisor/supervisord.conf',
notify => Exec['supervisor-restart'],
}
-
- # We need a block here to handle deleting the old thumbor.conf file,
- # unless zulip::thumbor has been enabled. It would be cleaner
- # to use tidy instead of exec here, but notify is broken with it
- # (https://tickets.puppetlabs.com/browse/PUP-6021)
- # so we wouldn't be able to notify the supervisor service.
- $thumbor_enabled = defined(Class['zulip::thumbor'])
- if !$thumbor_enabled {
- exec { 'cleanup_thumbor_supervisor_conf_file':
- command => "rm ${zulip::common::supervisor_conf_dir}/thumbor.conf",
- onlyif => "test -e ${zulip::common::supervisor_conf_dir}/thumbor.conf",
- notify => Service[$zulip::common::supervisor_service],
- }
- }
}