Skip to content

Commit

Permalink
Merge pull request #699 from voxpupuli/modulesync
Browse files Browse the repository at this point in the history
modulesync 3.0.0 & puppet-lint fixes & rubocop fixes
  • Loading branch information
bastelfreak committed Sep 2, 2020
2 parents 1846061 + c79db29 commit 6f4023f
Show file tree
Hide file tree
Showing 34 changed files with 147 additions and 153 deletions.
3 changes: 3 additions & 0 deletions .github/SECURITY.md
@@ -0,0 +1,3 @@
# Vox Pupuli Security Policy

Our vulnerabilities reporting process is at https://voxpupuli.org/security/
2 changes: 1 addition & 1 deletion .msync.yml
@@ -1 +1 @@
modulesync_config_version: '2.12.0'
modulesync_config_version: '3.0.0'
3 changes: 3 additions & 0 deletions .rubocop.yml
Expand Up @@ -528,6 +528,9 @@ RSpec/RepeatedDescription:
RSpec/NestedGroups:
Enabled: False

RSpec/MultipleExpectations:
Enabled: false

# this is broken on ruby1.9
Layout/IndentHeredoc:
Enabled: False
Expand Down
2 changes: 2 additions & 0 deletions .sync.yml
Expand Up @@ -13,3 +13,5 @@ Gemfile:
- gem: 'zabbixapi'
spec/spec_helper.rb:
mock_with: ':mocha'
spec/spec_helper_acceptance.rb:
unmanaged: false
5 changes: 3 additions & 2 deletions .travis.yml
@@ -1,4 +1,5 @@
---
os: linux
dist: bionic
language: ruby
cache: bundler
Expand All @@ -7,7 +8,7 @@ before_install:
- bundle --version
script:
- 'bundle exec rake $CHECK'
matrix:
jobs:
fast_finish: true
include:
- rvm: 2.4.4
Expand Down Expand Up @@ -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:
Expand Down
11 changes: 5 additions & 6 deletions Gemfile
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions manifests/agent.pp
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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],
Expand Down
5 changes: 2 additions & 3 deletions manifests/database.pp
Expand Up @@ -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,
Expand All @@ -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 {
Expand All @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions manifests/database/mysql.pp
Expand Up @@ -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()

#
Expand Down
69 changes: 30 additions & 39 deletions manifests/database/postgresql.pp
Expand Up @@ -25,7 +25,6 @@
$database_host = '',
$database_path = $zabbix::params::database_path,
) inherits zabbix::params {

assert_private()

#
Expand Down Expand Up @@ -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.'
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/database/sqlite.pp
Expand Up @@ -16,4 +16,4 @@
#
# Copyright 2014 Werner Dijkerman
#
class zabbix::database::sqlite () { }
class zabbix::database::sqlite () {}
2 changes: 0 additions & 2 deletions manifests/init.pp
Expand Up @@ -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,
Expand Down Expand Up @@ -320,5 +319,4 @@
database_collate => $database_collate,
database_tablespace => $database_tablespace,
}

}
5 changes: 2 additions & 3 deletions manifests/javagateway.pp
Expand Up @@ -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,
Expand All @@ -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':
Expand Down
8 changes: 3 additions & 5 deletions manifests/params.pp
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
43 changes: 21 additions & 22 deletions manifests/proxy.pp
Expand Up @@ -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 ')
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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',
}
}

}
1 change: 0 additions & 1 deletion manifests/repo.pp
Expand Up @@ -92,7 +92,6 @@
gpgkey => $gpgkey_nonsupported,
priority => '1',
}

}
'Debian' : {
if ($manage_apt) {
Expand Down

0 comments on commit 6f4023f

Please sign in to comment.