diff --git a/puppet/zulip/manifests/app_frontend_base.pp b/puppet/zulip/manifests/app_frontend_base.pp index 19140388c6..afa6e33a5e 100644 --- a/puppet/zulip/manifests/app_frontend_base.pp +++ b/puppet/zulip/manifests/app_frontend_base.pp @@ -8,7 +8,7 @@ class zulip::app_frontend_base { # Needed to access our database "postgresql-client-${zulip::base::postgres_version}", ] - safepackage { $web_packages: ensure => 'installed' } + zulip::safepackage { $web_packages: ensure => 'installed' } file { '/etc/nginx/zulip-include/app': require => Package['nginx-full'], diff --git a/puppet/zulip/manifests/base.pp b/puppet/zulip/manifests/base.pp index c926072730..796031fb16 100644 --- a/puppet/zulip/manifests/base.pp +++ b/puppet/zulip/manifests/base.pp @@ -1,10 +1,3 @@ -# TODO: Move this to a proper types file -define safepackage ( $ensure = present ) { - if !defined(Package[$title]) { - package { $title: ensure => $ensure } - } -} - class zulip::base { include apt $base_packages = [ diff --git a/puppet/zulip/manifests/postgres_appdb_base.pp b/puppet/zulip/manifests/postgres_appdb_base.pp index 15e43ee778..04981195d1 100644 --- a/puppet/zulip/manifests/postgres_appdb_base.pp +++ b/puppet/zulip/manifests/postgres_appdb_base.pp @@ -8,7 +8,7 @@ class zulip::postgres_appdb_base { # Needed for our full text search system "postgresql-${zulip::base::postgres_version}-tsearch-extras", ] - safepackage { $appdb_packages: ensure => 'installed' } + zulip::safepackage { $appdb_packages: ensure => 'installed' } # We bundle a bunch of other sysctl parameters into 40-postgresql.conf file { '/etc/sysctl.d/30-postgresql-shm.conf': diff --git a/puppet/zulip/manifests/postgres_common.pp b/puppet/zulip/manifests/postgres_common.pp index 87862badf7..b737447f9f 100644 --- a/puppet/zulip/manifests/postgres_common.pp +++ b/puppet/zulip/manifests/postgres_common.pp @@ -15,7 +15,7 @@ class zulip::postgres_common { # Postgres Nagios check plugin 'check-postgres', ] - safepackage { $postgres_packages: ensure => 'installed' } + zulip::safepackage { $postgres_packages: ensure => 'installed' } 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 87cf4e3f30..2f5987434e 100644 --- a/puppet/zulip/manifests/process_fts_updates.pp +++ b/puppet/zulip/manifests/process_fts_updates.pp @@ -3,7 +3,7 @@ class zulip::process_fts_updates { # Needed to run process_fts_updates 'python3-psycopg2', # TODO: use a virtualenv instead ] - safepackage { $fts_updates_packages: ensure => 'installed' } + zulip::safepackage { $fts_updates_packages: ensure => 'installed' } file { '/usr/local/bin/process_fts_updates': ensure => file, diff --git a/puppet/zulip/manifests/safepackage.pp b/puppet/zulip/manifests/safepackage.pp new file mode 100644 index 0000000000..5fe7621ca4 --- /dev/null +++ b/puppet/zulip/manifests/safepackage.pp @@ -0,0 +1,5 @@ +define zulip::safepackage ( $ensure = present ) { + if !defined(Package[$title]) { + package { $title: ensure => $ensure } + } +} diff --git a/puppet/zulip/manifests/static_asset_compiler.pp b/puppet/zulip/manifests/static_asset_compiler.pp index ef241e9ad3..fe4f5e9b1e 100644 --- a/puppet/zulip/manifests/static_asset_compiler.pp +++ b/puppet/zulip/manifests/static_asset_compiler.pp @@ -12,5 +12,5 @@ class zulip::static_asset_compiler { 'gettext', ] - safepackage { $static_asset_compiler_packages: ensure => 'installed' } + zulip::safepackage { $static_asset_compiler_packages: ensure => 'installed' } }