diff --git a/.fixtures.yml b/.fixtures.yml index 5fc3e3c82..2ddd84e65 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -8,7 +8,6 @@ fixtures: postgresql: "git://github.com/puppetlabs/puppet-postgresql.git" mysql: "git://github.com/puppetlabs/puppetlabs-mysql.git" ruby: "git://github.com/puppetlabs/puppetlabs-ruby.git" - pe_gem: "git://github.com/puppetlabs/puppetlabs-pe_gem.git" systemd: "git://github.com/camptocamp/puppet-systemd.git" selinux: "git://github.com/voxpupuli/puppet-selinux.git" yumrepo_core: diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 38cacd4e9..ad2c7e1b9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,3 +1,18 @@ +# Contribution guidelines + +## Table of contents + +* [Contributing](#contributing) +* [Writing proper commits - short version](#writing-proper-commits-short-version) +* [Writing proper commits - long version](#writing-proper-commits-long-version) +* [Dependencies](#dependencies) + * [Note for OS X users](#note-for-os-x-users) +* [The test matrix](#the-test-matrix) +* [Syntax and style](#syntax-and-style) +* [Running the unit tests](#running-the-unit-tests) +* [Unit tests in docker](#unit-tests-in-docker) +* [Integration tests](#integration-tests) + 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 more quickly. @@ -8,29 +23,92 @@ Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. [Contributor Code of Conduct](https://voxpupuli.org/coc/). -1. Fork the repo. - -1. Create a separate branch for your change. - -1. We only take pull requests with passing tests, and documentation. [travis-ci](http://travis-ci.org) - runs the tests for us. You can also execute them locally. This is explained - in a later section. - -1. Checkout [our docs](https://voxpupuli.org/docs/#reviewing-a-module-pr) we - use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html). - They provide some guidance for new code that might help you before you submit a pull request. - -1. Add a test for your change. Only refactoring and documentation - changes require no new tests. If you are adding functionality - or fixing a bug, please add a test. - -1. Squash your commits down into logical components. Make sure to rebase - against our current master. - -1. Push the branch to your fork and submit a pull request. - -Please be prepared to repeat some of these steps as our contributors review -your code. +* Fork the repo. +* Create a separate branch for your change. +* We only take pull requests with passing tests, and documentation. [travis-ci](http://travis-ci.org) runs the tests for us. You can also execute them locally. This is explained [in a later section](#the-test-matrix). +* Checkout [our docs](https://voxpupuli.org/docs/reviewing_pr/) we use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html). They provide some guidance for new code that might help you before you submit a pull request. +* Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, please add a test. +* Squash your commits down into logical components. Make sure to rebase against our current master. +* Push the branch to your fork and submit a pull request. + +Please be prepared to repeat some of these steps as our contributors review your code. + +## Writing proper commits - short version + +* Make commits of logical units. +* Check for unnecessary whitespace with "git diff --check" before committing. +* Commit using Unix line endings (check the settings around "crlf" in git-config(1)). +* Do not check in commented out code or unneeded files. +* The first line of the commit message should be a short description (50 characters is the soft limit, excluding ticket number(s)), and should skip the full stop. +* Associate the issue in the message. The first line should include the issue number in the form "(#XXXX) Rest of message". +* The body should provide a meaningful commit message, which: + *uses the imperative, present tense: `change`, not `changed` or `changes`. + * includes motivation for the change, and contrasts its implementation with the previous behavior. + * Make sure that you have tests for the bug you are fixing, or feature you are adding. + * Make sure the test suites passes after your commit: + * When introducing a new feature, make sure it is properly documented in the README.md + +## Writing proper commits - long version + + 1. Make separate commits for logically separate changes. + + Please break your commits down into logically consistent units + which include new or changed tests relevant to the rest of the + change. The goal of doing this is to make the diff easier to + read for whoever is reviewing your code. In general, the easier + your diff is to read, the more likely someone will be happy to + review it and get it into the code base. + + If you are going to refactor a piece of code, please do so as a + separate commit from your feature or bug fix changes. + + We also really appreciate changes that include tests to make + sure the bug is not re-introduced, and that the feature is not + accidentally broken. + + Describe the technical detail of the change(s). If your + description starts to get too long, that is a good sign that you + probably need to split up your commit into more finely grained + pieces. + + Commits which plainly describe the things which help + reviewers check the patch and future developers understand the + code are much more likely to be merged in with a minimum of + bike-shedding or requested changes. Ideally, the commit message + would include information, and be in a form suitable for + inclusion in the release notes for the version of Puppet that + includes them. + + Please also check that you are not introducing any trailing + whitespace or other "whitespace errors". You can do this by + running "git diff --check" on your changes before you commit. + + 2. Sending your patches + + To submit your changes via a GitHub pull request, we _highly_ + recommend that you have them on a topic branch, instead of + directly on `master`. + It makes things much easier to keep track of, especially if + you decide to work on another thing before your first change + is merged in. + + GitHub has some pretty good + [general documentation](http://help.github.com/) on using + their site. They also have documentation on + [creating pull requests](http://help.github.com/send-pull-requests/). + + In general, after pushing your topic branch up to your + repository on GitHub, you can switch to the branch in the + GitHub UI and click "Pull Request" towards the top of the page + in order to open a pull request. + + + 3. Update the related GitHub issue. + + If there is a GitHub issue associated with the change you + submitted, then you should update the ticket to include the + location of your branch, along with any other commentary you + may wish to make. ## Dependencies @@ -75,13 +153,15 @@ BUNDLE_JOBS="$(nproc)" ### Note for OS X users -`nproc` isn't a valid command unter OS x. As an alternative, you can do: +`nproc` isn't a valid command under OS x. As an alternative, you can do: ```sh --jobs "$(sysctl -n hw.ncpu)" ``` -## Syntax and style +## The test matrix + +### Syntax and style The test suite will run [Puppet Lint](http://puppet-lint.com/) and [Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to @@ -99,7 +179,7 @@ against it. You can run those locally ahead of time with: bundle exec rake rubocop ``` -## Running the unit tests +### Running the unit tests The unit test suite covers most of the code, as mentioned above please add tests if you're adding new functionality. If you've not used @@ -124,7 +204,7 @@ To run a specific spec test set the `SPEC` variable: bundle exec rake spec SPEC=spec/foo_spec.rb ``` -### Unit tests in docker +#### Unit tests in docker Some people don't want to run the dependencies locally or don't want to install ruby. We ship a Dockerfile that enables you to run all unit tests and linting. @@ -139,7 +219,7 @@ permission to talk to it. You can specify a remote docker host by setting the `DOCKER_HOST` environment variable. it will copy the content of the module into the docker image. So it will not work if a Gemfile.lock exists. -## Integration tests +### Integration tests The unit tests just check the code runs, not that it does exactly what we want on a real machine. For that we're using @@ -176,16 +256,17 @@ Beaker also supports docker containers. We also use that in our automated CI pipeline at [travis-ci](http://travis-ci.org). To use that instead of Vagrant: ```sh -PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker +PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian10-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker ``` -You can replace the string `debian9` with any common operating system. +You can replace the string `debian10` with any common operating system. The following strings are known to work: * ubuntu1604 * ubuntu1804 * debian8 * debian9 +* debian10 * centos6 * centos7 diff --git a/.msync.yml b/.msync.yml index 23dfa32f9..e8e870383 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.8.0' +modulesync_config_version: '2.10.1' diff --git a/.rubocop.yml b/.rubocop.yml index 099a11c53..5984ccc64 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,6 @@ require: rubocop-rspec AllCops: - TargetRubyVersion: 1.9 + TargetRubyVersion: 2.1 Include: - ./**/*.rb Exclude: diff --git a/.sync.yml b/.sync.yml index b5aa5b6ea..3a2a9c295 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,9 +1,8 @@ --- .travis.yml: docker_sets: - - set: ubuntu1404-64 - set: ubuntu1604-64 - - set: centos7-64 + - set: 'centos7-64{image=centos:7.6.1810}' - set: debian8-64 secure: "ijm7hKPYWr1eg7151g5oK6MzZL4ojrgWjKlxgoBHXAdXdY88opMgvixfSJK5IMUbtanPfWRkqqABx+MYO78nfQBWDlghUzZ8sQXFeO2Ie0PgWl4nFV0kKWz+ejVaZC4dKSZlWha5pO1ek+sx7KnjIBZY82OXs/GXbjwhHx6d56YugXLuCyvfFxC7mXC9wF58bPwcYRCBSZt9CRl0OMBAFybxjdwsFMloRRhdz7f3hhlqF8Nrs1sxG1HhgiMcnrZqovNfb3Tw9K1RPYATazXxQrjcI7YHvJx0AvtHFUsn+/A0GtpKUuuPbaVdkYgE1Tye0AsAcey6RW4xhJywZglKrzDk7vfyUiU5CObeLh4/dhub3k111rDPL8v6v9t40fteduJoFLziHotQwdl37UALL7PwWZY5HuJvaBqHY2LsGs/ptGMB9ZCzxA85jfDw8lrZQ7P97SAoC34Ihs8D6vkKT9HUKHIXh19O5AAa70jReru0ej179IBjvs8m9nDwDNdY3sIsdhUU8WQ3BftDF6M8OzvgyLKDvjSs1Izag+Asl2Ze7RAQfQ2RvbfkDm9KEFnDQtXtzF4Cu1Ed6io2j1zI71JFQpIf6zb1qeNrhqulbJ15owGkQmHBgD8K+bDd1CCU4kA26axypV00XDsjfwdtFHgtUO3AlUVUim0QTMk9ATc=" Gemfile: diff --git a/.travis.yml b/.travis.yml index a67f41ad4..a9c4e1097 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,9 @@ --- -dist: xenial +dist: bionic language: ruby cache: bundler before_install: - - gem update --system - - gem update bundler + - yes | gem update --system - bundle --version script: - 'bundle exec rake $CHECK' @@ -25,35 +24,27 @@ matrix: env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64{image=centos:7.6.1810} BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64{image=centos:7.6.1810} BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker branches: only: @@ -61,6 +52,7 @@ branches: - /^v\d/ notifications: email: false + webhooks: https://voxpupu.li/incoming/travis irc: on_success: always on_failure: always diff --git a/CHANGELOG.md b/CHANGELOG.md index 69d355eea..455bbd7b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,53 @@ 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. +## [v7.0.0](https://github.com/voxpupuli/puppet-zabbix/tree/v7.0.0) (2019-10-06) + +[Full Changelog](https://github.com/voxpupuli/puppet-zabbix/compare/v6.7.0...v7.0.0) + +**Breaking changes:** + +- drop legacy puppetlabs/pe\_gem dependency & cleanup code [\#628](https://github.com/voxpupuli/puppet-zabbix/pull/628) ([bastelfreak](https://github.com/bastelfreak)) +- Allow puppetlabs/apache 5.x, puppetlabs/concat 6.x, puppetlabs/firewall 2.x, puppetlabs/mysql 9.x, puppetlabs/stdlib 6.x; drop puppetlabs/ruby dependency [\#610](https://github.com/voxpupuli/puppet-zabbix/pull/610) ([dhoppe](https://github.com/dhoppe)) +- modulesync 2.5.1 and drop Puppet 4 [\#589](https://github.com/voxpupuli/puppet-zabbix/pull/589) ([bastelfreak](https://github.com/bastelfreak)) + +**Implemented enhancements:** + +- Add historyindexcachesize to class zabbix [\#566](https://github.com/voxpupuli/puppet-zabbix/issues/566) +- Add support for specifying unsupported repo location. [\#612](https://github.com/voxpupuli/puppet-zabbix/pull/612) ([jadestorm](https://github.com/jadestorm)) +- Put selboolean{'zabbix\_can\_network'} inside ensure\_resources [\#599](https://github.com/voxpupuli/puppet-zabbix/pull/599) ([KrzysztofHajdamowicz](https://github.com/KrzysztofHajdamowicz)) +- Implement self.prefetch for zabbix\_host [\#591](https://github.com/voxpupuli/puppet-zabbix/pull/591) ([baurmatt](https://github.com/baurmatt)) +- Added historyindexcachesize to class zabbix \(part2\) [\#586](https://github.com/voxpupuli/puppet-zabbix/pull/586) ([Ordnaxz](https://github.com/Ordnaxz)) +- Add Remote Commands capabilities on Zabbix Proxy [\#575](https://github.com/voxpupuli/puppet-zabbix/pull/575) ([Safranil](https://github.com/Safranil)) + +**Fixed bugs:** + +- PrivateDevices=yes stops fping from working on Ubuntu 18.04 [\#609](https://github.com/voxpupuli/puppet-zabbix/issues/609) +- zabbix::userparameters::data doesn't notify correctly the zabbix-agent service [\#607](https://github.com/voxpupuli/puppet-zabbix/issues/607) +- puppetlabs/mysql: allow 10.x & zabbix-server: start service after initfile is created [\#624](https://github.com/voxpupuli/puppet-zabbix/pull/624) ([bastelfreak](https://github.com/bastelfreak)) +- Delete PrivateDevices attribute in systemd service template file [\#618](https://github.com/voxpupuli/puppet-zabbix/pull/618) ([jordips](https://github.com/jordips)) +- Fix minor typo in agent\_servicename param [\#616](https://github.com/voxpupuli/puppet-zabbix/pull/616) ([ljeromets](https://github.com/ljeromets)) + +**Closed issues:** + +- Cannot declare Selboolean zabbix\_can\_network elsewhere [\#598](https://github.com/voxpupuli/puppet-zabbix/issues/598) +- check\_template\_in\_host function missing parameter [\#594](https://github.com/voxpupuli/puppet-zabbix/issues/594) +- Fails to apply manifest for zabbix-agent 3.0 [\#590](https://github.com/voxpupuli/puppet-zabbix/issues/590) +- zabbix 3.0 vs php version [\#429](https://github.com/voxpupuli/puppet-zabbix/issues/429) + +**Merged pull requests:** + +- add `managed by puppet` header to unit files [\#615](https://github.com/voxpupuli/puppet-zabbix/pull/615) ([bastelfreak](https://github.com/bastelfreak)) +- Allow puppet-selinux 3.x [\#613](https://github.com/voxpupuli/puppet-zabbix/pull/613) ([ekohl](https://github.com/ekohl)) +- Allow puppetlabs/apache 4.x, puppetlabs/apt 7.x, puppetlabs/postgresql 6.x [\#605](https://github.com/voxpupuli/puppet-zabbix/pull/605) ([dhoppe](https://github.com/dhoppe)) +- Fix check\_template\_in\_host function missing parameter [\#595](https://github.com/voxpupuli/puppet-zabbix/pull/595) ([fgallese](https://github.com/fgallese)) +- Implement self.prefetch for zabbix\_hostgroup [\#593](https://github.com/voxpupuli/puppet-zabbix/pull/593) ([baurmatt](https://github.com/baurmatt)) +- switch acceptance tests from trusty to xenial [\#585](https://github.com/voxpupuli/puppet-zabbix/pull/585) ([bastelfreak](https://github.com/bastelfreak)) +- Allow puppetlabs-mysql 7.x [\#584](https://github.com/voxpupuli/puppet-zabbix/pull/584) ([ekohl](https://github.com/ekohl)) +- update travis distro from trusty to xenial [\#582](https://github.com/voxpupuli/puppet-zabbix/pull/582) ([bastelfreak](https://github.com/bastelfreak)) +- Feature/userparameters ensure [\#581](https://github.com/voxpupuli/puppet-zabbix/pull/581) ([baurmatt](https://github.com/baurmatt)) +- Move api configuration to a config file [\#579](https://github.com/voxpupuli/puppet-zabbix/pull/579) ([baurmatt](https://github.com/baurmatt)) + ## [v6.7.0](https://github.com/voxpupuli/puppet-zabbix/tree/v6.7.0) (2018-12-21) [Full Changelog](https://github.com/voxpupuli/puppet-zabbix/compare/v6.6.0...v6.7.0) @@ -128,7 +175,6 @@ These should not affect the functionality of the module. - Zabbix Repository \(zabbix-non-supported\) defined with incorrect gpgkey [\#397](https://github.com/voxpupuli/puppet-zabbix/issues/397) - Clarify dependency for database handling [\#508](https://github.com/voxpupuli/puppet-zabbix/pull/508) ([stefanandres](https://github.com/stefanandres)) - Fix missing enable attribut for zabbix::proxy service [\#507](https://github.com/voxpupuli/puppet-zabbix/pull/507) ([stefanandres](https://github.com/stefanandres)) -- Support SSL parameters for web monitoring in all versions \>= 2.4 [\#469](https://github.com/voxpupuli/puppet-zabbix/pull/469) ([anotherfigo](https://github.com/anotherfigo)) - wait for network connectivity before Zabbix Server startup [\#454](https://github.com/voxpupuli/puppet-zabbix/pull/454) ([tequeter](https://github.com/tequeter)) **Closed issues:** @@ -182,6 +228,7 @@ These should not affect the functionality of the module. - Dependencies need update [\#453](https://github.com/voxpupuli/puppet-zabbix/issues/453) - Fixed versioncmp compare and fixed typo in file zabbix-server-ips.te [\#480](https://github.com/voxpupuli/puppet-zabbix/pull/480) ([Fabian1976](https://github.com/Fabian1976)) +- Support SSL parameters for web monitoring in all versions \>= 2.4 [\#469](https://github.com/voxpupuli/puppet-zabbix/pull/469) ([anotherfigo](https://github.com/anotherfigo)) **Closed issues:** @@ -232,8 +279,8 @@ These should not affect the functionality of the module. **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)) +- Remove updateExisting from applications in zabbix template provider. [\#450](https://github.com/voxpupuli/puppet-zabbix/pull/450) ([ghost](https://github.com/ghost)) +- Add missing proxy\_mode variable to zabbix\_proxy provider [\#447](https://github.com/voxpupuli/puppet-zabbix/pull/447) ([ghost](https://github.com/ghost)) **Closed issues:** @@ -243,7 +290,7 @@ These should not affect the functionality of the module. **Merged pull requests:** -- Changed image to images in template provider. [\#448](https://github.com/voxpupuli/puppet-zabbix/pull/448) ([breaker1](https://github.com/breaker1)) +- Changed image to images in template provider. [\#448](https://github.com/voxpupuli/puppet-zabbix/pull/448) ([ghost](https://github.com/ghost)) ## [v5.0.0](https://github.com/voxpupuli/puppet-zabbix/tree/v5.0.0) (2017-09-17) @@ -779,7 +826,7 @@ These should not affect the functionality of the module. **Merged pull requests:** - Fixed bug with listenip & add lxc interface [\#46](https://github.com/voxpupuli/puppet-zabbix/pull/46) ([ghost](https://github.com/ghost)) -- notify zabbix-agent service when userparameters change [\#57](https://github.com/voxpupuli/puppet-zabbix/pull/57) ([rleemorlang](https://github.com/rleemorlang)) +- notify zabbix-agent service when userparameters change [\#57](https://github.com/voxpupuli/puppet-zabbix/pull/57) ([rmorlang](https://github.com/rmorlang)) - Fix in params.pp with default parameter of zabbix proxy for ubuntu [\#56](https://github.com/voxpupuli/puppet-zabbix/pull/56) ([fredprod](https://github.com/fredprod)) - Jvd w fix defined [\#53](https://github.com/voxpupuli/puppet-zabbix/pull/53) ([JvdW](https://github.com/JvdW)) - Fix agent listenip [\#52](https://github.com/voxpupuli/puppet-zabbix/pull/52) ([JvdW](https://github.com/JvdW)) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 8cac3bde1..000000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,97 +0,0 @@ -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. - - -## Contributing - -Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. [Contributor Code of Conduct](https://voxpupuli.org/coc/). - -1. Fork the repo. - -1. Create a separate branch for your change. - -1. Run the tests. We only take pull requests with passing tests, and - documentation. - -1. Add a test for your change. Only refactoring and documentation - changes require no new tests. If you are adding functionality - or fixing a bug, please add a test. - -1. Squash your commits down into logical components. Make sure to rebase - against the current master. - -1. Push the branch to your fork and submit a pull request. - -Please be prepared to repeat some of these steps as our contributors review -your code. - -## Dependencies - -The testing and development tools have a bunch of dependencies, -all managed by [bundler](http://bundler.io/) according to the -[Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions). - -By default the tests use a baseline version of Puppet. - -If you have Ruby 2.x or want a specific version of Puppet, -you must set an environment variable such as: - - export PUPPET_VERSION="~> 4.2.0" - -Install the dependencies like so... - - bundle install - -## Syntax and style - -The test suite will run [Puppet Lint](http://puppet-lint.com/) and -[Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to -check various syntax and style things. You can run these locally with: - - bundle exec rake lint - bundle exec rake validate - -## Running the unit tests - -The unit test suite covers most of the code, as mentioned above please -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 your all the unit tests - - bundle exec rake spec SPEC_OPTS='--format documentation' - -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 -we want on a real machine. For that we're using -[beaker](https://github.com/puppetlabs/beaker). - -This fires up a new virtual machine (using vagrant) and runs a series of -simple tests against it after applying the module. You can run this -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.5 with. - - BEAKER_set=centos-64-x64 bundle exec rake acceptances - -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`. - -# vim: syntax=markdown diff --git a/Dockerfile b/Dockerfile index 67048bb40..6fd634227 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN bundle install --without system_tests development release --path=${BUNDLE_PA COPY . . RUN bundle install -RUN bundle exec release_checks +RUN bundle exec rake release_checks # Container should not saved RUN exit 1 diff --git a/Gemfile b/Gemfile index 216129869..e7117e37c 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ end group :test do gem 'puppetlabs_spec_helper', '>= 2.14.0', :require => false - gem 'rspec-puppet-facts', '>= 1.8.0', :require => false + gem 'rspec-puppet-facts', '>= 1.9.5', :require => false gem 'rspec-puppet-utils', :require => false gem 'puppet-lint-leading_zero-check', :require => false gem 'puppet-lint-trailing_comma-check', :require => false @@ -20,8 +20,10 @@ group :test do gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false gem 'puppet-lint-unquoted_string-check', :require => false gem 'puppet-lint-variable_contains_upcase', :require => false - gem 'puppet-lint-absolute_classname-check', :require => false + gem 'puppet-lint-absolute_classname-check', '>= 2.0.0', :require => false gem 'puppet-lint-topscope-variable-check', :require => false + gem 'puppet-lint-legacy_facts-check', :require => false + gem 'puppet-lint-anchor-check', :require => false gem 'metadata-json-lint', :require => false gem 'redcarpet', :require => false gem 'rubocop', '~> 0.49.1', :require => false @@ -63,12 +65,13 @@ group :system_tests do gem 'rbnacl', '>= 4', :require => false gem 'rbnacl-libsodium', :require => false gem 'bcrypt_pbkdf', :require => false + gem 'ed25519', :require => false end group :release do - gem 'github_changelog_generator', :require => false, :git => 'https://github.com/github-changelog-generator/github-changelog-generator' + gem 'github_changelog_generator', :require => false, :git => 'https://github.com/voxpupuli/github-changelog-generator', :branch => 'voxpupuli_essential_fixes' gem 'puppet-blacksmith', :require => false - gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' + gem 'voxpupuli-release', :require => false gem 'puppet-strings', '>= 2.2', :require => false end diff --git a/Rakefile b/Rakefile index 09701d0f2..c0f2d37da 100644 --- a/Rakefile +++ b/Rakefile @@ -8,16 +8,6 @@ rescue LoadError end PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}' -PuppetLint.configuration.absolute_classname_reverse = true - -exclude_paths = %w( - pkg/**/* - vendor/**/* - .vendor/**/* - spec/**/* -) -PuppetLint.configuration.ignore_paths = exclude_paths -PuppetSyntax.exclude_paths = exclude_paths desc 'Auto-correct puppet-lint offenses' task 'lint:auto_correct' do @@ -77,6 +67,19 @@ begin metadata = JSON.load(File.read(metadata_json)) config.project = metadata['name'] end + + # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 + require 'rbconfig' + if RbConfig::CONFIG['host_os'] =~ /linux/ + task :changelog do + puts 'Fixing line endings...' + changelog_file = File.join(__dir__, 'CHANGELOG.md') + changelog_txt = File.read(changelog_file) + new_contents = changelog_txt.gsub(%r{\r\n}, "\n") + File.open(changelog_file, "w") {|file| file.puts new_contents } + end + end + rescue LoadError end # vim: syntax=ruby diff --git a/lib/puppet/provider/zabbix_proxy/ruby.rb b/lib/puppet/provider/zabbix_proxy/ruby.rb index 8b565a55e..9521d7899 100644 --- a/lib/puppet/provider/zabbix_proxy/ruby.rb +++ b/lib/puppet/provider/zabbix_proxy/ruby.rb @@ -1,7 +1,38 @@ -require File.expand_path(File.join(File.dirname(__FILE__), '..', 'zabbix')) +require_relative '../zabbix' Puppet::Type.type(:zabbix_proxy).provide(:ruby, parent: Puppet::Provider::Zabbix) do confine feature: :zabbixapi + def self.instances + proxies = zbx.query( + method: 'proxy.get', + params: { + output: 'extend', + selectInterface: %w[interfaceid type main ip port useip] + } + ) + + proxies.map do |p| + # p['interface'] is an Array if the host is a active proxy + # p['interface'] is a Hash if the host is a passive proxy + new( + ensure: :present, + name: p['host'], + ipaddress: p['interface'].is_a?(Hash) ? p['interface']['ip'] : nil, + use_ip: p['interface'].is_a?(Hash) ? p['interface']['use_ip'] : nil, + mode: p['status'].to_i - 5, + port: p['interface'].is_a?(Hash) ? p['interface']['port'] : nil + ) + end + end + + def self.prefetch(resources) + instances.each do |prov| + if (resource = resources[prov.name]) + resource.provider = prov + end + end + end + def create # Set some vars host = @resource[:hostname] @@ -12,18 +43,6 @@ def create use_ip = @resource[:use_ip] port = @resource[:port] - templates = @resource[:templates] - - # Get the template ids. - template_array = [] - if templates.is_a?(Array) == true - templates.each do |template| - template_id = get_template_id(zbx, template) - template_array.push template_id - end - else - template_array.push templates - end # Check if we need to connect via ip or fqdn use_ip = use_ip ? 1 : 0 @@ -43,4 +62,6 @@ def create def exists? check_proxy(@resource[:hostname]) end + + mk_resource_methods end diff --git a/lib/puppet/type/zabbix_proxy.rb b/lib/puppet/type/zabbix_proxy.rb index 6533c2b3b..2d0bbaf72 100644 --- a/lib/puppet/type/zabbix_proxy.rb +++ b/lib/puppet/type/zabbix_proxy.rb @@ -8,25 +8,21 @@ desc 'FQDN of the machine.' end - newparam(:ipaddress) do + newproperty(:ipaddress) do desc 'The IP address of the machine running zabbix proxy.' end - newparam(:use_ip) do + newproperty(:use_ip) do desc 'Using ipadress instead of dns to connect. Is used by the zabbix-api command.' end - newparam(:mode) do + newproperty(:mode) do desc 'The kind of mode the proxy running. Active (0) or passive (1).' end - newparam(:port) do + newproperty(:port) do desc 'The port that the zabbix proxy is listening on.' end - newparam(:templates) do - desc 'Template which should be loaded for this host.' - end - autorequire(:file) { '/etc/zabbix/api.conf' } end diff --git a/manifests/agent.pp b/manifests/agent.pp index ca3ea93e5..53d6c6402 100644 --- a/manifests/agent.pp +++ b/manifests/agent.pp @@ -346,7 +346,7 @@ } else { $use_proxy = '' } - $_hostname = pick($hostname, $facts['fqdn']) + $_hostname = pick($hostname, $facts['networking']['fqdn']) class { 'zabbix::resources::agent': hostname => $_hostname, @@ -412,7 +412,7 @@ # Configuring the zabbix-agent configuration file file { $agent_configfile_path: - ensure => present, + ensure => file, owner => $agent_config_owner, group => $agent_config_group, mode => '0644', @@ -448,7 +448,7 @@ } # the agent doesn't work perfectly fine with selinux # https://support.zabbix.com/browse/ZBX-11631 - if $facts['selinux'] == true and $manage_selinux { + if fact('os.selinux.enabled') == true and $manage_selinux { selinux::module{'zabbix-agent': ensure => 'present', content_te => template('zabbix/selinux/zabbix-agent.te.erb'), diff --git a/manifests/database.pp b/manifests/database.pp index 85997616c..1a539eb4f 100644 --- a/manifests/database.pp +++ b/manifests/database.pp @@ -72,6 +72,9 @@ # The default collation of the database. # default: utf8_general_ci # +# [* database_tablespace*] +# The tablespace the database will be created in. This setting only +# affects PostgreSQL databases. # === Example # # When running everything on a single node, please check @@ -129,20 +132,27 @@ $database_host_ip = $zabbix::params::server_database_host_ip, $database_charset = $zabbix::params::server_database_charset, $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 { + # Complain if database_tablespace is set and the database_type is not postgresql + if ($database_tablespace and $database_type != 'postgresql') { + fail("database_tablespace is set to '${database_tablespace}'. This setting is only useful for PostgreSQL databases.") + } + case $database_type { 'postgresql': { # This is the PostgreSQL part. # Create the postgres database. postgresql::server::db { $database_name: - user => $database_user, - owner => $database_user, - password => postgresql_password($database_user, $database_password), - require => Class['postgresql::server'], + user => $database_user, + owner => $database_user, + password => postgresql_password($database_user, $database_password), + require => Class['postgresql::server'], + tablespace => $database_tablespace, } # When database not in some server with zabbix server include pg_hba_rule to server diff --git a/manifests/database/postgresql.pp b/manifests/database/postgresql.pp index 5ccdc91da..9de27e8eb 100644 --- a/manifests/database/postgresql.pp +++ b/manifests/database/postgresql.pp @@ -34,7 +34,7 @@ /^(3|4).\d+$/: { if ($database_schema_path == false) or ($database_schema_path == '') { case $facts['os']['name'] { - 'CentOS', 'RedHat', 'OracleLinux': { + 'CentOS', 'RedHat', 'OracleLinux', 'VirtuozzoLinux': { $schema_path = "/usr/share/doc/zabbix-*-pgsql-${zabbix_version}*/" } default : { @@ -60,7 +60,7 @@ default: { if ($database_schema_path == false) or ($database_schema_path == '') { case $facts['os']['name'] { - 'CentOS', 'RedHat', 'OracleLinux': { + 'CentOS', 'RedHat', 'OracleLinux', 'VirtuozzoLinux': { $schema_path = "/usr/share/doc/zabbix-*-pgsql-${zabbix_version}*/create" } default : { @@ -92,7 +92,7 @@ } file { '/root/.pgpass': - ensure => present, + ensure => file, mode => '0600', owner => 'root', group => 'root', diff --git a/manifests/javagateway.pp b/manifests/javagateway.pp index 47195c0e7..36d5f9126 100644 --- a/manifests/javagateway.pp +++ b/manifests/javagateway.pp @@ -79,7 +79,7 @@ # Configuring the zabbix-javagateway configuration file file { '/etc/zabbix/zabbix_java_gateway.conf': - ensure => present, + ensure => file, owner => 'zabbix', group => 'zabbix', mode => '0640', diff --git a/manifests/params.pp b/manifests/params.pp index e08991832..aac792f84 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -159,6 +159,7 @@ $server_database_schema = undef $server_database_socket = undef $server_database_user = 'zabbix_server' + $server_database_tablespace = undef $server_debuglevel = '3' $server_externalscripts = '/usr/lib/zabbix/externalscripts' $server_historycachesize = '8M' @@ -299,7 +300,7 @@ $proxy_historycachesize = '8M' $proxy_historyindexcachesize = undef $proxy_historytextcachesize = '16M' - $proxy_hostname = $facts['fqdn'] + $proxy_hostname = $facts['networking']['fqdn'] $proxy_housekeepingfrequency = '1' $proxy_include = '/etc/zabbix/zabbix_proxy.conf.d' $proxy_javagateway = undef @@ -365,10 +366,14 @@ $javagateway_timeout = '3' # SE Linux specific params - $manage_selinux = $facts['selinux'] $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']} + $manage_selinux = fact('os.selinux.enabled') ? { + true => true, + default => false, + } + # services should run foreground and as simple type # but this only works in 3.0 and newer # https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type= @@ -379,21 +384,6 @@ $additional_service_params = '--foreground' $service_type = 'simple' } - # Gem provider may vary based on version/type of puppet install. - # This can be a little complicated and may need revisited over time. - if str2bool($facts['is_pe']) { - if $facts['pe_version'] and versioncmp($facts['pe_version'], '3.7.0') >= 0 { # lint:ignore:only_variable_string - $puppetgem = 'pe_puppetserver_gem' - } else { - $puppetgem = 'pe_gem' - } - } else { - if $facts['puppetversion'] and versioncmp($facts['puppetversion'], '4.0.0') >= 0 { - $puppetgem = 'puppet_gem' - } else { - $puppetgem = 'gem' - } - } $default_web_config_owner = $facts['os']['name'] ? { /(Ubuntu|Debian)/ => 'www-data', @@ -425,4 +415,8 @@ # getvar returned undef $web_config_group = $default_web_config_owner } + + # the package provider we use to install the zabbixapi gem + # The puppet agent needs to access it. So it's `puppet_gem` for AIO systems. + $puppetgem = 'puppet_gem' } diff --git a/manifests/proxy.pp b/manifests/proxy.pp index e68ef9dd5..842cdf2c4 100644 --- a/manifests/proxy.pp +++ b/manifests/proxy.pp @@ -455,7 +455,6 @@ use_ip => $use_ip, mode => $mode, port => $listenport, - templates => $zbx_templates, } zabbix::userparameters { 'Zabbix_Proxy': template => 'Template App Zabbix Proxy', } @@ -522,7 +521,7 @@ # Now we are going to install the correct packages. case $facts['os']['name'] { - 'redhat', 'centos', 'oraclelinux' : { + 'redhat', 'centos', 'oraclelinux', 'VirtuozzoLinux': { #There is no zabbix-proxy package in 3.0 if versioncmp('3.0',$zabbix_version) > 0 { package { 'zabbix-proxy': @@ -594,7 +593,7 @@ # Configuring the zabbix-proxy configuration file file { $proxy_configfile_path: - ensure => present, + ensure => file, owner => 'zabbix', group => 'zabbix', mode => '0644', @@ -623,7 +622,7 @@ } # check if selinux is active and allow zabbix - if $facts['selinux'] == true and $manage_selinux { + if fact('os.selinux.enabled') == true and $manage_selinux { selboolean{'zabbix_can_network': persistent => true, value => 'on', diff --git a/manifests/repo.pp b/manifests/repo.pp index 3e991a77f..33f89fdad 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -126,7 +126,7 @@ $operatingsystem = downcase($facts['os']['name']) case $facts['os']['release']['full'] { /\/sid$/ : { $releasename = regsubst($facts['os']['release']['full'], '/sid$', '') } - default : { $releasename = $facts['lsbdistcodename'] } + default : { $releasename = $facts['os']['distro']['codename'] } } $_repo_location = $repo_location ? { diff --git a/manifests/resources/proxy.pp b/manifests/resources/proxy.pp index aa63dd6a1..df3a2bc36 100644 --- a/manifests/resources/proxy.pp +++ b/manifests/resources/proxy.pp @@ -18,13 +18,11 @@ $use_ip = undef, $mode = undef, $port = undef, - $templates = undef, ) { @@zabbix_proxy { $hostname: ipaddress => $ipaddress, use_ip => $use_ip, mode => $mode, port => $port, - templates => $templates, } } diff --git a/manifests/resources/template.pp b/manifests/resources/template.pp index baea27a13..4cdf07258 100644 --- a/manifests/resources/template.pp +++ b/manifests/resources/template.pp @@ -19,7 +19,7 @@ $template_source = '', ) { file { "${template_dir}/${template_name}.xml": - ensure => present, + ensure => file, owner => 'zabbix', group => 'zabbix', source => $template_source, diff --git a/manifests/server.pp b/manifests/server.pp index 48ff61eb8..9da51d31e 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -531,7 +531,7 @@ # Configuring the zabbix-server configuration file file { $server_configfile_path: - ensure => present, + ensure => file, owner => $server_config_owner, group => $server_config_group, mode => '0640', @@ -566,7 +566,7 @@ false => undef, } # check if selinux is active and allow zabbix - if $facts['selinux'] == true and $manage_selinux { + if fact('os.selinux.enabled') == true and $manage_selinux { ensure_resource ('selboolean', [ 'zabbix_can_network', diff --git a/manifests/userparameters.pp b/manifests/userparameters.pp index 295dfd580..2ffcbd56e 100644 --- a/manifests/userparameters.pp +++ b/manifests/userparameters.pp @@ -116,9 +116,9 @@ # which needs to be loaded for this host. When exported resources is # used/enabled, we do this automatically. if $template { - zabbix::resources::userparameters { "${facts['hostname']}_${name}": + zabbix::resources::userparameters { "${facts['networking']['hostname']}_${name}": ensure => $ensure, - hostname => $facts['fqdn'], + hostname => $facts['networking']['fqdn'], template => $template, } } diff --git a/manifests/web.pp b/manifests/web.pp index 706bb0d63..f7c68f1e2 100644 --- a/manifests/web.pp +++ b/manifests/web.pp @@ -152,7 +152,7 @@ # Set location of client key used by LDAP authentication. # # [*ldap_reqcert *] -# Specifies what checks to perform on a server certificate +# Specifies what checks to perform on a server certificate # # [*puppetgem*] # Provider for the zabbixapi gem package @@ -367,7 +367,7 @@ # Webinterface config file file { '/etc/zabbix/web/zabbix.conf.php': - ensure => present, + ensure => file, owner => $web_config_owner, group => $web_config_group, mode => '0640', @@ -467,7 +467,7 @@ } # END if $manage_vhost # check if selinux is active and allow zabbix - if $facts['selinux'] == true and $manage_selinux { + if fact('os.selinux.enabled') == true and $manage_selinux { selboolean{'httpd_can_connect_zabbix': persistent => true, value => 'on', diff --git a/manifests/zapache.pp b/manifests/zapache.pp index 2ed318c5d..263e0dbd0 100644 --- a/manifests/zapache.pp +++ b/manifests/zapache.pp @@ -55,14 +55,14 @@ mode => '0755', } file { '/var/lib/zabbixsrv/externalscripts/zapache': - ensure => present, + ensure => file, source => 'puppet:///modules/zabbix/zapache/zapache', owner => 'root', group => 'root', mode => '0755', } file { '/etc/zabbix/zabbix_agentd.d/userparameter_zapache.conf': - ensure => present, + ensure => file, source => 'puppet:///modules/zabbix/zapache/userparameter_zapache.conf.sample', owner => 'root', group => 'root', @@ -71,7 +71,7 @@ notify => Service['zabbix-agent'], } file { '/etc/httpd/conf.d/httpd-server-status.conf': - ensure => present, + ensure => file, source => 'puppet:///modules/zabbix/zapache/httpd-server-status.conf.sample', owner => 'root', group => 'root', diff --git a/metadata.json b/metadata.json index 8c12f9b57..9f6cd88b5 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-zabbix", - "version": "6.7.1-rc0", + "version": "7.0.1-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": [ @@ -24,10 +24,6 @@ "name": "puppetlabs/firewall", "version_requirement": ">= 1.7.0 < 3.0.0" }, - { - "name": "puppetlabs/pe_gem", - "version_requirement": ">= 0.2.0 < 2.0.0" - }, { "name": "puppetlabs/apt", "version_requirement": ">= 2.1.0 < 8.0.0" @@ -115,7 +111,6 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "14.04", "16.04" ] }, @@ -137,6 +132,13 @@ "6" ] }, + { + "operatingsystem": "VirtuozzoLinux", + "operatingsystemrelease": [ + "6", + "7" + ] + }, { "operatingsystem": "Archlinux" }, diff --git a/spec/classes/database_spec.rb b/spec/classes/database_spec.rb index 93a30a150..53e66faf7 100644 --- a/spec/classes/database_spec.rb +++ b/spec/classes/database_spec.rb @@ -123,6 +123,33 @@ class { 'mysql::client': it { is_expected.to contain_class('zabbix::params') } end + describe 'database_type is postgresql, tablespace is not explicitly set' do + let :params do + { + database_type: 'postgresql', + database_name: 'zabbix-server', + database_user: 'zabbix-server', + zabbix_type: 'server' + } + end + + it { is_expected.to contain_postgresql__server__db('zabbix-server').with_tablespace(nil) } + end + + describe 'database_type is postgresql, tablespace is explicitly set' do + let :params do + { + database_type: 'postgresql', + database_name: 'zabbix-server', + database_user: 'zabbix-server', + zabbix_type: 'server', + database_tablespace: 'zabbix' + } + end + + it { is_expected.to contain_postgresql__server__db('zabbix-server').with_tablespace('zabbix') } + end + describe 'database_type is mysql, zabbix_type is server and is multiple host setup' do let :params do { diff --git a/spec/classes/server_spec.rb b/spec/classes/server_spec.rb index 890be4c19..8f9915578 100644 --- a/spec/classes/server_spec.rb +++ b/spec/classes/server_spec.rb @@ -1,4 +1,5 @@ require 'spec_helper' +require 'deep_merge' describe 'zabbix::server' do let :node do @@ -26,8 +27,14 @@ if facts[:osfamily] == 'RedHat' describe 'with enabled selinux' do + let :params do + { + manage_selinux: true + } + end + let :facts do - super().merge(selinux: true) + facts.deep_merge(os: { selinux: { enabled: true } }) end it { is_expected.to contain_selboolean('zabbix_can_network').with('value' => 'on', 'persistent' => true) } @@ -35,8 +42,10 @@ end describe 'with disabled selinux' do - let :facts do - super().merge(selinux: false) + let :params do + { + manage_selinux: false + } end it { is_expected.not_to contain_selboolean('zabbix_can_network').with('value' => 'on', 'persistent' => true) } diff --git a/spec/classes/web_spec.rb b/spec/classes/web_spec.rb index 2b42a3ef8..53b56da33 100644 --- a/spec/classes/web_spec.rb +++ b/spec/classes/web_spec.rb @@ -1,4 +1,5 @@ require 'spec_helper' +require 'deep_merge' describe 'zabbix::web' do let :node do @@ -28,16 +29,24 @@ end describe 'with enforcing selinux' do + let :params do + { + manage_selinux: true + } + end + let :facts do - super().merge(selinux: true) + facts.deep_merge(os: { selinux: { enabled: true } }) end it { is_expected.to contain_selboolean('httpd_can_connect_zabbix').with('value' => 'on', 'persistent' => true) } end describe 'with false selinux' do - let :facts do - super().merge(selinux: false) + let :params do + { + manage_selinux: false + } end it { is_expected.not_to contain_selboolean('httpd_can_connect_zabbix') } @@ -148,21 +157,6 @@ it { is_expected.to contain_file('/etc/zabbix/imported_templates').with_ensure('directory') } end - describe 'when manage_resources and is_pe are true' do - let :facts do - facts.merge( - is_pe: true, - pe_version: '3.7.0' - ) - end - - let :params do - super().merge(manage_resources: true) - end - - it { is_expected.to contain_package('zabbixapi').with_provider('pe_puppetserver_gem') } - end - describe 'when manage_resources is false' do let :params do super().merge(manage_resources: false) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3d0ed017c..f4fda54e3 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -10,6 +10,11 @@ require 'bundler' include RspecPuppetFacts +if ENV['DEBUG'] + Puppet::Util::Log.level = :debug + Puppet::Util::Log.newdestination(:console) +end + if File.exist?(File.join(__dir__, 'default_module_facts.yml')) facts = YAML.load(File.read(File.join(__dir__, 'default_module_facts.yml'))) if facts @@ -37,6 +42,22 @@ end RSpec.configure do |c| + # getting the correct facter version is tricky. We use facterdb as a source to mock facts + # see https://github.com/camptocamp/facterdb + # people might provide a specific facter version. In that case we use it. + # Otherwise we need to match the correct facter version to the used puppet version. + # as of 2019-10-31, puppet 5 ships facter 3.11 and puppet 6 ships facter 3.14 + # https://puppet.com/docs/puppet/5.5/about_agent.html + # + # The environment variable `PUPPET_VERSION` is available in our travis environment, but we cannot rely on it + # if somebody runs the tests locally. For that case we should fallback the the puppet gem version. + c.default_facter_version = if ENV['FACTERDB_FACTS_VERSION'] + ENV['FACTERDB_FACTS_VERSION'] + else + puppet_version = ENV['PUPPET_VERSION'] ? ENV['PUPPET_VERSION'] : Gem.loaded_specs['puppet'].version.to_s + Gem::Dependency.new('', puppet_version).match?('', '5') ? '3.11.0' : '3.14.0' + end + # Coverage generation c.after(:suite) do RSpec::Puppet::Coverage.report! diff --git a/spec/unit/puppet/provider/zabbix_host/ruby.rb b/spec/unit/puppet/provider/zabbix_host/ruby.rb index 368b82bfe..59c853770 100644 --- a/spec/unit/puppet/provider/zabbix_host/ruby.rb +++ b/spec/unit/puppet/provider/zabbix_host/ruby.rb @@ -13,13 +13,13 @@ expect(provider).to be_an_instance_of Puppet::Type::Zabbix_host::ProviderRuby end - [:instances, :prefetch].each do |method| + %i[instances prefetch].each do |method| it "should respond to the class method #{method}" do expect(described_class).to respond_to(method) end end - [:create, :exists?, :destroy, :get_groupids, :get_templateids, :ipaddress, :use_ip, :port, :groups, :templates, :proxy].each do |method| + %i[create exists? destroy get_groupids get_templateids ipaddress use_ip port groups templates proxy].each do |method| it "should respond to the instance method #{method}" do expect(described_class.new).to respond_to(method) end diff --git a/spec/unit/puppet/provider/zabbix_hostgroup/ruby.rb b/spec/unit/puppet/provider/zabbix_hostgroup/ruby.rb index ff6b7ebc3..b3a6d4801 100644 --- a/spec/unit/puppet/provider/zabbix_hostgroup/ruby.rb +++ b/spec/unit/puppet/provider/zabbix_hostgroup/ruby.rb @@ -12,13 +12,13 @@ expect(provider).to be_an_instance_of Puppet::Type::Zabbix_hostgroup::ProviderRuby end - [:instances, :prefetch].each do |method| + %i[instances prefetch].each do |method| it "should respond to the class method #{method}" do expect(described_class).to respond_to(method) end end - [:create, :exists?, :destroy].each do |method| + %i[create exists? destroy].each do |method| it "should respond to the instance method #{method}" do expect(described_class.new).to respond_to(method) end diff --git a/spec/unit/puppet/provider/zabbix_proxy/ruby.rb b/spec/unit/puppet/provider/zabbix_proxy/ruby.rb new file mode 100644 index 000000000..7e61d02fc --- /dev/null +++ b/spec/unit/puppet/provider/zabbix_proxy/ruby.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe Puppet::Type.type(:zabbix_proxy).provider(:ruby) do + let(:resource) do + Puppet::Type.type(:zabbix_proxy).new( + name: 'Testproxy' + ) + end + let(:provider) { resource.provider } + + it 'be an instance of the correct provider' do + expect(provider).to be_an_instance_of Puppet::Type::Zabbix_proxy::ProviderRuby + end + + %i[instances prefetch].each do |method| + it "should respond to the class method #{method}" do + expect(described_class).to respond_to(method) + end + end + + %i[create exists?].each do |method| + it "should respond to the instance method #{method}" do + expect(described_class.new).to respond_to(method) + end + end +end diff --git a/spec/unit/puppet/type/zabbix_host_spec.rb b/spec/unit/puppet/type/zabbix_host_spec.rb index 69d3a14fc..a7fc91bbc 100644 --- a/spec/unit/puppet/type/zabbix_host_spec.rb +++ b/spec/unit/puppet/type/zabbix_host_spec.rb @@ -3,9 +3,9 @@ describe Puppet::Type.type(:zabbix_host) do describe 'when validating params' do - [ - :group_create, - :hostname + %i[ + group_create + hostname ].each do |param| it "should have a #{param} parameter" do expect(described_class.attrtype(param)).to eq(:param) @@ -14,16 +14,16 @@ end describe 'when validating properties' do - [ - :group, - :groups, - :id, - :interfaceid, - :ipaddress, - :port, - :proxy, - :templates, - :use_ip + %i[ + group + groups + id + interfaceid + ipaddress + port + proxy + templates + use_ip ].each do |param| it "should have a #{param} property" do expect(described_class.attrtype(param)).to eq(:property) diff --git a/spec/unit/puppet/type/zabbix_hostgroup_spec.rb b/spec/unit/puppet/type/zabbix_hostgroup_spec.rb index e90e54001..19f5367c8 100644 --- a/spec/unit/puppet/type/zabbix_hostgroup_spec.rb +++ b/spec/unit/puppet/type/zabbix_hostgroup_spec.rb @@ -2,7 +2,7 @@ describe Puppet::Type.type(:zabbix_hostgroup) do describe 'when validating attributes' do - [:name, :provider].each do |param| + %i[name provider].each do |param| it "should have a #{param} parameter" do expect(described_class.attrtype(param)).to eq(:param) end diff --git a/spec/unit/puppet/type/zabbix_proxy_spec.rb b/spec/unit/puppet/type/zabbix_proxy_spec.rb new file mode 100644 index 000000000..54da81039 --- /dev/null +++ b/spec/unit/puppet/type/zabbix_proxy_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper' + +describe Puppet::Type.type(:zabbix_proxy) do + describe 'when validating params' do + %i[ + hostname + provider + ].each do |param| + it "should have a #{param} parameter" do + expect(described_class.attrtype(param)).to eq(:param) + end + end + end + + describe 'when validating properties' do + %i[ + ipaddress + use_ip + mode + port + ].each do |param| + it "should have a #{param} property" do + expect(described_class.attrtype(param)).to eq(:property) + end + end + end + + describe 'namevar' do + it 'has :hostname as its namevar' do + expect(described_class.key_attributes).to eq([:hostname]) + end + end +end diff --git a/spec/unit/puppet/type/zabbix_template_spec.rb b/spec/unit/puppet/type/zabbix_template_spec.rb index f8d1659a1..0739c1784 100644 --- a/spec/unit/puppet/type/zabbix_template_spec.rb +++ b/spec/unit/puppet/type/zabbix_template_spec.rb @@ -12,10 +12,10 @@ let(:provider) { stub('provider', class: provider_class, clear: nil) } describe 'when validating attributes' do - [ - :template_name, - :template_source, - :provider + %i[ + template_name + template_source + provider ].each do |param| it "should have a #{param} parameter" do expect(described_class.attrtype(param)).to eq(:param) @@ -32,7 +32,7 @@ describe 'ensure' do let(:property) { resource.property(:ensure) } - [:present, :absent].each do |value| + %i[present absent].each do |value| it "suppports #{value} as a value to :ensure" do expect { described_class.new(template_name: 'My template', ensure: value) }.not_to raise_error end