puppet: Switch from top-level fact variables to facts dict.

This is linted by more recent puppet-lint.
This commit is contained in:
Alex Vandiver
2024-03-25 19:16:16 +00:00
committed by Tim Abbott
parent d6c91cb7f9
commit 57f8b48ff9
21 changed files with 31 additions and 31 deletions

View File

@@ -1,7 +1,7 @@
class zulip::apache_sso { class zulip::apache_sso {
include zulip::localhost_sso include zulip::localhost_sso
case $::os['family'] { case $facts['os']['family'] {
'Debian': { 'Debian': {
$apache_packages = [ 'apache2', 'libapache2-mod-wsgi-py3', ] $apache_packages = [ 'apache2', 'libapache2-mod-wsgi-py3', ]
$conf_dir = '/etc/apache2' $conf_dir = '/etc/apache2'

View File

@@ -7,7 +7,7 @@ class zulip::app_frontend_base {
include zulip::tornado_sharding include zulip::tornado_sharding
include zulip::hooks::base 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 # Upgrade and other tooling wants to be able to get a database
# shell. This is not necessary on CentOS because the PostgreSQL # shell. This is not necessary on CentOS because the PostgreSQL
# package already includes the client. # package already includes the client.

View File

@@ -1,5 +1,5 @@
class zulip::apt_repository { 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': exec{'setup_apt_repo':
command => "bash -c '${setup_apt_repo_file}'", command => "bash -c '${setup_apt_repo_file}'",
unless => "bash -c '${setup_apt_repo_file} --verify'", unless => "bash -c '${setup_apt_repo_file} --verify'",

View File

@@ -1,6 +1,6 @@
class zulip::common { class zulip::common {
# Common parameters # Common parameters
case $::os['family'] { case $facts['os']['family'] {
'Debian': { 'Debian': {
$nagios_plugins = 'monitoring-plugins-basic' $nagios_plugins = 'monitoring-plugins-basic'
$nagios_plugins_dir = '/usr/lib/nagios/plugins' $nagios_plugins_dir = '/usr/lib/nagios/plugins'
@@ -39,10 +39,10 @@ class zulip::common {
} }
$supervisor_conf_dir = "${supervisor_system_conf_dir}/zulip" $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 $total_memory_mb = $total_memory_bytes / 1024 / 1024
$goarch = $::os['architecture'] ? { $goarch = $facts['os']['architecture'] ? {
'amd64' => 'amd64', 'amd64' => 'amd64',
'aarch64' => 'arm64', 'aarch64' => 'arm64',
} }

View File

@@ -9,7 +9,7 @@ define zulip::external_dep(
if $zulip::common::versions[$title]['sha256'] =~ Hash { if $zulip::common::versions[$title]['sha256'] =~ Hash {
$sha256_filled = $zulip::common::versions[$title]['sha256'][$::os['architecture']] $sha256_filled = $zulip::common::versions[$title]['sha256'][$::os['architecture']]
if $sha256_filled == undef { 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() fail()
} }
} else { } else {

View File

@@ -5,7 +5,7 @@ class zulip::hooks::sentry {
$version = $zulip::common::versions['sentry-cli']['version'] $version = $zulip::common::versions['sentry-cli']['version']
$bin = "/srv/zulip-sentry-cli-${version}" $bin = "/srv/zulip-sentry-cli-${version}"
$arch = $::os['architecture'] ? { $arch = $facts['os']['architecture'] ? {
'amd64' => 'x86_64', 'amd64' => 'x86_64',
'aarch64' => 'aarch64', 'aarch64' => 'aarch64',
} }

View File

@@ -6,7 +6,7 @@ class zulip::nginx {
] ]
package { $web_packages: ensure => installed } package { $web_packages: ensure => installed }
if $::os['family'] == 'RedHat' { if $facts['os']['family'] == 'RedHat' {
file { '/etc/nginx/sites-available': file { '/etc/nginx/sites-available':
ensure => directory, ensure => directory,
owner => 'root', owner => 'root',
@@ -39,7 +39,7 @@ class zulip::nginx {
source => 'puppet:///modules/zulip/nginx/dhparam.pem', source => 'puppet:///modules/zulip/nginx/dhparam.pem',
} }
if $::os['family'] == 'Debian' { if $facts['os']['family'] == 'Debian' {
$ca_crt = '/etc/ssl/certs/ca-certificates.crt' $ca_crt = '/etc/ssl/certs/ca-certificates.crt'
} else { } else {
$ca_crt = '/etc/pki/tls/certs/ca-bundle.crt' $ca_crt = '/etc/pki/tls/certs/ca-bundle.crt'

View File

@@ -3,7 +3,7 @@ class zulip::postgresql_base {
include zulip::postgresql_common include zulip::postgresql_common
include zulip::process_fts_updates include zulip::process_fts_updates
case $::os['family'] { case $facts['os']['family'] {
'Debian': { 'Debian': {
$postgresql = "postgresql-${zulip::postgresql_common::version}" $postgresql = "postgresql-${zulip::postgresql_common::version}"
$postgresql_sharedir = "/usr/share/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")" \ test "$(dpkg-query --show --showformat='\${Version}' "${postgresql}-pgdg-pgroonga")" \
= "$(cat ${pgroonga_setup_sql_path}.applied)" = "$(cat ${pgroonga_setup_sql_path}.applied)"
| EOT | EOT
command => "${::zulip_scripts_path}/setup/pgroonga-config ${postgresql_sharedir}", command => "${facts['zulip_scripts_path']}/setup/pgroonga-config ${postgresql_sharedir}",
} }
} }

View File

@@ -1,7 +1,7 @@
class zulip::postgresql_common { class zulip::postgresql_common {
include zulip::snakeoil include zulip::snakeoil
$version = zulipconf('postgresql', 'version', undef) $version = zulipconf('postgresql', 'version', undef)
case $::os['family'] { case $facts['os']['family'] {
'Debian': { 'Debian': {
$postgresql = "postgresql-${version}" $postgresql = "postgresql-${version}"
$postgresql_packages = [ $postgresql_packages = [
@@ -63,7 +63,7 @@ class zulip::postgresql_common {
require => Exec['generate-default-snakeoil'], require => Exec['generate-default-snakeoil'],
} }
if $::os['family'] == 'Debian' { if $facts['os']['family'] == 'Debian' {
# The logrotate file only created in debian-based systems # The logrotate file only created in debian-based systems
exec { 'disable_logrotate': exec { 'disable_logrotate':
# lint:ignore:140chars # lint:ignore:140chars

View File

@@ -1,6 +1,6 @@
class zulip::process_fts_updates { class zulip::process_fts_updates {
include zulip::supervisor include zulip::supervisor
case $::os['family'] { case $facts['os']['family'] {
'Debian': { 'Debian': {
$fts_updates_packages = [ $fts_updates_packages = [
# Needed to run process_fts_updates # Needed to run process_fts_updates

View File

@@ -10,7 +10,7 @@ class zulip::profile::app_frontend {
} else { } else {
$nginx_listen_port = zulipconf('application_server', 'nginx_listen_port', 443) $nginx_listen_port = zulipconf('application_server', 'nginx_listen_port', 443)
} }
$ssl_dir = $::os['family'] ? { $ssl_dir = $facts['os']['family'] ? {
'Debian' => '/etc/ssl', 'Debian' => '/etc/ssl',
'RedHat' => '/etc/pki/tls', 'RedHat' => '/etc/pki/tls',
} }
@@ -61,7 +61,7 @@ class zulip::profile::app_frontend {
test -d /etc/letsencrypt/renewal && test -d /etc/letsencrypt/renewal &&
grep -qx "authenticator = standalone" /etc/letsencrypt/renewal/*.conf grep -qx "authenticator = standalone" /etc/letsencrypt/renewal/*.conf
| EOT | EOT
command => "${::zulip_scripts_path}/lib/fix-standalone-certbot", command => "${facts['zulip_scripts_path']}/lib/fix-standalone-certbot",
} }
} }

View File

@@ -5,7 +5,7 @@
class zulip::profile::base { class zulip::profile::base {
include zulip::timesync include zulip::timesync
include zulip::common include zulip::common
case $::os['family'] { case $facts['os']['family'] {
'Debian': { 'Debian': {
include zulip::apt_repository include zulip::apt_repository
} }
@@ -16,7 +16,7 @@ class zulip::profile::base {
fail('osfamily not supported') fail('osfamily not supported')
} }
} }
case $::os['family'] { case $facts['os']['family'] {
'Debian': { 'Debian': {
$base_packages = [ $base_packages = [
# Basics # Basics

View File

@@ -2,7 +2,7 @@ class zulip::profile::memcached {
include zulip::profile::base include zulip::profile::base
include zulip::sasl_modules include zulip::sasl_modules
case $::os['family'] { case $facts['os']['family'] {
'Debian': { 'Debian': {
$memcached_packages = [ 'memcached', 'sasl2-bin' ] $memcached_packages = [ 'memcached', 'sasl2-bin' ]
$memcached_user = 'memcache' $memcached_user = 'memcache'

View File

@@ -1,6 +1,6 @@
class zulip::profile::rabbitmq { class zulip::profile::rabbitmq {
include zulip::profile::base include zulip::profile::base
$erlang = $::os['family'] ? { $erlang = $facts['os']['family'] ? {
'Debian' => 'erlang-base', 'Debian' => 'erlang-base',
'RedHat' => 'erlang', 'RedHat' => 'erlang',
} }
@@ -50,7 +50,7 @@ class zulip::profile::rabbitmq {
notify => Service['rabbitmq-server'], notify => Service['rabbitmq-server'],
} }
exec { 'warn-rabbitmq-nodename-change': 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', onlyif => '[ -f /etc/rabbitmq/rabbitmq-env.conf ] && ! grep -xq NODENAME=zulip@localhost /etc/rabbitmq/rabbitmq-env.conf',
before => [ before => [
File['/etc/rabbitmq/rabbitmq-env.conf'], File['/etc/rabbitmq/rabbitmq-env.conf'],
@@ -94,7 +94,7 @@ class zulip::profile::rabbitmq {
} }
exec { 'configure-rabbitmq': exec { 'configure-rabbitmq':
command => "${::zulip_scripts_path}/setup/configure-rabbitmq", command => "${facts['zulip_scripts_path']}/setup/configure-rabbitmq",
refreshonly => true, refreshonly => true,
require => Service['rabbitmq-server'], require => Service['rabbitmq-server'],
} }

View File

@@ -1,6 +1,6 @@
class zulip::profile::redis { class zulip::profile::redis {
include zulip::profile::base include zulip::profile::base
case $::os['family'] { case $facts['os']['family'] {
'Debian': { 'Debian': {
$redis = 'redis-server' $redis = 'redis-server'
$redis_dir = '/etc/redis' $redis_dir = '/etc/redis'

View File

@@ -1,5 +1,5 @@
class zulip::sasl_modules { class zulip::sasl_modules {
$sasl_module_packages = $::os['family'] ? { $sasl_module_packages = $facts['os']['family'] ? {
'Debian' => [ 'libsasl2-modules' ], 'Debian' => [ 'libsasl2-modules' ],
'RedHat' => [ 'cyrus-sasl-plain' ], 'RedHat' => [ 'cyrus-sasl-plain' ],
} }

View File

@@ -6,7 +6,7 @@ define zulip::sha256_file_to(
String $install_to, String $install_to,
) { ) {
exec { $url: 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, creates => $install_to,
timeout => 600, timeout => 600,
} }

View File

@@ -7,7 +7,7 @@ define zulip::sha256_tarball_to(
String $install_to, String $install_to,
) { ) {
exec { $url: 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, creates => $install_to,
timeout => 600, timeout => 600,
} }

View File

@@ -1,5 +1,5 @@
class zulip::static_asset_compiler { class zulip::static_asset_compiler {
case $::os['family'] { case $facts['os']['family'] {
'Debian': { 'Debian': {
$static_asset_compiler_packages = [ $static_asset_compiler_packages = [
# Used by makemessages i18n # Used by makemessages i18n

View File

@@ -34,8 +34,8 @@ class zulip::tornado_sharding {
# This creates .tmp files which scripts/refresh-sharding-and-restart # This creates .tmp files which scripts/refresh-sharding-and-restart
# moves into place # moves into place
exec { 'stage_updated_sharding': exec { 'stage_updated_sharding':
command => "${::zulip_scripts_path}/lib/sharding.py", command => "${facts['zulip_scripts_path']}/lib/sharding.py",
onlyif => "${::zulip_scripts_path}/lib/sharding.py --errors-ok", onlyif => "${facts['zulip_scripts_path']}/lib/sharding.py --errors-ok",
require => [File['/etc/zulip/nginx_sharding_map.conf'], File['/etc/zulip/sharding.json']], require => [File['/etc/zulip/nginx_sharding_map.conf'], File['/etc/zulip/sharding.json']],
logoutput => true, logoutput => true,
loglevel => warning, loglevel => warning,

View File

@@ -1,5 +1,5 @@
class zulip::yum_repository { 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': exec{'setup_yum_repo':
command => "bash -c '${setup_yum_repo_file} --prod'", command => "bash -c '${setup_yum_repo_file} --prod'",
} }