diff --git a/.github/SECURITY.md b/.github/SECURITY.md
new file mode 100644
index 000000000..cacadf220
--- /dev/null
+++ b/.github/SECURITY.md
@@ -0,0 +1,3 @@
+# Vox Pupuli Security Policy
+
+Our vulnerabilities reporting process is at https://voxpupuli.org/security/
diff --git a/.msync.yml b/.msync.yml
index 8864fc092..4c7999c42 100644
--- a/.msync.yml
+++ b/.msync.yml
@@ -1 +1 @@
-modulesync_config_version: '2.12.0'
+modulesync_config_version: '3.0.0'
diff --git a/.rubocop.yml b/.rubocop.yml
index c2ebc88df..316e4ec1d 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -528,6 +528,9 @@ RSpec/RepeatedDescription:
RSpec/NestedGroups:
Enabled: False
+RSpec/MultipleExpectations:
+ Enabled: false
+
# this is broken on ruby1.9
Layout/IndentHeredoc:
Enabled: False
diff --git a/.sync.yml b/.sync.yml
index 8b77bec9c..1156484b3 100644
--- a/.sync.yml
+++ b/.sync.yml
@@ -13,3 +13,5 @@ Gemfile:
- gem: 'zabbixapi'
spec/spec_helper.rb:
mock_with: ':mocha'
+spec/spec_helper_acceptance.rb:
+ unmanaged: false
diff --git a/.travis.yml b/.travis.yml
index 6cb8461ce..cd765b97d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,5 @@
---
+os: linux
dist: bionic
language: ruby
cache: bundler
@@ -7,7 +8,7 @@ before_install:
- bundle --version
script:
- 'bundle exec rake $CHECK'
-matrix:
+jobs:
fast_finish: true
include:
- rvm: 2.4.4
@@ -68,7 +69,7 @@ notifications:
- "chat.freenode.org#voxpupuli-notifications"
deploy:
provider: puppetforge
- user: puppet
+ username: puppet
password:
secure: "ijm7hKPYWr1eg7151g5oK6MzZL4ojrgWjKlxgoBHXAdXdY88opMgvixfSJK5IMUbtanPfWRkqqABx+MYO78nfQBWDlghUzZ8sQXFeO2Ie0PgWl4nFV0kKWz+ejVaZC4dKSZlWha5pO1ek+sx7KnjIBZY82OXs/GXbjwhHx6d56YugXLuCyvfFxC7mXC9wF58bPwcYRCBSZt9CRl0OMBAFybxjdwsFMloRRhdz7f3hhlqF8Nrs1sxG1HhgiMcnrZqovNfb3Tw9K1RPYATazXxQrjcI7YHvJx0AvtHFUsn+/A0GtpKUuuPbaVdkYgE1Tye0AsAcey6RW4xhJywZglKrzDk7vfyUiU5CObeLh4/dhub3k111rDPL8v6v9t40fteduJoFLziHotQwdl37UALL7PwWZY5HuJvaBqHY2LsGs/ptGMB9ZCzxA85jfDw8lrZQ7P97SAoC34Ihs8D6vkKT9HUKHIXh19O5AAa70jReru0ej179IBjvs8m9nDwDNdY3sIsdhUU8WQ3BftDF6M8OzvgyLKDvjSs1Izag+Asl2Ze7RAQfQ2RvbfkDm9KEFnDQtXtzF4Cu1Ed6io2j1zI71JFQpIf6zb1qeNrhqulbJ15owGkQmHBgD8K+bDd1CCU4kA26axypV00XDsjfwdtFHgtUO3AlUVUim0QTMk9ATc="
on:
diff --git a/Gemfile b/Gemfile
index 3454366c2..f9a22a25e 100644
--- a/Gemfile
+++ b/Gemfile
@@ -11,12 +11,11 @@ def location_for(place, fake_version = nil)
end
group :test do
- gem 'voxpupuli-test', '>= 1.0.0', :require => false
- gem 'coveralls', :require => false
- gem 'simplecov-console', :require => false
- gem 'fakefs', :require => false
- gem 'zabbixapi', :require => false
- gem 'rspec-puppet-facts', :require => false, :git => 'https://github.com/mcanevet/rspec-puppet-facts', :ref => '9541292d4fc35db3be1badace673c1108154b571'
+ gem 'voxpupuli-test', '~> 2.0', :require => false
+ gem 'coveralls', :require => false
+ gem 'simplecov-console', :require => false
+ gem 'fakefs', :require => false
+ gem 'zabbixapi', :require => false
end
group :development do
diff --git a/manifests/agent.pp b/manifests/agent.pp
index 59f9cd224..7c084d4a1 100644
--- a/manifests/agent.pp
+++ b/manifests/agent.pp
@@ -309,7 +309,6 @@
String $service_type = $zabbix::params::service_type,
Boolean $manage_startup_script = $zabbix::params::manage_startup_script,
) inherits zabbix::params {
-
# the following two codeblocks are a bit blargh. The correct default value for
# $real_additional_service_params and $type changes based on the value of $zabbix_version
# We handle this in the params.pp, but that doesn't work if somebody provides a specific
@@ -408,13 +407,13 @@
ensure => $zabbix_package_state,
require => Class['zabbix::repo'],
tag => 'zabbix',
- provider => $zabbix_package_provider,
+ provider => $zabbix_package_provider,
}
}
# Ensure that the correct config file is used.
if $manage_startup_script {
- zabbix::startup {$servicename:
+ zabbix::startup { $servicename:
pidfile => $pidfile,
agent_configfile_path => $agent_configfile_path,
zabbix_user => $zabbix_user,
@@ -488,14 +487,15 @@
state => [
'NEW',
'RELATED',
- 'ESTABLISHED'],
+ 'ESTABLISHED',
+ ],
}
}
}
# the agent doesn't work perfectly fine with selinux
# https://support.zabbix.com/browse/ZBX-11631
if fact('os.selinux.enabled') == true and $manage_selinux {
- selinux::module{'zabbix-agent':
+ selinux::module { 'zabbix-agent':
ensure => 'present',
content_te => template('zabbix/selinux/zabbix-agent.te.erb'),
before => Service[$servicename],
diff --git a/manifests/database.pp b/manifests/database.pp
index 1a539eb4f..37785e1f1 100644
--- a/manifests/database.pp
+++ b/manifests/database.pp
@@ -114,7 +114,7 @@
#
# Copyright 2014 Werner Dijkerman
#
-class zabbix::database(
+class zabbix::database (
$zabbix_type = 'server',
$zabbix_web = $zabbix::params::zabbix_web,
$zabbix_web_ip = $zabbix::params::zabbix_web_ip,
@@ -134,7 +134,6 @@
$database_collate = $zabbix::params::server_database_collate,
Optional[String[1]] $database_tablespace = $zabbix::params::server_database_tablespace,
) inherits zabbix::params {
-
# So lets create the databases and load all files. This can only be
# happen when manage_database is set to true (Default).
if $manage_database == true {
@@ -156,7 +155,7 @@
}
# When database not in some server with zabbix server include pg_hba_rule to server
- if ($database_host_ip != $zabbix_server_ip) or ($zabbix_web_ip != $zabbix_server_ip){
+ if ($database_host_ip != $zabbix_server_ip) or ($zabbix_web_ip != $zabbix_server_ip) {
postgresql::server::pg_hba_rule { 'Allow zabbix-server to access database':
description => 'Open up postgresql for access from zabbix-server',
type => 'host',
diff --git a/manifests/database/mysql.pp b/manifests/database/mysql.pp
index 46a1e0f00..03712e084 100644
--- a/manifests/database/mysql.pp
+++ b/manifests/database/mysql.pp
@@ -23,8 +23,8 @@
$database_user = '',
$database_password = '',
$database_host = '',
- $database_path = $zabbix::params::database_path,) inherits zabbix::params {
-
+ $database_path = $zabbix::params::database_path,
+) inherits zabbix::params {
assert_private()
#
diff --git a/manifests/database/postgresql.pp b/manifests/database/postgresql.pp
index 9de27e8eb..81b17baf2 100644
--- a/manifests/database/postgresql.pp
+++ b/manifests/database/postgresql.pp
@@ -25,7 +25,6 @@
$database_host = '',
$database_path = $zabbix::params::database_path,
) inherits zabbix::params {
-
assert_private()
#
@@ -99,46 +98,38 @@
}
case $zabbix_type {
- 'proxy': {
- exec { 'zabbix_proxy_create.sql':
- command => $zabbix_proxy_create_sql,
- path => "/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:${database_path}",
- unless => 'test -f /etc/zabbix/.schema.done',
- provider => 'shell',
- require => [
- Exec['update_pgpass'],
- ],
- }
+ 'proxy': {
+ exec { 'zabbix_proxy_create.sql':
+ command => $zabbix_proxy_create_sql,
+ path => "/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:${database_path}",
+ unless => 'test -f /etc/zabbix/.schema.done',
+ provider => 'shell',
+ require => Exec['update_pgpass'],
}
- 'server': {
- exec { 'zabbix_server_create.sql':
- command => $zabbix_server_create_sql,
- path => "/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:${database_path}",
- unless => 'test -f /etc/zabbix/.schema.done',
- provider => 'shell',
- require => [
- Exec['update_pgpass'],
- ],
- }
- -> exec { 'zabbix_server_images.sql':
- command => $zabbix_server_images_sql,
- path => "/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:${database_path}",
- unless => 'test -f /etc/zabbix/.images.done',
- provider => 'shell',
- require => [
- Exec['update_pgpass'],
- ],
- }
- -> exec { 'zabbix_server_data.sql':
- command => $zabbix_server_data_sql,
- path => "/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:${database_path}",
- unless => 'test -f /etc/zabbix/.data.done',
- provider => 'shell',
- require => [
- Exec['update_pgpass'],
- ],
- }
+ }
+ 'server': {
+ exec { 'zabbix_server_create.sql':
+ command => $zabbix_server_create_sql,
+ path => "/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:${database_path}",
+ unless => 'test -f /etc/zabbix/.schema.done',
+ provider => 'shell',
+ require => Exec['update_pgpass'],
+ }
+ -> exec { 'zabbix_server_images.sql':
+ command => $zabbix_server_images_sql,
+ path => "/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:${database_path}",
+ unless => 'test -f /etc/zabbix/.images.done',
+ provider => 'shell',
+ require => Exec['update_pgpass'],
}
+ -> exec { 'zabbix_server_data.sql':
+ command => $zabbix_server_data_sql,
+ path => "/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:${database_path}",
+ unless => 'test -f /etc/zabbix/.data.done',
+ provider => 'shell',
+ require => Exec['update_pgpass'],
+ }
+ }
default: {
fail 'We do not work.'
}
diff --git a/manifests/database/sqlite.pp b/manifests/database/sqlite.pp
index a51baaa14..d7df97997 100644
--- a/manifests/database/sqlite.pp
+++ b/manifests/database/sqlite.pp
@@ -16,4 +16,4 @@
#
# Copyright 2014 Werner Dijkerman
#
-class zabbix::database::sqlite () { }
\ No newline at end of file
+class zabbix::database::sqlite () {}
diff --git a/manifests/init.pp b/manifests/init.pp
index 68d6e09c7..23713497e 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -181,7 +181,6 @@
Optional[String[1]] $zabbix_user = $zabbix::params::server_zabbix_user,
Optional[String] $zabbix_server_name = $zabbix::params::zabbix_server,
) inherits zabbix::params {
-
class { 'zabbix::web':
zabbix_url => $zabbix_url,
database_type => $database_type,
@@ -320,5 +319,4 @@
database_collate => $database_collate,
database_tablespace => $database_tablespace,
}
-
}
diff --git a/manifests/javagateway.pp b/manifests/javagateway.pp
index 36d5f9126..4e2c29186 100644
--- a/manifests/javagateway.pp
+++ b/manifests/javagateway.pp
@@ -50,7 +50,7 @@
#
# Copyright 2014 Werner Dijkerman
#
-class zabbix::javagateway(
+class zabbix::javagateway (
$zabbix_version = $zabbix::params::zabbix_version,
$zabbix_package_state = $zabbix::params::zabbix_package_state,
Boolean $manage_firewall = $zabbix::params::manage_firewall,
@@ -60,8 +60,7 @@
$listenport = $zabbix::params::javagateway_listenport,
$startpollers = $zabbix::params::javagateway_startpollers,
$timeout = $zabbix::params::javagateway_timeout,
-) inherits zabbix::params {
-
+) inherits zabbix::params {
# Only include the repo class if it has not yet been included
unless defined(Class['Zabbix::Repo']) {
class { 'zabbix::repo':
diff --git a/manifests/params.pp b/manifests/params.pp
index ce7558874..a8a25ca88 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -326,11 +326,9 @@
$agent_userparameter = undef
$agent_zabbix_alias = undef
$agent_zbx_group = 'Linux servers'
- $agent_zbx_groups = [ 'Linux servers', ]
+ $agent_zbx_groups = ['Linux servers',]
$agent_zbx_group_create = true
- $agent_zbx_templates = [
- 'Template OS Linux',
- 'Template App SSH Service']
+ $agent_zbx_templates = ['Template OS Linux', 'Template App SSH Service']
$apache_status = false
$monitored_by_proxy = undef
# provided by camp2camp/systemd
@@ -437,7 +435,7 @@
# SE Linux specific params
$selinux_require = ['type zabbix_agent_t', 'class process setrlimit', 'class unix_dgram_socket create']
- $selinux_rules = { 'zabbix_agent_t' => ['allow zabbix_agent_t self:process setrlimit', 'allow zabbix_agent_t self:unix_dgram_socket create']}
+ $selinux_rules = { 'zabbix_agent_t' => ['allow zabbix_agent_t self:process setrlimit', 'allow zabbix_agent_t self:unix_dgram_socket create'] }
$manage_selinux = fact('os.selinux.enabled') ? {
true => true,
diff --git a/manifests/proxy.pp b/manifests/proxy.pp
index 318ef00be..2095ae783 100644
--- a/manifests/proxy.pp
+++ b/manifests/proxy.pp
@@ -423,8 +423,7 @@
$loadmodulepath = $zabbix::params::proxy_loadmodulepath,
$loadmodule = $zabbix::params::proxy_loadmodule,
Boolean $manage_selinux = $zabbix::params::manage_selinux,
- ) inherits zabbix::params {
-
+) inherits zabbix::params {
# check osfamily, Arch is currently not supported for web
if $facts['os']['family'] == 'Archlinux' {
fail('Archlinux is currently not supported for zabbix::proxy ')
@@ -524,7 +523,8 @@
}
Package["zabbix-proxy-${db}"] {
- require => Class['zabbix::repo'] }
+ require => Class['zabbix::repo']
+ }
}
# Now we are going to install the correct packages.
@@ -564,40 +564,39 @@
subscribe => [
File[$proxy_configfile_path],
Class['zabbix::database']
- ],
+ ],
require => [
Package["zabbix-proxy-${db}"],
File[$include_dir],
File[$proxy_configfile_path],
Class['zabbix::database']
- ],
+ ],
}
}
-
$before_database = $manage_service ? {
true => [
Service[$proxy_service_name],
Class["zabbix::database::${database_type}"]
- ],
+ ],
false => Class["zabbix::database::${database_type}"],
}
# if we want to manage the databases, we do
# some stuff. (for maintaining database only.)
- if $manage_database {
- class { 'zabbix::database':
- database_type => $database_type,
- zabbix_type => 'proxy',
- database_name => $database_name,
- database_user => $database_user,
- database_password => $database_password,
- database_host => $database_host,
- zabbix_proxy => $zabbix_proxy,
- zabbix_proxy_ip => $zabbix_proxy_ip,
- before => $before_database,
- }
+ if $manage_database {
+ class { 'zabbix::database':
+ database_type => $database_type,
+ zabbix_type => 'proxy',
+ database_name => $database_name,
+ database_user => $database_user,
+ database_password => $database_password,
+ database_host => $database_host,
+ zabbix_proxy => $zabbix_proxy,
+ zabbix_proxy_ip => $zabbix_proxy_ip,
+ before => $before_database,
}
+ }
# Configuring the zabbix-proxy configuration file
file { $proxy_configfile_path:
@@ -625,16 +624,16 @@
state => [
'NEW',
'RELATED',
- 'ESTABLISHED'],
+ 'ESTABLISHED',
+ ],
}
}
# check if selinux is active and allow zabbix
if fact('os.selinux.enabled') == true and $manage_selinux {
- selboolean{'zabbix_can_network':
+ selboolean { 'zabbix_can_network':
persistent => true,
value => 'on',
}
}
-
}
diff --git a/manifests/repo.pp b/manifests/repo.pp
index 2dfed05dd..80ad50e32 100644
--- a/manifests/repo.pp
+++ b/manifests/repo.pp
@@ -92,7 +92,6 @@
gpgkey => $gpgkey_nonsupported,
priority => '1',
}
-
}
'Debian' : {
if ($manage_apt) {
diff --git a/manifests/resources/web.pp b/manifests/resources/web.pp
index e49b919f9..4d8d8abdf 100644
--- a/manifests/resources/web.pp
+++ b/manifests/resources/web.pp
@@ -23,12 +23,14 @@
owner => 'root',
group => 'root',
mode => '0400',
- content => epp('zabbix/api.conf.epp', {
- zabbix_url => $zabbix_url,
- zabbix_user => $zabbix_user,
- zabbix_pass => $zabbix_pass,
- apache_use_ssl => $apache_use_ssl,
- }),
+ content => epp('zabbix/api.conf.epp',
+ {
+ zabbix_url => $zabbix_url,
+ zabbix_user => $zabbix_user,
+ zabbix_pass => $zabbix_pass,
+ apache_use_ssl => $apache_use_ssl,
+ }
+ ),
}
Zabbix_proxy <<| |>> {
diff --git a/manifests/sender.pp b/manifests/sender.pp
index 3ce3a7e0e..d7c0f4f6f 100644
--- a/manifests/sender.pp
+++ b/manifests/sender.pp
@@ -18,12 +18,11 @@
# [*manage_repo*]
# When true, it will create repository for installing the agent.
#
-class zabbix::sender(
+class zabbix::sender (
$zabbix_version = $zabbix::params::zabbix_version,
$zabbix_package_state = $zabbix::params::zabbix_package_state,
$manage_repo = $zabbix::params::manage_repo,
) inherits zabbix::params {
-
# Only include the repo class if it has not yet been included
unless defined(Class['Zabbix::Repo']) {
class { 'zabbix::repo':
diff --git a/manifests/server.pp b/manifests/server.pp
index ea4cbd44d..271aec107 100644
--- a/manifests/server.pp
+++ b/manifests/server.pp
@@ -384,7 +384,6 @@
Optional[String[1]] $zabbix_user = $zabbix::params::server_zabbix_user,
Boolean $manage_startup_script = $zabbix::params::manage_startup_script,
) inherits zabbix::params {
-
# the following codeblock is a bit blargh. The correct default value for
# $real_additional_service_params changes based on the value of $zabbix_version
# We handle this in the params.pp, but that doesn't work if somebody provides a specific
@@ -464,7 +463,7 @@
# Ensure that the correct config file is used.
if $manage_startup_script {
- zabbix::startup {'zabbix-server':
+ zabbix::startup { 'zabbix-server':
pidfile => $pidfile,
database_type => $database_type,
server_configfile_path => $server_configfile_path,
@@ -515,7 +514,7 @@
Package["zabbix-server-${db}"],
File[$include_dir],
File[$server_configfile_path],
- ],
+ ],
}
} else {
if $manage_service {
@@ -558,7 +557,8 @@
state => [
'NEW',
'RELATED',
- 'ESTABLISHED'],
+ 'ESTABLISHED',
+ ],
}
}
@@ -574,8 +574,8 @@
], {
persistent => true,
value => 'on',
- })
- selinux::module{'zabbix-server':
+ })
+ selinux::module { 'zabbix-server':
ensure => 'present',
source_te => 'puppet:///modules/zabbix/zabbix-server.te',
before => $dependency,
@@ -583,8 +583,8 @@
}
# zabbix-server 3.4 introduced IPC via a socket in /tmp
# https://support.zabbix.com/browse/ZBX-12567
- if versioncmp($zabbix_version, '3.3') > 0 {
- selinux::module{'zabbix-server-ipc':
+ if versioncmp($zabbix_version, '3.3') > 0 {
+ selinux::module { 'zabbix-server-ipc':
ensure => 'present',
source_te => 'puppet:///modules/zabbix/zabbix-server-ipc.te',
before => $dependency,
diff --git a/manifests/startup.pp b/manifests/startup.pp
index e368e1232..18d351337 100644
--- a/manifests/startup.pp
+++ b/manifests/startup.pp
@@ -21,8 +21,7 @@
String $service_type = 'simple',
Optional[Boolean] $manage_database = undef,
Optional[String] $service_name = $name,
- ) {
-
+) {
case $title {
/agent/: {
assert_type(Stdlib::Absolutepath, $agent_configfile_path)
diff --git a/manifests/template.pp b/manifests/template.pp
index fb3e30612..23183f7d4 100644
--- a/manifests/template.pp
+++ b/manifests/template.pp
@@ -30,7 +30,6 @@
$templ_name = $title,
$templ_source = '',
) {
-
zabbix::resources::template { $templ_name:
template_name => $templ_name,
template_source => $templ_source,
diff --git a/manifests/web.pp b/manifests/web.pp
index fe5ee5e93..60c392da2 100644
--- a/manifests/web.pp
+++ b/manifests/web.pp
@@ -232,9 +232,8 @@
$puppetgem = $zabbix::params::puppetgem,
Boolean $manage_selinux = $zabbix::params::manage_selinux,
) inherits zabbix::params {
-
# check osfamily, Arch is currently not supported for web
- if $facts['os']['family'] in [ 'Archlinux', 'Gentoo', ] {
+ if $facts['os']['family'] in ['Archlinux', 'Gentoo',] {
fail("${facts['os']['family']} is currently not supported for zabbix::web")
}
@@ -422,25 +421,25 @@
default_vhost => $default_vhost,
add_listen => true,
directories => [
- merge({
- path => '/usr/share/zabbix',
- provider => 'directory',
+ merge( {
+ path => '/usr/share/zabbix',
+ provider => 'directory',
}, $directory_allow),
- merge({
- path => '/usr/share/zabbix/conf',
- provider => 'directory',
+ merge( {
+ path => '/usr/share/zabbix/conf',
+ provider => 'directory',
}, $directory_deny),
- merge({
- path => '/usr/share/zabbix/api',
- provider => 'directory',
+ merge( {
+ path => '/usr/share/zabbix/api',
+ provider => 'directory',
}, $directory_deny),
- merge({
- path => '/usr/share/zabbix/include',
- provider => 'directory',
+ merge( {
+ path => '/usr/share/zabbix/include',
+ provider => 'directory',
}, $directory_deny),
- merge({
- path => '/usr/share/zabbix/include/classes',
- provider => 'directory',
+ merge( {
+ path => '/usr/share/zabbix/include/classes',
+ provider => 'directory',
}, $directory_deny),
],
custom_fragment => "
@@ -455,7 +454,7 @@
php_value date.timezone ${zabbix_timezone}",
rewrites => [
{
- rewrite_rule => ['^$ /index.php [L]'] }
+ rewrite_rule => ['^$ /index.php [L]'] }
],
ssl => $apache_use_ssl,
ssl_cert => $apache_ssl_cert,
@@ -469,12 +468,12 @@
# check if selinux is active and allow zabbix
if fact('os.selinux.enabled') == true and $manage_selinux {
# allow httpd to speak to the zabbix service
- selboolean{'httpd_can_connect_zabbix':
+ selboolean { 'httpd_can_connect_zabbix':
persistent => true,
value => 'on',
}
# allow httpd to speak to the database
- selboolean{'httpd_can_network_connect_db':
+ selboolean { 'httpd_can_network_connect_db':
persistent => true,
value => 'on',
}
diff --git a/manifests/zapache.pp b/manifests/zapache.pp
index 263e0dbd0..15015b142 100644
--- a/manifests/zapache.pp
+++ b/manifests/zapache.pp
@@ -41,14 +41,12 @@
# Copyright (c) [2015] [Robert Tisdale]
#
-
# Check if apache_status is true, installs Zapache scripts. Defaults to false.
class zabbix::zapache (
Boolean $apache_status = $zabbix::params::apache_status,
- ) inherits zabbix::params {
-
+) inherits zabbix::params {
if $apache_status {
- file { [ '/var/lib/zabbixsrv/','/var/lib/zabbixsrv/externalscripts/']:
+ file { ['/var/lib/zabbixsrv/','/var/lib/zabbixsrv/externalscripts/']:
ensure => directory,
owner => 'root',
group => 'root',
@@ -76,7 +74,7 @@
owner => 'root',
group => 'root',
mode => '0644',
- require => [ Package['zabbix-agent'],Package['httpd'] ],
+ require => [Package['zabbix-agent'],Package['httpd']],
notify => Service['httpd'],
}
}
diff --git a/spec/acceptance/agent_spec.rb b/spec/acceptance/agent_spec.rb
index d16574d98..e30b09946 100644
--- a/spec/acceptance/agent_spec.rb
+++ b/spec/acceptance/agent_spec.rb
@@ -17,7 +17,7 @@ class { 'zabbix::agent':
}
EOS
- cleanup_zabbix
+ prepare_host
# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
diff --git a/spec/acceptance/server_spec.rb b/spec/acceptance/server_spec.rb
index 099f27796..321a5a911 100644
--- a/spec/acceptance/server_spec.rb
+++ b/spec/acceptance/server_spec.rb
@@ -20,7 +20,7 @@ class { 'zabbix::database': } ->
class { 'zabbix::server': }
EOS
- cleanup_zabbix
+ prepare_host
# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
diff --git a/spec/acceptance/zabbix_application_spec.rb b/spec/acceptance/zabbix_application_spec.rb
index 28d9f29a5..ebfc32f10 100644
--- a/spec/acceptance/zabbix_application_spec.rb
+++ b/spec/acceptance/zabbix_application_spec.rb
@@ -1,6 +1,7 @@
require 'spec_helper_acceptance'
require 'serverspec_type_zabbixapi'
+# rubocop:disable RSpec/LetBeforeExamples
describe 'zabbix_application type', unless: default[:platform] =~ %r{debian-10-amd64} do
context 'create zabbix_application resources' do
# This will deploy a running Zabbix setup (server, web, db) which we can
@@ -38,7 +39,7 @@ class { 'zabbix':
# setup zabbix. Apache module isn't idempotent and requires a second run
it 'works with no error on the first apply' do
# Cleanup old database
- cleanup_zabbix
+ prepare_host
apply_manifest(pp1, catch_failures: true)
end
diff --git a/spec/acceptance/zabbix_host_spec.rb b/spec/acceptance/zabbix_host_spec.rb
index a3d5bde5c..ba6d3fec4 100644
--- a/spec/acceptance/zabbix_host_spec.rb
+++ b/spec/acceptance/zabbix_host_spec.rb
@@ -1,6 +1,7 @@
require 'spec_helper_acceptance'
require 'serverspec_type_zabbixapi'
+# rubocop:disable RSpec/LetBeforeExamples
describe 'zabbix_host type', unless: default[:platform] =~ %r{debian-10-amd64} do
context 'create zabbix_host resources' do
# This will deploy a running Zabbix setup (server, web, db) which we can
@@ -31,7 +32,7 @@ class { 'zabbix':
# setup zabbix. Apache module isn't idempotent and requires a second run
it 'works with no error on the first apply' do
# Cleanup old database
- cleanup_zabbix
+ prepare_host
apply_manifest(pp1, catch_failures: true)
end
diff --git a/spec/acceptance/zabbix_hostgroup_spec.rb b/spec/acceptance/zabbix_hostgroup_spec.rb
index 74ce8667e..b2a83cc32 100644
--- a/spec/acceptance/zabbix_hostgroup_spec.rb
+++ b/spec/acceptance/zabbix_hostgroup_spec.rb
@@ -1,6 +1,7 @@
require 'spec_helper_acceptance'
require 'serverspec_type_zabbixapi'
+# rubocop:disable RSpec/LetBeforeExamples
describe 'zabbix_hostgroup type', unless: default[:platform] =~ %r{debian-10-amd64} do
context 'create zabbix_hostgroup resources' do
it 'runs successfully' do
@@ -34,7 +35,7 @@ class { 'zabbix':
EOS
# Cleanup old database
- cleanup_zabbix
+ prepare_host
apply_manifest(pp, catch_failures: true)
end
diff --git a/spec/acceptance/zabbix_proxy_spec.rb b/spec/acceptance/zabbix_proxy_spec.rb
index d98316a3e..b3589e24f 100644
--- a/spec/acceptance/zabbix_proxy_spec.rb
+++ b/spec/acceptance/zabbix_proxy_spec.rb
@@ -1,6 +1,7 @@
require 'spec_helper_acceptance'
require 'serverspec_type_zabbixapi'
+# rubocop:disable RSpec/LetBeforeExamples
describe 'zabbix_proxy type', unless: default[:platform] =~ %r{debian-10-amd64} do
context 'create zabbix_proxy resources' do
# This will deploy a running Zabbix setup (server, web, db) which we can
@@ -30,7 +31,7 @@ class { 'zabbix':
EOS
# Cleanup old database
- cleanup_zabbix
+ prepare_host
it 'works idempotently with no errors' do
# Run it twice and test for idempotency
diff --git a/spec/acceptance/zabbix_template_host_spec.rb b/spec/acceptance/zabbix_template_host_spec.rb
index eb8f80dcc..ca447af9b 100644
--- a/spec/acceptance/zabbix_template_host_spec.rb
+++ b/spec/acceptance/zabbix_template_host_spec.rb
@@ -1,6 +1,7 @@
require 'spec_helper_acceptance'
require 'serverspec_type_zabbixapi'
+# rubocop:disable RSpec/LetBeforeExamples
describe 'zabbix_template_host type', unless: default[:platform] =~ %r{debian-10-amd64} do
context 'create zabbix_template_host resources' do
it 'runs successfully' do
@@ -46,7 +47,7 @@ class { 'zabbix':
shell("echo '3.02018-12-13T15:00:46ZTemplates/ApplicationsTestTemplate1TestTemplate1Templates/Applications' > /root/TestTemplate1.xml")
# Cleanup old database
- cleanup_zabbix
+ prepare_host
apply_manifest(pp, catch_failures: true)
end
diff --git a/spec/acceptance/zabbix_template_spec.rb b/spec/acceptance/zabbix_template_spec.rb
index 4b11c06e3..746079e80 100644
--- a/spec/acceptance/zabbix_template_spec.rb
+++ b/spec/acceptance/zabbix_template_spec.rb
@@ -1,6 +1,7 @@
require 'spec_helper_acceptance'
require 'serverspec_type_zabbixapi'
+# rubocop:disable RSpec/LetBeforeExamples
describe 'zabbix_template type', unless: default[:platform] =~ %r{debian-10-amd64} do
context 'create zabbix_template resources' do
it 'runs successfully' do
@@ -32,7 +33,7 @@ class { 'zabbix':
shell("echo '3.02018-12-13T15:00:46ZTemplates/ApplicationsTestTemplate1TestTemplate1Templates/Applications' > /root/TestTemplate1.xml")
# Cleanup old database
- cleanup_zabbix
+ prepare_host
apply_manifest(pp, catch_failures: true)
end
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb
index 794f487e6..bec34fdda 100644
--- a/spec/spec_helper_acceptance.rb
+++ b/spec/spec_helper_acceptance.rb
@@ -1,11 +1,6 @@
+# This file is completely managed via modulesync
require 'voxpupuli/acceptance/spec_helper_acceptance'
-configure_beaker do |host|
- # The CentOS docker image has a yum config that won't install docs, to keep used space low
- # zabbix packages their SQL file as doc, we need that for bootstrapping the database
- if host[:platform] =~ %r{el-7-x86_64} && host[:hypervisor] =~ %r{docker}
- on(host, "sed -i '/nodocs/d' /etc/yum.conf")
- end
-end
+configure_beaker
Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f }
diff --git a/spec/support/acceptance/cleanup_zabbix.rb b/spec/support/acceptance/prepare_host.rb
similarity index 57%
rename from spec/support/acceptance/cleanup_zabbix.rb
rename to spec/support/acceptance/prepare_host.rb
index 3ed9b711f..efb8bbf7d 100644
--- a/spec/support/acceptance/cleanup_zabbix.rb
+++ b/spec/support/acceptance/prepare_host.rb
@@ -1,5 +1,10 @@
-def cleanup_zabbix
- shell('rm -rf /etc/yum.repos.d/Zabbix*.repo; rm -rf /var/cache/yum/x86_64/*/Zabbix*; yum clean all --verbose') if fact('os.family') == 'RedHat'
+def prepare_host
+ if fact('os.family') == 'RedHat'
+ shell('rm -rf /etc/yum.repos.d/Zabbix*.repo; rm -rf /var/cache/yum/x86_64/*/Zabbix*; yum clean all --verbose')
+ if fact('os.release.major').to_i == 7
+ shell('sed -i "/nodocs/d" /etc/yum.conf')
+ end
+ end
cleanup_script = <<-SHELL
/opt/puppetlabs/bin/puppet resource service zabbix-server ensure=stopped
/opt/puppetlabs/bin/puppet resource package zabbix-server-pgsql ensure=purged
diff --git a/spec/unit/puppet/type/zabbix_host_spec.rb b/spec/unit/puppet/type/zabbix_host_spec.rb
index 9d1ad4c23..fe1ae4527 100644
--- a/spec/unit/puppet/type/zabbix_host_spec.rb
+++ b/spec/unit/puppet/type/zabbix_host_spec.rb
@@ -1,6 +1,7 @@
require 'spec_helper'
require 'unit/puppet/x/spec_zabbix_types'
+# rubocop:disable RSpec/LetBeforeExamples
describe Puppet::Type.type(:zabbix_host) do
describe 'when validating params' do
[