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 {
include zulip::localhost_sso
case $::os['family'] {
case $facts['os']['family'] {
'Debian': {
$apache_packages = [ 'apache2', 'libapache2-mod-wsgi-py3', ]
$conf_dir = '/etc/apache2'

View File

@ -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.

View File

@ -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'",

View File

@ -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',
}

View File

@ -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 {

View File

@ -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',
}

View File

@ -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'

View File

@ -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}",
}
}

View File

@ -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

View File

@ -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

View File

@ -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",
}
}

View File

@ -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

View File

@ -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'

View File

@ -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'],
}

View File

@ -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'

View File

@ -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' ],
}

View File

@ -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,
}

View File

@ -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,
}

View File

@ -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

View File

@ -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,

View File

@ -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'",
}