puppet-lint: Fix an error with defined type safepackage in base.pp.

We fix "ERROR: safepackage not in autoload module layout" error
which was caused by a defined type "safepackage" definitation
lying in the wrong place. We refactor to create the defined type
according to puppet guidelines. Link below:
https://docs.puppet.com/puppet/2.7/lang_defined_types.html
This commit is contained in:
Aditya Bansal 2018-08-07 16:42:37 +05:30 committed by Tim Abbott
parent 710d4507de
commit 5bfe24beef
7 changed files with 10 additions and 12 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,5 @@
define zulip::safepackage ( $ensure = present ) {
if !defined(Package[$title]) {
package { $title: ensure => $ensure }
}
}

View File

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