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: Switch from top-level fact variables to facts dict.

Alex Vandiver57f8b48ff989
diff --git a/puppet/zulip/manifests/apache_sso.pp b/puppet/zulip/manifests/apache_sso.pp
index 2991c1a2d5a..79377e8abcf 100644
--- a/puppet/zulip/manifests/apache_sso.pp
+++ b/puppet/zulip/manifests/apache_sso.pp
@@ -1,7 +1,7 @@
class zulip::apache_sso {
include zulip::localhost_sso
- case $::os['family'] {
+ case $facts['os']['family'] {
'Debian': {
$apache_packages = [ 'apache2', 'libapache2-mod-wsgi-py3', ]
$conf_dir = '/etc/apache2'
diff --git a/puppet/zulip/manifests/app_frontend_base.pp b/puppet/zulip/manifests/app_frontend_base.pp
index 20b8e84fe83..83f2991627a 100644
--- a/puppet/zulip/manifests/app_frontend_base.pp
+++ b/puppet/zulip/manifests/app_frontend_base.pp
@@ -7,7 +7,7 @@ class zulip::app_frontend_base {
include zulip::tornado_sharding
include zulip::hooks::base
- if $::os['family'] == 'Debian' {
+ if $facts['os']['family'] == 'Debian' {
# Upgrade and other tooling wants to be able to get a database
# shell. This is not necessary on CentOS because the PostgreSQL
# package already includes the client.
diff --git a/puppet/zulip/manifests/apt_repository.pp b/puppet/zulip/manifests/apt_repository.pp
index ad64914d725..b850558cb74 100644
--- a/puppet/zulip/manifests/apt_repository.pp
+++ b/puppet/zulip/manifests/apt_repository.pp
@@ -1,5 +1,5 @@
class zulip::apt_repository {
- $setup_apt_repo_file = "${::zulip_scripts_path}/lib/setup-apt-repo"
+ $setup_apt_repo_file = "${facts['zulip_scripts_path']}/lib/setup-apt-repo"
exec{'setup_apt_repo':
command => "bash -c '${setup_apt_repo_file}'",
unless => "bash -c '${setup_apt_repo_file} --verify'",
diff --git a/puppet/zulip/manifests/common.pp b/puppet/zulip/manifests/common.pp
index c3e260f06f3..c6d2ab99389 100644
--- a/puppet/zulip/manifests/common.pp
+++ b/puppet/zulip/manifests/common.pp
@@ -1,6 +1,6 @@
class zulip::common {
# Common parameters
- case $::os['family'] {
+ case $facts['os']['family'] {
'Debian': {
$nagios_plugins = 'monitoring-plugins-basic'
$nagios_plugins_dir = '/usr/lib/nagios/plugins'
@@ -39,10 +39,10 @@ class zulip::common {
}
$supervisor_conf_dir = "${supervisor_system_conf_dir}/zulip"
- $total_memory_bytes = $::memory['system']['total_bytes']
+ $total_memory_bytes = $facts['memory']['system']['total_bytes']
$total_memory_mb = $total_memory_bytes / 1024 / 1024
- $goarch = $::os['architecture'] ? {
+ $goarch = $facts['os']['architecture'] ? {
'amd64' => 'amd64',
'aarch64' => 'arm64',
}
diff --git a/puppet/zulip/manifests/external_dep.pp b/puppet/zulip/manifests/external_dep.pp
index e275fed7b91..0886528db0a 100644
--- a/puppet/zulip/manifests/external_dep.pp
+++ b/puppet/zulip/manifests/external_dep.pp
@@ -9,7 +9,7 @@ define zulip::external_dep(
if $zulip::common::versions[$title]['sha256'] =~ Hash {
$sha256_filled = $zulip::common::versions[$title]['sha256'][$::os['architecture']]
if $sha256_filled == undef {
- err("No sha256 found for ${title} for architecture ${::os['architecture']}")
+ err("No sha256 found for ${title} for architecture ${facts['os']['architecture']}")
fail()
}
} else {
diff --git a/puppet/zulip/manifests/hooks/sentry.pp b/puppet/zulip/manifests/hooks/sentry.pp
index 759f136b88a..3623a7e28ba 100644
--- a/puppet/zulip/manifests/hooks/sentry.pp
+++ b/puppet/zulip/manifests/hooks/sentry.pp
@@ -5,7 +5,7 @@ class zulip::hooks::sentry {
$version = $zulip::common::versions['sentry-cli']['version']
$bin = "/srv/zulip-sentry-cli-${version}"
- $arch = $::os['architecture'] ? {
+ $arch = $facts['os']['architecture'] ? {
'amd64' => 'x86_64',
'aarch64' => 'aarch64',
}
diff --git a/puppet/zulip/manifests/nginx.pp b/puppet/zulip/manifests/nginx.pp
index 49c08dd138e..53223ee8080 100644
--- a/puppet/zulip/manifests/nginx.pp
+++ b/puppet/zulip/manifests/nginx.pp
@@ -6,7 +6,7 @@ class zulip::nginx {
]
package { $web_packages: ensure => installed }
- if $::os['family'] == 'RedHat' {
+ if $facts['os']['family'] == 'RedHat' {
file { '/etc/nginx/sites-available':
ensure => directory,
owner => 'root',
@@ -39,7 +39,7 @@ class zulip::nginx {
source => 'puppet:///modules/zulip/nginx/dhparam.pem',
}
- if $::os['family'] == 'Debian' {
+ if $facts['os']['family'] == 'Debian' {
$ca_crt = '/etc/ssl/certs/ca-certificates.crt'
} else {
$ca_crt = '/etc/pki/tls/certs/ca-bundle.crt'
diff --git a/puppet/zulip/manifests/postgresql_base.pp b/puppet/zulip/manifests/postgresql_base.pp
index 3ae241d4e78..501e8cceacd 100644
--- a/puppet/zulip/manifests/postgresql_base.pp
+++ b/puppet/zulip/manifests/postgresql_base.pp
@@ -3,7 +3,7 @@ class zulip::postgresql_base {
include zulip::postgresql_common
include zulip::process_fts_updates
- case $::os['family'] {
+ case $facts['os']['family'] {
'Debian': {
$postgresql = "postgresql-${zulip::postgresql_common::version}"
$postgresql_sharedir = "/usr/share/postgresql/${zulip::postgresql_common::version}"
@@ -96,7 +96,7 @@ class zulip::postgresql_base {
test "$(dpkg-query --show --showformat='\${Version}' "${postgresql}-pgdg-pgroonga")" \
= "$(cat ${pgroonga_setup_sql_path}.applied)"
| EOT
- command => "${::zulip_scripts_path}/setup/pgroonga-config ${postgresql_sharedir}",
+ command => "${facts['zulip_scripts_path']}/setup/pgroonga-config ${postgresql_sharedir}",
}
}
diff --git a/puppet/zulip/manifests/postgresql_common.pp b/puppet/zulip/manifests/postgresql_common.pp
index b056fbda27a..961cdfe0f01 100644
--- a/puppet/zulip/manifests/postgresql_common.pp
+++ b/puppet/zulip/manifests/postgresql_common.pp
@@ -1,7 +1,7 @@
class zulip::postgresql_common {
include zulip::snakeoil
$version = zulipconf('postgresql', 'version', undef)
- case $::os['family'] {
+ case $facts['os']['family'] {
'Debian': {
$postgresql = "postgresql-${version}"
$postgresql_packages = [
@@ -63,7 +63,7 @@ class zulip::postgresql_common {
require => Exec['generate-default-snakeoil'],
}
- if $::os['family'] == 'Debian' {
+ if $facts['os']['family'] == 'Debian' {
# The logrotate file only created in debian-based systems
exec { 'disable_logrotate':
# lint:ignore:140chars
diff --git a/puppet/zulip/manifests/process_fts_updates.pp b/puppet/zulip/manifests/process_fts_updates.pp
index 2c2aaf6dc9f..afeb7a5c308 100644
--- a/puppet/zulip/manifests/process_fts_updates.pp
+++ b/puppet/zulip/manifests/process_fts_updates.pp
@@ -1,6 +1,6 @@
class zulip::process_fts_updates {
include zulip::supervisor
- case $::os['family'] {
+ case $facts['os']['family'] {
'Debian': {
$fts_updates_packages = [
# Needed to run process_fts_updates
diff --git a/puppet/zulip/manifests/profile/app_frontend.pp b/puppet/zulip/manifests/profile/app_frontend.pp
index 29f1070449b..3121d6153d9 100644
--- a/puppet/zulip/manifests/profile/app_frontend.pp
+++ b/puppet/zulip/manifests/profile/app_frontend.pp
@@ -10,7 +10,7 @@ class zulip::profile::app_frontend {
} else {
$nginx_listen_port = zulipconf('application_server', 'nginx_listen_port', 443)
}
- $ssl_dir = $::os['family'] ? {
+ $ssl_dir = $facts['os']['family'] ? {
'Debian' => '/etc/ssl',
'RedHat' => '/etc/pki/tls',
}
@@ -61,7 +61,7 @@ class zulip::profile::app_frontend {
test -d /etc/letsencrypt/renewal &&
grep -qx "authenticator = standalone" /etc/letsencrypt/renewal/*.conf
| EOT
- command => "${::zulip_scripts_path}/lib/fix-standalone-certbot",
+ command => "${facts['zulip_scripts_path']}/lib/fix-standalone-certbot",
}
}
diff --git a/puppet/zulip/manifests/profile/base.pp b/puppet/zulip/manifests/profile/base.pp
index 265b768b736..110d0679934 100644
--- a/puppet/zulip/manifests/profile/base.pp
+++ b/puppet/zulip/manifests/profile/base.pp
@@ -5,7 +5,7 @@
class zulip::profile::base {
include zulip::timesync
include zulip::common
- case $::os['family'] {
+ case $facts['os']['family'] {
'Debian': {
include zulip::apt_repository
}
@@ -16,7 +16,7 @@ class zulip::profile::base {
fail('osfamily not supported')
}
}
- case $::os['family'] {
+ case $facts['os']['family'] {
'Debian': {
$base_packages = [
# Basics
diff --git a/puppet/zulip/manifests/profile/memcached.pp b/puppet/zulip/manifests/profile/memcached.pp
index 0c931437750..bfe9143ec4d 100644
--- a/puppet/zulip/manifests/profile/memcached.pp
+++ b/puppet/zulip/manifests/profile/memcached.pp
@@ -2,7 +2,7 @@ class zulip::profile::memcached {
include zulip::profile::base
include zulip::sasl_modules
- case $::os['family'] {
+ case $facts['os']['family'] {
'Debian': {
$memcached_packages = [ 'memcached', 'sasl2-bin' ]
$memcached_user = 'memcache'
diff --git a/puppet/zulip/manifests/profile/rabbitmq.pp b/puppet/zulip/manifests/profile/rabbitmq.pp
index 88df3fcd36a..72e5f782f9a 100644
--- a/puppet/zulip/manifests/profile/rabbitmq.pp
+++ b/puppet/zulip/manifests/profile/rabbitmq.pp
@@ -1,6 +1,6 @@
class zulip::profile::rabbitmq {
include zulip::profile::base
- $erlang = $::os['family'] ? {
+ $erlang = $facts['os']['family'] ? {
'Debian' => 'erlang-base',
'RedHat' => 'erlang',
}
@@ -50,7 +50,7 @@ class zulip::profile::rabbitmq {
notify => Service['rabbitmq-server'],
}
exec { 'warn-rabbitmq-nodename-change':
- command => "${::zulip_scripts_path}/lib/warn-rabbitmq-nodename-change",
+ command => "${facts['zulip_scripts_path']}/lib/warn-rabbitmq-nodename-change",
onlyif => '[ -f /etc/rabbitmq/rabbitmq-env.conf ] && ! grep -xq NODENAME=zulip@localhost /etc/rabbitmq/rabbitmq-env.conf',
before => [
File['/etc/rabbitmq/rabbitmq-env.conf'],
@@ -94,7 +94,7 @@ class zulip::profile::rabbitmq {
}
exec { 'configure-rabbitmq':
- command => "${::zulip_scripts_path}/setup/configure-rabbitmq",
+ command => "${facts['zulip_scripts_path']}/setup/configure-rabbitmq",
refreshonly => true,
require => Service['rabbitmq-server'],
}
diff --git a/puppet/zulip/manifests/profile/redis.pp b/puppet/zulip/manifests/profile/redis.pp
index 36922acbff6..689b1f7594b 100644
--- a/puppet/zulip/manifests/profile/redis.pp
+++ b/puppet/zulip/manifests/profile/redis.pp
@@ -1,6 +1,6 @@
class zulip::profile::redis {
include zulip::profile::base
- case $::os['family'] {
+ case $facts['os']['family'] {
'Debian': {
$redis = 'redis-server'
$redis_dir = '/etc/redis'
diff --git a/puppet/zulip/manifests/sasl_modules.pp b/puppet/zulip/manifests/sasl_modules.pp
index 02dc1a1c761..b7c4d278bba 100644
--- a/puppet/zulip/manifests/sasl_modules.pp
+++ b/puppet/zulip/manifests/sasl_modules.pp
@@ -1,5 +1,5 @@
class zulip::sasl_modules {
- $sasl_module_packages = $::os['family'] ? {
+ $sasl_module_packages = $facts['os']['family'] ? {
'Debian' => [ 'libsasl2-modules' ],
'RedHat' => [ 'cyrus-sasl-plain' ],
}
diff --git a/puppet/zulip/manifests/sha256_file_to.pp b/puppet/zulip/manifests/sha256_file_to.pp
index a95acb883f7..b6a4e236f67 100644
--- a/puppet/zulip/manifests/sha256_file_to.pp
+++ b/puppet/zulip/manifests/sha256_file_to.pp
@@ -6,7 +6,7 @@ define zulip::sha256_file_to(
String $install_to,
) {
exec { $url:
- command => "${::zulip_scripts_path}/setup/sha256-file-to ${sha256} ${url} ${install_to}",
+ command => "${facts['zulip_scripts_path']}/setup/sha256-file-to ${sha256} ${url} ${install_to}",
creates => $install_to,
timeout => 600,
}
diff --git a/puppet/zulip/manifests/sha256_tarball_to.pp b/puppet/zulip/manifests/sha256_tarball_to.pp
index 5a1d8601cc8..854c6b7618c 100644
--- a/puppet/zulip/manifests/sha256_tarball_to.pp
+++ b/puppet/zulip/manifests/sha256_tarball_to.pp
@@ -7,7 +7,7 @@ define zulip::sha256_tarball_to(
String $install_to,
) {
exec { $url:
- command => "${::zulip_scripts_path}/setup/sha256-tarball-to ${sha256} ${url} ${install_from} ${install_to}",
+ command => "${facts['zulip_scripts_path']}/setup/sha256-tarball-to ${sha256} ${url} ${install_from} ${install_to}",
creates => $install_to,
timeout => 600,
}
diff --git a/puppet/zulip/manifests/static_asset_compiler.pp b/puppet/zulip/manifests/static_asset_compiler.pp
index dd96c6415b2..24656c1e308 100644
--- a/puppet/zulip/manifests/static_asset_compiler.pp
+++ b/puppet/zulip/manifests/static_asset_compiler.pp
@@ -1,5 +1,5 @@
class zulip::static_asset_compiler {
- case $::os['family'] {
+ case $facts['os']['family'] {
'Debian': {
$static_asset_compiler_packages = [
# Used by makemessages i18n
diff --git a/puppet/zulip/manifests/tornado_sharding.pp b/puppet/zulip/manifests/tornado_sharding.pp
index 89a8580b3c5..d474abdd498 100644
--- a/puppet/zulip/manifests/tornado_sharding.pp
+++ b/puppet/zulip/manifests/tornado_sharding.pp
@@ -34,8 +34,8 @@ class zulip::tornado_sharding {
# This creates .tmp files which scripts/refresh-sharding-and-restart
# moves into place
exec { 'stage_updated_sharding':
- command => "${::zulip_scripts_path}/lib/sharding.py",
- onlyif => "${::zulip_scripts_path}/lib/sharding.py --errors-ok",
+ command => "${facts['zulip_scripts_path']}/lib/sharding.py",
+ onlyif => "${facts['zulip_scripts_path']}/lib/sharding.py --errors-ok",
require => [File['/etc/zulip/nginx_sharding_map.conf'], File['/etc/zulip/sharding.json']],
logoutput => true,
loglevel => warning,
diff --git a/puppet/zulip/manifests/yum_repository.pp b/puppet/zulip/manifests/yum_repository.pp
index 43e4a5b091f..ba8a74bc14a 100644
--- a/puppet/zulip/manifests/yum_repository.pp
+++ b/puppet/zulip/manifests/yum_repository.pp
@@ -1,5 +1,5 @@
class zulip::yum_repository {
- $setup_yum_repo_file = "${::zulip_scripts_path}/lib/setup-yum-repo"
+ $setup_yum_repo_file = "${facts['zulip_scripts_path']}/lib/setup-yum-repo"
exec{'setup_yum_repo':
command => "bash -c '${setup_yum_repo_file} --prod'",
}