diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 602f324b9..7a0980a9e 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,6 +1,6 @@ This module has grown over time based on a range of contributions from people using it. If you follow these contributing guidelines your patch -will likely make it into a release a little quicker. +will likely make it into a release a little more quickly. ## Contributing @@ -65,6 +65,10 @@ add tests if you're adding new functionality. If you've not used [rspec-puppet](http://rspec-puppet.com/) before then feel free to ask about how best to test your new feature. +To run the linter, the syntax checker and the unit tests: + + bundle exec rake test + To run your all the unit tests bundle exec rake spec SPEC_OPTS='--format documentation' @@ -73,10 +77,6 @@ To run a specific spec test set the `SPEC` variable: bundle exec rake spec SPEC=spec/foo_spec.rb -To run the linter, the syntax checker and the unit tests: - - bundle exec rake test - ## Integration tests The unit tests just check the code runs, not that it does exactly what @@ -89,15 +89,20 @@ with: bundle exec rake acceptance -This will run the tests on an Ubuntu 12.04 virtual machine. You can also -run the integration tests against Centos 6.6 with. +This will run the tests on the module's default nodeset. You can override the +nodeset used, e.g., + + BEAKER_set=centos-7-x64 bundle exec rake acceptance + +There are default rake tasks for the various acceptance test modules, e.g., - BEAKER_set=centos-66-x64 bundle exec rake acceptances + bundle exec rake beaker:centos-7-x64 + bundle exec rake beaker:ssh:centos-7-x64 -If you don't want to have to recreate the virtual machine every time you -can use `BEAKER_DESTROY=no` and `BEAKER_PROVISION=no`. On the first run you will -at least need `BEAKER_PROVISION` set to yes (the default). The Vagrantfile -for the created virtual machines will be in `.vagrant/beaker_vagrant_fies`. +If you don't want to have to recreate the virtual machine every time you can +use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will at +least need `BEAKER_provision` set to yes (the default). The Vagrantfile for the +created virtual machines will be in `.vagrant/beaker_vagrant_files`. The easiest way to debug in a docker container is to open a shell: diff --git a/.msync.yml b/.msync.yml index 0a4a57db7..b2b308f74 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '1.1.0' +modulesync_config_version: '1.3.0' diff --git a/.rubocop.yml b/.rubocop.yml index b1a952131..738ae520f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -12,6 +12,7 @@ AllCops: - Gemfile - Rakefile - Guardfile + - Vagrantfile Lint/ConditionPosition: Enabled: True @@ -530,3 +531,12 @@ Layout/IndentHeredoc: # disable Yaml safe_load. This is needed to support ruby2.0.0 development envs Security/YAMLLoad: Enabled: false + +# This affects hiera interpolation, as well as some configs that we push. +Style/FormatStringToken: + Enabled: false + +# This is useful, but sometimes a little too picky about where unit tests files +# are located. +RSpec/FilePath: + Enabled: false diff --git a/.travis.yml b/.travis.yml index 2a8f599d6..afeafbf54 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,13 +18,13 @@ matrix: - rvm: 2.1.9 bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.4.1 + - rvm: 2.4.2 bundler_args: --without system_tests development - env: PUPPET_VERSION="~> 5.0" CHECK=test - - rvm: 2.4.1 + env: PUPPET_VERSION="~> 5.0" CHECK=test_with_coveralls + - rvm: 2.4.2 bundler_args: --without system_tests development env: PUPPET_VERSION="~> 5.0" CHECK=rubocop - - rvm: 2.4.1 + - rvm: 2.4.2 bundler_args: --without system_tests development env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes - rvm: 2.4.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 7216e6337..aa1add0c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v5.0.1](https://github.com/voxpupuli/puppet-zabbix/tree/v5.0.1) (2017-10-21) +[Full Changelog](https://github.com/voxpupuli/puppet-zabbix/compare/v5.0.0...v5.0.1) + +**Fixed bugs:** + +- add selinux workaround for IPC in zabbix-server3.4 [\#459](https://github.com/voxpupuli/puppet-zabbix/pull/459) ([bastelfreak](https://github.com/bastelfreak)) +- Remove updateExisting from applications in zabbix template provider. [\#450](https://github.com/voxpupuli/puppet-zabbix/pull/450) ([breaker1](https://github.com/breaker1)) +- Add missing proxy\_mode variable to zabbix\_proxy provider [\#447](https://github.com/voxpupuli/puppet-zabbix/pull/447) ([breaker1](https://github.com/breaker1)) + +**Closed issues:** + +- Zabbix API errors when adding Templates in Zabbix 3.4 v2 [\#449](https://github.com/voxpupuli/puppet-zabbix/issues/449) +- Zabbix API errors when adding Templates in Zabbix 3.4 [\#446](https://github.com/voxpupuli/puppet-zabbix/issues/446) +- SenderFrequency parameter is deprecated in Zabbix 3.4 [\#437](https://github.com/voxpupuli/puppet-zabbix/issues/437) + +**Merged pull requests:** + +- Changed image to images in template provider. [\#448](https://github.com/voxpupuli/puppet-zabbix/pull/448) ([breaker1](https://github.com/breaker1)) + ## [v5.0.0](https://github.com/voxpupuli/puppet-zabbix/tree/v5.0.0) (2017-09-17) [Full Changelog](https://github.com/voxpupuli/puppet-zabbix/compare/v4.1.3...v5.0.0) @@ -19,6 +38,10 @@ These should not affect the functionality of the module. - Syntax Error at line 82 in file init.pp [\#423](https://github.com/voxpupuli/puppet-zabbix/issues/423) - pg\_hba problems in zabbix::database [\#411](https://github.com/voxpupuli/puppet-zabbix/issues/411) +**Merged pull requests:** + +- release 5.0.0 [\#444](https://github.com/voxpupuli/puppet-zabbix/pull/444) ([bastelfreak](https://github.com/bastelfreak)) + ## [v4.1.3](https://github.com/voxpupuli/puppet-zabbix/tree/v4.1.3) (2017-06-26) [Full Changelog](https://github.com/voxpupuli/puppet-zabbix/compare/v4.1.2...v4.1.3) diff --git a/Gemfile b/Gemfile index 921071b4e..9972608f5 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ def location_for(place, fake_version = nil) end group :test do - gem 'puppetlabs_spec_helper', '~> 2.2.0', :require => false + gem 'puppetlabs_spec_helper', '~> 2.4.0', :require => false gem 'rspec-puppet', '~> 2.5', :require => false gem 'rspec-puppet-facts', :require => false gem 'rspec-puppet-utils', :require => false @@ -22,18 +22,13 @@ group :test do gem 'puppet-lint-unquoted_string-check', :require => false gem 'puppet-lint-variable_contains_upcase', :require => false gem 'metadata-json-lint', :require => false - gem 'puppet-blacksmith', :require => false - gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' - gem 'puppet-strings', '~> 1.0', :require => false gem 'redcarpet', :require => false gem 'rubocop', '~> 0.49.1', :require => false if RUBY_VERSION >= '2.3.0' gem 'rubocop-rspec', '~> 1.15.0', :require => false if RUBY_VERSION >= '2.3.0' gem 'mocha', '>= 1.2.1', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'github_changelog_generator', '~> 1.13.0', :require => false if RUBY_VERSION < '2.2.2' gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2' - gem 'github_changelog_generator', :require => false if RUBY_VERSION >= '2.2.2' gem 'parallel_tests', :require => false gem 'fakefs', :require => false end @@ -46,6 +41,7 @@ group :development do end group :system_tests do + gem 'winrm', :require => false if beaker_version = ENV['BEAKER_VERSION'] gem 'beaker', *location_for(beaker_version) end @@ -59,12 +55,19 @@ group :system_tests do gem 'beaker-module_install_helper', :require => false end +group :release do + gem 'github_changelog_generator', :require => false if RUBY_VERSION >= '2.2.2' + gem 'puppet-blacksmith', :require => false + gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' + gem 'puppet-strings', '~> 1.0', :require => false +end + if facterversion = ENV['FACTER_GEM_VERSION'] gem 'facter', facterversion.to_s, :require => false, :groups => [:test] else -gem 'facter', :require => false, :groups => [:test] + gem 'facter', :require => false, :groups => [:test] end ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 5.0' : puppetversion = ENV['PUPPET_VERSION'].to_s diff --git a/Rakefile b/Rakefile index ab9411ba2..e4e72e922 100644 --- a/Rakefile +++ b/Rakefile @@ -31,6 +31,17 @@ task test: [ :release_checks, ] +desc "Run main 'test' task and report merged results to coveralls" +task test_with_coveralls: [:test] do + if Dir.exist?(File.expand_path('../lib', __FILE__)) + require 'coveralls/rake/task' + Coveralls::RakeTask.new + Rake::Task['coveralls:push'].invoke + else + puts 'Skipping reporting to coveralls. Module has no lib dir' + end +end + begin require 'github_changelog_generator/task' GitHubChangelogGenerator::RakeTask.new :changelog do |config| @@ -39,6 +50,9 @@ begin config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} config.user = 'voxpupuli' + metadata_json = File.join(File.dirname(__FILE__), 'metadata.json') + metadata = JSON.load(File.read(metadata_json)) + config.project = metadata['name'] end rescue LoadError end diff --git a/files/zabbix-server-ipc.te b/files/zabbix-server-ipc.te new file mode 100644 index 000000000..81752bb13 --- /dev/null +++ b/files/zabbix-server-ipc.te @@ -0,0 +1,14 @@ +module zabbix-server-ipc 1.0; + +require { + type tmp_t; + type zabbix_t; + class sock_file { create write }; + class unix_stream_socket connectto; +} + +#============= zabbix_t ============== + +allow zabbix_t self:unix_stream_socket connectto; + +allow zabbix_t tmp_t:sock_file { create write }; diff --git a/lib/puppet/provider/zabbix_proxy/ruby.rb b/lib/puppet/provider/zabbix_proxy/ruby.rb index 8a04df542..a69a92a19 100644 --- a/lib/puppet/provider/zabbix_proxy/ruby.rb +++ b/lib/puppet/provider/zabbix_proxy/ruby.rb @@ -10,6 +10,10 @@ def create # Set some vars host = @resource[:hostname] ipaddress = @resource[:ipaddress] + + # Normally 0 is active and 1 is passive, in the API, its 5 and 6 + proxy_mode = @resource[:mode] + 5 + use_ip = @resource[:use_ip] port = @resource[:port] templates = @resource[:templates] diff --git a/lib/puppet/provider/zabbix_template/ruby.rb b/lib/puppet/provider/zabbix_template/ruby.rb index 81153a33a..6bf0edcaa 100644 --- a/lib/puppet/provider/zabbix_template/ruby.rb +++ b/lib/puppet/provider/zabbix_template/ruby.rb @@ -14,8 +14,7 @@ def create format: 'xml', rules: { applications: { - createMissing: true, - updateExisting: true + createMissing: true }, discoveryRules: { createMissing: true, diff --git a/manifests/server.pp b/manifests/server.pp index 58f062c6b..ac8de1b2d 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -566,5 +566,14 @@ source_te => 'puppet:///modules/zabbix/zabbix-server.te', before => $dependency, } + # zabbix-server 3.4 introduced IPC via a socket in /tmp + # https://support.zabbix.com/browse/ZBX-12567 + if versioncmp($zabbix_version, '3.3') > 1 { + selinux::module{'zabbix-server-ipc': + ensure => 'present', + source_te => 'puppet:///modules/zabbix/zabbix-server-ips.te', + before => $dependency, + } + } } } diff --git a/manifests/web.pp b/manifests/web.pp index 19d8d38ac..df9e1aba8 100644 --- a/manifests/web.pp +++ b/manifests/web.pp @@ -267,7 +267,7 @@ $zabbixapi_version = '2.4.4' } default : { - $zabbixapi_version = '2.4.7' + $zabbixapi_version = '3.2.1' } } diff --git a/metadata.json b/metadata.json index 9b22b2159..fb5674e0e 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-zabbix", - "version": "5.0.1-rc0", + "version": "5.0.2-rc0", "summary": "Installing and maintaining Zabbix. Will install server, proxy, java-gateway and agent on RedHat/Debian/Ubuntu (Incl. exported resources).", "author": "Vox Pupuli", "dependencies": [ diff --git a/spec/acceptance/nodesets/docker/debian-9.yml b/spec/acceptance/nodesets/docker/debian-9.yml new file mode 100644 index 000000000..dfc8e9c09 --- /dev/null +++ b/spec/acceptance/nodesets/docker/debian-9.yml @@ -0,0 +1,20 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/theforeman/foreman-installer-modulesync +HOSTS: + debian-9-x64: + platform: debian-9-amd64 + hypervisor: docker + image: debian:9 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'apt-get update && apt-get install -y cron locales-all net-tools wget systemd-sysv' + - 'rm -f /usr/sbin/policy-rc.d' + - 'systemctl mask getty@tty1.service getty-static.service' +CONFIG: + trace_limit: 200 + masterless: true +... +# vim: syntax=yaml diff --git a/spec/acceptance/server_spec.rb b/spec/acceptance/server_spec.rb index 628d97f4f..271c46d3c 100644 --- a/spec/acceptance/server_spec.rb +++ b/spec/acceptance/server_spec.rb @@ -20,6 +20,8 @@ class { 'zabbix::database': } -> class { 'zabbix::server': } EOS + shell('yum clean metadata') if fact('os.family') == 'RedHat' + # Run it twice and test for idempotency apply_manifest(pp, catch_failures: true) apply_manifest(pp, catch_changes: true) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2aa9da74c..cdd493591 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,8 +8,7 @@ require 'simplecov-console' SimpleCov.formatters = [ SimpleCov::Formatter::HTMLFormatter, - SimpleCov::Formatter::Console, - Coveralls::SimpleCov::Formatter + SimpleCov::Formatter::Console ] SimpleCov.start do track_files 'lib/**/*.rb'