From cd772ba5511e89a5a2d4f31f7cbf9330422ae22b Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 28 Apr 2023 14:02:34 +0200 Subject: [PATCH 01/92] Drop Puppet 6 support --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 12c0ccc..02f1003 100644 --- a/metadata.json +++ b/metadata.json @@ -82,7 +82,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 3.0.0 < 6.0.0" + "version_requirement": ">= 7.0.0 < 8.0.0" } ], "tags": [ From cc52d6156caff016855e4eebcd21fe7b55cec834 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Sun, 4 Feb 2024 14:04:01 +0100 Subject: [PATCH 02/92] drop EOL debian --- metadata.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/metadata.json b/metadata.json index 02f1003..770ca0a 100644 --- a/metadata.json +++ b/metadata.json @@ -28,10 +28,6 @@ { "operatingsystem": "Debian", "operatingsystemrelease": [ - "6", - "7", - "8", - "9", "10" ] }, From ac672e6ccfb928ce5733cdd83b3139531090c347 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Sun, 4 Feb 2024 14:12:51 +0100 Subject: [PATCH 03/92] drop EOL ubuntu --- metadata.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/metadata.json b/metadata.json index 770ca0a..3a7a9b2 100644 --- a/metadata.json +++ b/metadata.json @@ -34,10 +34,6 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "10.04", - "12.04", - "14.04", - "16.04", "18.04" ] }, From 83e57fb292c1be859164740c9ab71c71c50817df Mon Sep 17 00:00:00 2001 From: markuszilch Date: Sun, 4 Feb 2024 14:13:33 +0100 Subject: [PATCH 04/92] drop EOL redhat --- metadata.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/metadata.json b/metadata.json index 3a7a9b2..6edbc0a 100644 --- a/metadata.json +++ b/metadata.json @@ -40,8 +40,6 @@ { "operatingsystem": "RedHat", "operatingsystemrelease": [ - "5", - "6", "7" ] }, From ac828349b5f166cba7bd931f9d281c02f4e0857b Mon Sep 17 00:00:00 2001 From: markuszilch Date: Sun, 4 Feb 2024 14:15:45 +0100 Subject: [PATCH 05/92] drop EOL centos --- metadata.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/metadata.json b/metadata.json index 6edbc0a..b6265c4 100644 --- a/metadata.json +++ b/metadata.json @@ -46,8 +46,6 @@ { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "5", - "6", "7", "8" ] From 1da8f279d9dfbeeac873b2a70ca89d3a199553e9 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Sun, 4 Feb 2024 14:16:32 +0100 Subject: [PATCH 06/92] drop eol oraclelinux --- metadata.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/metadata.json b/metadata.json index b6265c4..4e89f4e 100644 --- a/metadata.json +++ b/metadata.json @@ -53,8 +53,6 @@ { "operatingsystem": "OracleLinux", "operatingsystemrelease": [ - "5", - "6", "7" ] }, From 407ec45812cb1f08e617dd19f605e233722f73c8 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Sun, 4 Feb 2024 14:17:09 +0100 Subject: [PATCH 07/92] drop EOL scientific linux --- metadata.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/metadata.json b/metadata.json index 4e89f4e..6ac7722 100644 --- a/metadata.json +++ b/metadata.json @@ -59,8 +59,6 @@ { "operatingsystem": "Scientific", "operatingsystemrelease": [ - "5", - "6", "7" ] } From 57e8ca8c70bc8dd3afa9ada0f4aaf58365e760d2 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Sun, 4 Feb 2024 14:18:52 +0100 Subject: [PATCH 08/92] drop amazon 2016 and 2018; add amazon 2023 --- metadata.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/metadata.json b/metadata.json index 6ac7722..1ac9df1 100644 --- a/metadata.json +++ b/metadata.json @@ -21,8 +21,7 @@ { "operatingsystem": "Amazon", "operatingsystemrelease": [ - "2016", - "2018" + "2023" ] }, { From 7f44e0855e934d01a440ca1622fc57a44b21d9a4 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Sun, 4 Feb 2024 17:40:38 +0100 Subject: [PATCH 09/92] remove specialcasing in params for no longer supported OS --- manifests/params.pp | 48 ++++++--------------------------------------- 1 file changed, 6 insertions(+), 42 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index 7813b83..a676da6 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -36,22 +36,8 @@ $config_file = '/etc/monit/monitrc' $config_dir = '/etc/monit/conf.d' $monit_version = '5' - - case $::lsbdistcodename { - 'squeeze', 'lucid': { - $default_file_content = 'startup=1' - $service_hasstatus = false - } - 'wheezy', 'jessie', 'stretch', 'buster', 'precise', 'trusty', 'xenial', 'bionic': { - $default_file_content = 'START=yes' - $service_hasstatus = true - } - default: { - fail("monit supports Debian 6 (squeeze), 7 (wheezy), 8 (jessie), 9 (stretch) and 10 (buster) \ -and Ubuntu 10.04 (lucid), 12.04 (precise), 14.04 (trusty), 16.04 (xenial) and 18.04 (bionic). \ -Detected lsbdistcodename is <${::lsbdistcodename}>.") - } - } + $default_file_content = 'START=yes' + $service_hasstatus = true } 'RedHat': { $config_dir = '/etc/monit.d' @@ -59,34 +45,12 @@ case $::operatingsystem { 'Amazon': { - case $::operatingsystemmajrelease { - '2016', '2018': { - $monit_version = '5' - $config_file = '/etc/monit.conf' - } - default: { - fail("monit supports Amazon Linux 2. Detected operatingsystemmajrelease is <${::operatingsystemmajrelease}>.") - } - } + $monit_version = '5' + $config_file = '/etc/monit.conf' } default: { - case $::operatingsystemmajrelease { - '5': { - $monit_version = '4' - $config_file = '/etc/monit.conf' - } - '6': { - $monit_version = '5' - $config_file = '/etc/monit.conf' - } - '7', '8': { - $monit_version = '5' - $config_file = '/etc/monitrc' - } - default: { - fail("monit supports EL 5, 6 and 7. Detected operatingsystemmajrelease is <${::operatingsystemmajrelease}>.") - } - } + $monit_version = '5' + $config_file = '/etc/monitrc' } } } From f8cb81bfbaae4249bb8658bbde0d8ad71801f441 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Sun, 4 Feb 2024 17:44:45 +0100 Subject: [PATCH 10/92] remove specialcasing in init_spec for no longer supported OS --- spec/classes/init_spec.rb | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 9a6e9e2..f6dbe0f 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -11,42 +11,18 @@ config_file = '/etc/monit/monitrc' config_dir = '/etc/monit/conf.d' monit_version = '5' - case facts[:lsbdistcodename] - when 'squeeze', 'lucid' - default_file_content = 'startup=1' - service_hasstatus = false - when 'wheezy', 'jessie', 'stretch', 'buster', 'precise', 'trusty', 'xenial', 'bionic' - default_file_content = 'START=yes' - service_hasstatus = true - else - raise 'unsupported operatingsystemmajrelease detected on Debian osfamily' - end + default_file_content = 'START=yes' + service_hasstatus = true when 'RedHat' config_dir = '/etc/monit.d' service_hasstatus = true case facts[:operatingsystem] when 'Amazon' - case facts[:operatingsystemmajrelease] - when '2016', '2018' - monit_version = '5' - config_file = '/etc/monit.conf' - else - raise 'unsupported operatingsystemmajrelease detected on Amazon Linux operating system' - end + monit_version = '5' + config_file = '/etc/monit.conf' else - case facts[:operatingsystemmajrelease] - when '5' - monit_version = '4' - config_file = '/etc/monit.conf' - when '6' - monit_version = '5' - config_file = '/etc/monit.conf' - when '7', '8' - monit_version = '5' - config_file = '/etc/monitrc' - else - raise 'unsupported operatingsystemmajrelease detected on RedHat osfamily' - end + monit_version = '5' + config_file = '/etc/monitrc' end else raise 'unsupported osfamily detected' From 2ffa2278125985fe31c3e7dc4e44a316041574c5 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 10:00:21 +0100 Subject: [PATCH 11/92] add debian 11 support --- metadata.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 1ac9df1..39f81dd 100644 --- a/metadata.json +++ b/metadata.json @@ -27,7 +27,8 @@ { "operatingsystem": "Debian", "operatingsystemrelease": [ - "10" + "10", + "11" ] }, { From 3510fe8005419a70d13a989800368af1ee9404cd Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 10:02:10 +0100 Subject: [PATCH 12/92] drop debian 10 support --- metadata.json | 1 - 1 file changed, 1 deletion(-) diff --git a/metadata.json b/metadata.json index 39f81dd..c9d092e 100644 --- a/metadata.json +++ b/metadata.json @@ -27,7 +27,6 @@ { "operatingsystem": "Debian", "operatingsystemrelease": [ - "10", "11" ] }, From 12a3478821484dbc851860c198aaa7c4ab151f36 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 14:08:46 +0100 Subject: [PATCH 13/92] add OL8 and OL9 support --- metadata.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index c9d092e..ee852b7 100644 --- a/metadata.json +++ b/metadata.json @@ -52,7 +52,9 @@ { "operatingsystem": "OracleLinux", "operatingsystemrelease": [ - "7" + "7", + "8", + "9" ] }, { From 2a7148adcc332dc443d9d0059d1e9eff178f19ee Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 14:09:24 +0100 Subject: [PATCH 14/92] drop OL7 support --- metadata.json | 1 - 1 file changed, 1 deletion(-) diff --git a/metadata.json b/metadata.json index ee852b7..771fcd7 100644 --- a/metadata.json +++ b/metadata.json @@ -52,7 +52,6 @@ { "operatingsystem": "OracleLinux", "operatingsystemrelease": [ - "7", "8", "9" ] From 18cb1c70c509746dd39e1a381bef8fed51b75fb1 Mon Sep 17 00:00:00 2001 From: Florent Poinsaut Date: Tue, 16 Nov 2021 10:33:14 +0000 Subject: [PATCH 15/92] modulesync 5.0.1-13-gdbe966f --- .editorconfig | 15 ++ .github/CONTRIBUTING.md | 252 ++++++++++++++++++ .github/ISSUE_TEMPLATE.md | 26 ++ .github/PULL_REQUEST_TEMPLATE.md | 20 ++ .github/SECURITY.md | 3 + .github/workflows/ci.yml | 90 +++++++ .github/workflows/release.yml | 34 +++ .gitignore | 48 ++-- .msync.yml | 5 + .overcommit.yml | 65 +++++ .pdkignore | 42 --- .pmtignore | 21 +- .puppet-lint.rc | 4 +- .rspec | 5 +- .rspec_parallel | 4 + .rubocop.yml | 141 +--------- .travis.yml | 54 ---- .yardopts | 1 - Dockerfile | 24 ++ Gemfile | 80 ++---- Rakefile | 131 ++++----- spec/acceptance/nodesets/debian-82-x64.yml | 11 - .../nodesets/ubuntu-server-1404-x64.yml | 11 - .../nodesets/ubuntu-server-1604-x64.yml | 11 - spec/default_facts.yml | 8 - spec/spec_helper.rb | 63 +---- 26 files changed, 681 insertions(+), 488 deletions(-) create mode 100644 .editorconfig create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/SECURITY.md create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 .msync.yml create mode 100644 .overcommit.yml delete mode 100644 .pdkignore create mode 100644 .rspec_parallel delete mode 100644 .travis.yml delete mode 100644 .yardopts create mode 100644 Dockerfile delete mode 100644 spec/acceptance/nodesets/debian-82-x64.yml delete mode 100644 spec/acceptance/nodesets/ubuntu-server-1404-x64.yml delete mode 100644 spec/acceptance/nodesets/ubuntu-server-1604-x64.yml delete mode 100644 spec/default_facts.yml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ecb10a8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# editorconfig.org + +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +tab_width = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..048d2b5 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,252 @@ +# 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. + +## 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/). + +* Fork the repo. +* Create a separate branch for your change. +* We only take pull requests with passing tests, and documentation. [GitHub Actions](https://docs.github.com/en/actions) run 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. + +Also consider sending in your profile code that calls this component module as an acceptance test or provide it via an issue. This helps reviewers a lot to test your use case and prevents future regressions! + +## 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 + +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: + +```sh +export PUPPET_VERSION="~> 5.5.6" +``` + +You can install all needed gems for spec tests into the modules directory by +running: + +```sh +bundle install --path .vendor/ --without development system_tests release --jobs "$(nproc)" +``` + +If you also want to run acceptance tests: + +```sh +bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)" +``` + +Our all in one solution if you don't know if you need to install or update gems: + +```sh +bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)"; bundle update; bundle clean +``` + +As an alternative to the `--jobs "$(nproc)` parameter, you can set an +environment variable: + +```sh +BUNDLE_JOBS="$(nproc)" +``` + +### Note for OS X users + +`nproc` isn't a valid command under OS x. As an alternative, you can do: + +```sh +--jobs "$(sysctl -n hw.ncpu)" +``` + +## 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 +check various syntax and style things. You can run these locally with: + +```sh +bundle exec rake lint +bundle exec rake validate +``` + +It will also run some [Rubocop](http://batsov.com/rubocop/) tests +against it. You can run those locally ahead of time with: + +```sh +bundle exec rake rubocop +``` + +### 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 the linter, the syntax checker and the unit tests: + +```sh +bundle exec rake test +``` + +To run your all the unit tests + +```sh +bundle exec rake spec +``` + +To run a specific spec test set the `SPEC` variable: + +```sh +bundle exec rake spec SPEC=spec/foo_spec.rb +``` + +#### 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. +You only need to run: + +```sh +docker build . +``` + +Please ensure that a docker daemon is running and that your user has the +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 + +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: + +```sh +BEAKER_setfile=debian10-x64 bundle exec rake beaker +``` + +You can replace the string `debian10` with any common operating system. +The following strings are known to work: + +* ubuntu1604 +* ubuntu1804 +* ubuntu2004 +* debian9 +* debian10 +* centos7 +* centos8 + +For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests). + +The source of this file is in our [modulesync_config](https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb) +repository. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..593e7aa --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,26 @@ + + +## Affected Puppet, Ruby, OS and module versions/distributions + +- Puppet: +- Ruby: +- Distribution: +- Module version: + +## How to reproduce (e.g Puppet code you use) + +## What are you seeing + +## What behaviour did you expect instead + +## Output log + +## Any additional information you'd like to impart diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..342807b --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,20 @@ + +#### Pull Request (PR) description + + +#### This Pull Request (PR) fixes the following issues + diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 0000000..cacadf2 --- /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/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d08d05e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,90 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: CI + +on: pull_request + +concurrency: + group: ${{ github.head_ref }} + cancel-in-progress: true + +jobs: + setup_matrix: + name: 'Setup Test Matrix' + runs-on: ubuntu-latest + timeout-minutes: 40 + outputs: + puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} + github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }} + env: + BUNDLE_WITHOUT: development:system_tests:release + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + bundler-cache: true + - name: Run static validations + run: bundle exec rake validate lint check + - name: Run rake rubocop + run: bundle exec rake rubocop + - name: Setup Test Matrix + id: get-outputs + run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false + + unit: + needs: setup_matrix + runs-on: ubuntu-latest + timeout-minutes: 40 + strategy: + fail-fast: false + matrix: + include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}} + env: + BUNDLE_WITHOUT: development:system_tests:release + PUPPET_VERSION: "~> ${{ matrix.puppet }}.0" + name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }}) + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Run tests + run: bundle exec rake parallel_spec + + acceptance: + needs: setup_matrix + runs-on: ubuntu-latest + env: + BUNDLE_WITHOUT: development:test:release + strategy: + fail-fast: false + matrix: + include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}} + name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }} + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + bundler-cache: true + - name: Run tests + run: bundle exec rake beaker + env: + BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }} + BEAKER_setfile: ${{ matrix.setfile.value }} + + tests: + needs: + - unit + - acceptance + runs-on: ubuntu-latest + name: Test suite + steps: + - run: echo Test suite completed diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..664ba69 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: Release + +on: + push: + tags: + - '*' + +env: + BUNDLE_WITHOUT: development:test:system_tests + +jobs: + deploy: + name: 'deploy to forge' + runs-on: ubuntu-latest + if: github.repository_owner == 'voxpupuli' + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + - name: Build and Deploy + env: + # Configure secrets here: + # https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets + BLACKSMITH_FORGE_USERNAME: '${{ secrets.PUPPET_FORGE_USERNAME }}' + BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}' + run: bundle exec rake module:push diff --git a/.gitignore b/.gitignore index 2767022..9b95224 100644 --- a/.gitignore +++ b/.gitignore @@ -1,27 +1,23 @@ -.git/ -.*.sw[op] -.metadata -.yardoc -.yardwarns +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +pkg/ +Gemfile.lock +Gemfile.local +vendor/ +.vendor/ +spec/fixtures/manifests/ +spec/fixtures/modules/ +.vagrant/ +.bundle/ +.ruby-version +coverage/ +log/ +.idea/ +.dependencies/ +.librarian/ +Puppetfile.lock *.iml -/.bundle/ -/.idea/ -/.vagrant/ -/coverage/ -/bin/ -/doc/ -/Gemfile.local -/Gemfile.lock -/junit/ -/log/ -/pkg/ -/spec/fixtures/manifests/ -/spec/fixtures/modules/ -/tmp/ -/vendor/ -/convert_report.txt -/update_report.txt -.DS_Store -.project -.envrc -/inventory.yaml +.*.sw? +.yardoc/ +Guardfile diff --git a/.msync.yml b/.msync.yml new file mode 100644 index 0000000..ab186de --- /dev/null +++ b/.msync.yml @@ -0,0 +1,5 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +modulesync_config_version: '5.0.1' diff --git a/.overcommit.yml b/.overcommit.yml new file mode 100644 index 0000000..d367ada --- /dev/null +++ b/.overcommit.yml @@ -0,0 +1,65 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ +# +# Hooks are only enabled if you take action. +# +# To enable the hooks run: +# +# ``` +# bundle exec overcommit --install +# # ensure .overcommit.yml does not harm to you and then +# bundle exec overcommit --sign +# ``` +# +# (it will manage the .git/hooks directory): +# +# Examples howto skip a test for a commit or push: +# +# ``` +# SKIP=RuboCop git commit +# SKIP=PuppetLint git commit +# SKIP=RakeTask git push +# ``` +# +# Don't invoke overcommit at all: +# +# ``` +# OVERCOMMIT_DISABLE=1 git commit +# ``` +# +# Read more about overcommit: https://github.com/brigade/overcommit +# +# To manage this config yourself in your module add +# +# ``` +# .overcommit.yml: +# unmanaged: true +# ``` +# +# to your modules .sync.yml config +--- +PreCommit: + RuboCop: + enabled: true + description: 'Runs rubocop on modified files only' + command: ['bundle', 'exec', 'rubocop'] + PuppetLint: + enabled: true + description: 'Runs puppet-lint on modified files only' + command: ['bundle', 'exec', 'puppet-lint'] + YamlSyntax: + enabled: true + JsonSyntax: + enabled: true + TrailingWhitespace: + enabled: true + +PrePush: + RakeTarget: + enabled: true + description: 'Run rake targets' + targets: + - 'validate' + - 'test' + - 'rubocop' + command: ['bundle', 'exec', 'rake'] diff --git a/.pdkignore b/.pdkignore deleted file mode 100644 index e6215cd..0000000 --- a/.pdkignore +++ /dev/null @@ -1,42 +0,0 @@ -.git/ -.*.sw[op] -.metadata -.yardoc -.yardwarns -*.iml -/.bundle/ -/.idea/ -/.vagrant/ -/coverage/ -/bin/ -/doc/ -/Gemfile.local -/Gemfile.lock -/junit/ -/log/ -/pkg/ -/spec/fixtures/manifests/ -/spec/fixtures/modules/ -/tmp/ -/vendor/ -/convert_report.txt -/update_report.txt -.DS_Store -.project -.envrc -/inventory.yaml -/appveyor.yml -/.fixtures.yml -/Gemfile -/.gitattributes -/.gitignore -/.gitlab-ci.yml -/.pdkignore -/Rakefile -/rakelib/ -/.rspec -/.rubocop.yml -/.travis.yml -/.yardopts -/spec/ -/.vscode/ diff --git a/.pmtignore b/.pmtignore index fb58957..65f5051 100644 --- a/.pmtignore +++ b/.pmtignore @@ -1,11 +1,15 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + docs/ pkg/ +Gemfile Gemfile.lock Gemfile.local vendor/ .vendor/ -spec/fixtures/manifests/ -spec/fixtures/modules/ +spec/ +Rakefile .vagrant/ .bundle/ .ruby-version @@ -13,8 +17,21 @@ coverage/ log/ .idea/ .dependencies/ +.github/ .librarian/ Puppetfile.lock *.iml +.editorconfig +.fixtures.yml +.gitignore +.msync.yml +.overcommit.yml +.pmtignore +.rspec +.rspec_parallel +.rubocop.yml +.sync.yml .*.sw? .yardoc/ +.yardopts +Dockerfile diff --git a/.puppet-lint.rc b/.puppet-lint.rc index cc96ece..dd8272c 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1 +1,3 @@ ---relative +--fail-on-warnings +--no-parameter_documentation-check +--no-parameter_types-check diff --git a/.rspec b/.rspec index 16f9cdb..f634583 100644 --- a/.rspec +++ b/.rspec @@ -1,2 +1,5 @@ ---color +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + --format documentation +--color diff --git a/.rspec_parallel b/.rspec_parallel new file mode 100644 index 0000000..a9a84f8 --- /dev/null +++ b/.rspec_parallel @@ -0,0 +1,4 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +--format progress diff --git a/.rubocop.yml b/.rubocop.yml index 5307849..53ac189 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,137 +1,6 @@ --- -require: -- rubocop-rspec -- rubocop-i18n -AllCops: - DisplayCopNames: true - TargetRubyVersion: '2.1' - Include: - - "./**/*.rb" - Exclude: - - bin/* - - ".vendor/**/*" - - "**/Gemfile" - - "**/Rakefile" - - pkg/**/* - - spec/fixtures/**/* - - vendor/**/* - - "**/Puppetfile" - - "**/Vagrantfile" - - "**/Guardfile" -Metrics/LineLength: - Description: People have wide screens, use them. - Max: 200 -GetText: - Enabled: false -GetText/DecorateString: - Description: We don't want to decorate test output. - Exclude: - - spec/**/* - Enabled: false -RSpec/BeforeAfterAll: - Description: Beware of using after(:all) as it may cause state to leak between tests. - A necessary evil in acceptance testing. - Exclude: - - spec/acceptance/**/*.rb -RSpec/HookArgument: - Description: Prefer explicit :each argument, matching existing module's style - EnforcedStyle: each -Style/BlockDelimiters: - Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to - be consistent then. - EnforcedStyle: braces_for_chaining -Style/BracesAroundHashParameters: - Description: Braces are required by Ruby 2.7. Cop removed from RuboCop v0.80.0. - See https://github.com/rubocop-hq/rubocop/pull/7643 - Enabled: true -Style/ClassAndModuleChildren: - Description: Compact style reduces the required amount of indentation. - EnforcedStyle: compact -Style/EmptyElse: - Description: Enforce against empty else clauses, but allow `nil` for clarity. - EnforcedStyle: empty -Style/FormatString: - Description: Following the main puppet project's style, prefer the % format format. - EnforcedStyle: percent -Style/FormatStringToken: - Description: Following the main puppet project's style, prefer the simpler template - tokens over annotated ones. - EnforcedStyle: template -Style/Lambda: - Description: Prefer the keyword for easier discoverability. - EnforcedStyle: literal -Style/RegexpLiteral: - Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168 - EnforcedStyle: percent_r -Style/TernaryParentheses: - Description: Checks for use of parentheses around ternary conditions. Enforce parentheses - on complex expressions for better readability, but seriously consider breaking - it up. - EnforcedStyle: require_parentheses_when_complex -Style/TrailingCommaInArguments: - Description: Prefer always trailing comma on multiline argument lists. This makes - diffs, and re-ordering nicer. - EnforcedStyleForMultiline: comma -Style/TrailingCommaInLiteral: - Description: Prefer always trailing comma on multiline literals. This makes diffs, - and re-ordering nicer. - EnforcedStyleForMultiline: comma -Style/SymbolArray: - Description: Using percent style obscures symbolic intent of array's contents. - EnforcedStyle: brackets -RSpec/MessageSpies: - EnforcedStyle: receive -Style/Documentation: - Exclude: - - lib/puppet/parser/functions/**/* - - spec/**/* -Style/WordArray: - EnforcedStyle: brackets -Style/CollectionMethods: - Enabled: true -Style/MethodCalledOnDoEndBlock: - Enabled: true -Style/StringMethods: - Enabled: true -GetText/DecorateFunctionMessage: - Enabled: false -GetText/DecorateStringFormattingUsingInterpolation: - Enabled: false -GetText/DecorateStringFormattingUsingPercent: - Enabled: false -Layout/EndOfLine: - Enabled: false -Layout/IndentHeredoc: - Enabled: false -Metrics/AbcSize: - Enabled: false -Metrics/BlockLength: - Enabled: false -Metrics/ClassLength: - Enabled: false -Metrics/CyclomaticComplexity: - Enabled: false -Metrics/MethodLength: - Enabled: false -Metrics/ModuleLength: - Enabled: false -Metrics/ParameterLists: - Enabled: false -Metrics/PerceivedComplexity: - Enabled: false -RSpec/DescribeClass: - Enabled: false -RSpec/ExampleLength: - Enabled: false -RSpec/MessageExpectation: - Enabled: false -RSpec/MultipleExpectations: - Enabled: false -RSpec/NestedGroups: - Enabled: false -Style/AsciiComments: - Enabled: false -Style/IfUnlessModifier: - Enabled: false -Style/SymbolProc: - Enabled: false +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +inherit_gem: + voxpupuli-test: rubocop.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5388724..0000000 --- a/.travis.yml +++ /dev/null @@ -1,54 +0,0 @@ ---- -os: linux -dist: xenial -language: ruby -cache: bundler -before_install: - - bundle -v - - rm -f Gemfile.lock - - "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner" - - "# See https://github.com/puppetlabs/pdk-templates/commit/705154d5c437796b821691b707156e1b056d244f for an example of how this was used" - - "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set" - - '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION' - - gem --version - - bundle -v -script: - - 'bundle exec rake $CHECK' -bundler_args: --without system_tests -rvm: - - 2.5.7 -stages: - - static - - spec - - acceptance - - - if: tag =~ ^v\d - name: deploy -jobs: - fast_finish: true - include: - - - env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint" - stage: static - - - env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec - rvm: 2.4.5 - stage: spec - - - env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec - rvm: 2.5.7 - stage: spec - - - env: PUPPET_GEM_VERSION="~> 4.0" CHECK=parallel_spec - rvm: 2.1.9 - stage: spec - - - env: DEPLOY_TO_FORGE=yes - stage: deploy -branches: - only: - - master - - /^v\d/ - - develop -notifications: - email: false diff --git a/.yardopts b/.yardopts deleted file mode 100644 index 29c933b..0000000 --- a/.yardopts +++ /dev/null @@ -1 +0,0 @@ ---markup markdown diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e3cf307 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +# MANAGED BY MODULESYNC +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +FROM ruby:2.7 + +WORKDIR /opt/puppet + +# https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39 +RUN mkdir -p /etc/sv + +ARG PUPPET_VERSION="~> 6.0" +ARG PARALLEL_TEST_PROCESSORS=4 + +# Cache gems +COPY Gemfile . +RUN bundle install --without system_tests development release --path=${BUNDLE_PATH:-vendor/bundle} + +COPY . . + +RUN bundle install +RUN bundle exec rake release_checks + +# Container should not saved +RUN exit 1 diff --git a/Gemfile b/Gemfile index 8007ad0..4b2ffc0 100644 --- a/Gemfile +++ b/Gemfile @@ -1,72 +1,34 @@ -source ENV['GEM_SOURCE'] || 'https://rubygems.org' +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -def location_for(place_or_version, fake_version = nil) - git_url_regex = %r{\A(?(https?|git)[:@][^#]*)(#(?.*))?} - file_url_regex = %r{\Afile:\/\/(?.*)} +source ENV['GEM_SOURCE'] || "https://rubygems.org" - if place_or_version && (git_url = place_or_version.match(git_url_regex)) - [fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact - elsif place_or_version && (file_url = place_or_version.match(file_url_regex)) - ['>= 0', { path: File.expand_path(file_url[:path]), require: false }] - else - [place_or_version, { require: false }] - end +group :test do + gem 'voxpupuli-test', '~> 4.0', :require => false + gem 'coveralls', :require => false + gem 'simplecov-console', :require => false + gem 'puppet_metadata', '~> 1.0', :require => false end -ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments -minor_version = ruby_version_segments[0..1].join('.') - group :development do - gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0') - gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0') - gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0') - gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9') - gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "puppet-module-posix-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby] - gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby] - gem "puppet-module-win-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "puppet-module-win-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem 'guard-rake', :require => false + gem 'overcommit', '>= 0.39.1', :require => false end -puppet_version = ENV['PUPPET_GEM_VERSION'] -facter_version = ENV['FACTER_GEM_VERSION'] -hiera_version = ENV['HIERA_GEM_VERSION'] - -gems = {} - -gems['puppet'] = location_for(puppet_version) - -# If facter or hiera versions have been specified via the environment -# variables - -gems['facter'] = location_for(facter_version) if facter_version -gems['hiera'] = location_for(hiera_version) if hiera_version - -if Gem.win_platform? && puppet_version =~ %r{^(file:///|git://)} - # If we're using a Puppet gem on Windows which handles its own win32-xxx gem - # dependencies (>= 3.5.0), set the maximum versions (see PUP-6445). - gems['win32-dir'] = ['<= 0.4.9', require: false] - gems['win32-eventlog'] = ['<= 0.6.5', require: false] - gems['win32-process'] = ['<= 0.7.5', require: false] - gems['win32-security'] = ['<= 0.2.5', require: false] - gems['win32-service'] = ['0.8.8', require: false] +group :system_tests do + gem 'voxpupuli-acceptance', '~> 1.0', :require => false end -gems.each do |gem_name, gem_params| - gem gem_name, *gem_params +group :release do + gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' + gem 'voxpupuli-release', '>= 1.2.0', :require => false + gem 'puppet-strings', '>= 2.2', :require => false end -# Evaluate Gemfile.local and ~/.gemfile if they exist -extra_gemfiles = [ - "#{__FILE__}.local", - File.join(Dir.home, '.gemfile'), -] +gem 'rake', :require => false +gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] + +puppetversion = ENV['PUPPET_VERSION'] || '>= 6.0' +gem 'puppet', puppetversion, :require => false, :groups => [:test] -extra_gemfiles.each do |gemfile| - if File.file?(gemfile) && File.readable?(gemfile) - eval(File.read(gemfile), binding) - end -end # vim: syntax=ruby diff --git a/Rakefile b/Rakefile index 0a5093b..80b799d 100644 --- a/Rakefile +++ b/Rakefile @@ -1,87 +1,72 @@ -# frozen_string_literal: true +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any? -require 'puppetlabs_spec_helper/rake_tasks' -require 'puppet-syntax/tasks/puppet-syntax' -require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any? -require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any? -require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any? - -def changelog_user - return unless Rake.application.top_level_tasks.include? "changelog" - returnVal = nil || JSON.load(File.read('metadata.json'))['author'] - raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil? - puts "GitHubChangelogGenerator user:#{returnVal}" - returnVal +# Attempt to load voxupuli-test (which pulls in puppetlabs_spec_helper), +# otherwise attempt to load it directly. +begin + require 'voxpupuli/test/rake' +rescue LoadError + begin + require 'puppetlabs_spec_helper/rake_tasks' + rescue LoadError + end end -def changelog_project - return unless Rake.application.top_level_tasks.include? "changelog" +# load optional tasks for acceptance +# only available if gem group releases is installed +begin + require 'voxpupuli/acceptance/rake' +rescue LoadError +end - returnVal = nil - returnVal ||= begin - metadata_source = JSON.load(File.read('metadata.json'))['source'] - metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z}) +# load optional tasks for releases +# only available if gem group releases is installed +begin + require 'voxpupuli/release/rake_tasks' +rescue LoadError +end - metadata_source_match && metadata_source_match[1] +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 - - raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil? - - puts "GitHubChangelogGenerator project:#{returnVal}" - returnVal end -def changelog_future_release - return unless Rake.application.top_level_tasks.include? "changelog" - returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version'] - raise "unable to find the future_release (version) in metadata.json" if returnVal.nil? - puts "GitHubChangelogGenerator future_release:#{returnVal}" - returnVal +desc 'Generate REFERENCE.md' +task :reference, [:debug, :backtrace] do |t, args| + patterns = '' + Rake::Task['strings:generate:reference'].invoke(patterns, args[:debug], args[:backtrace]) end -PuppetLint.configuration.send('disable_relative') - -if Bundler.rubygems.find_name('github_changelog_generator').any? +begin + require 'github_changelog_generator/task' + require 'puppet_blacksmith' GitHubChangelogGenerator::RakeTask.new :changelog do |config| - raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil? - config.user = "#{changelog_user}" - config.project = "#{changelog_project}" - config.future_release = "#{changelog_future_release}" - config.exclude_labels = ['maintenance'] - config.header = "# Change log\n\nAll notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org)." - config.add_pr_wo_labels = true - config.issues = false - config.merge_prefix = "### UNCATEGORIZED PRS; LABEL THEM ON GITHUB" - config.configure_sections = { - "Changed" => { - "prefix" => "### Changed", - "labels" => ["backwards-incompatible"], - }, - "Added" => { - "prefix" => "### Added", - "labels" => ["enhancement", "feature"], - }, - "Fixed" => { - "prefix" => "### Fixed", - "labels" => ["bug", "documentation", "bugfix"], - }, - } + metadata = Blacksmith::Modulefile.new + config.future_release = "v#{metadata.version}" if metadata.version =~ /^\d+\.\d+.\d+$/ + 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' + config.project = metadata.metadata['name'] end -else - desc 'Generate a Changelog from GitHub' - task :changelog do - raise < 1.15' - condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')" -EOM + + # 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 -end +rescue LoadError +end +# vim: syntax=ruby diff --git a/spec/acceptance/nodesets/debian-82-x64.yml b/spec/acceptance/nodesets/debian-82-x64.yml deleted file mode 100644 index 8d9dc06..0000000 --- a/spec/acceptance/nodesets/debian-82-x64.yml +++ /dev/null @@ -1,11 +0,0 @@ -HOSTS: - debian-82-x64: - roles: - - master - platform: debian-8-amd64 - box : puppetlabs/debian-8.2-64-nocm - box_url : https://vagrantcloud.com/puppetlabs/boxes/debian-8.2-64-nocm - hypervisor : vagrant -CONFIG: - log_level: verbose - type: foss \ No newline at end of file diff --git a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml deleted file mode 100644 index cba1cd0..0000000 --- a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml +++ /dev/null @@ -1,11 +0,0 @@ -HOSTS: - ubuntu-server-1404-x64: - roles: - - master - platform: ubuntu-14.04-amd64 - box : puppetlabs/ubuntu-14.04-64-nocm - box_url : https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm - hypervisor : vagrant -CONFIG: - log_level : debug - type: git diff --git a/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml deleted file mode 100644 index 23d9f70..0000000 --- a/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml +++ /dev/null @@ -1,11 +0,0 @@ -HOSTS: - ubuntu-server-1604-x64: - roles: - - master - platform: ubuntu-16.04-amd64 - box : puppetlabs/ubuntu-16.04-64-nocm - box_url : https://vagrantcloud.com/puppetlabs/ubuntu-16.04-64-nocm - hypervisor : vagrant -CONFIG: - log_level: debug - type: git diff --git a/spec/default_facts.yml b/spec/default_facts.yml deleted file mode 100644 index f777abf..0000000 --- a/spec/default_facts.yml +++ /dev/null @@ -1,8 +0,0 @@ -# Use default_module_facts.yml for module specific facts. -# -# Facts specified here will override the values provided by rspec-puppet-facts. ---- -ipaddress: "172.16.254.254" -ipaddress6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA" -is_pe: false -macaddress: "AA:AA:AA:AA:AA:AA" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 16764b6..5a6deb9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,62 +1,21 @@ # frozen_string_literal: true +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + RSpec.configure do |c| c.mock_with :rspec end -require 'puppetlabs_spec_helper/module_spec_helper' -require 'rspec-puppet-facts' - -require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb')) - -include RspecPuppetFacts - -default_facts = { - puppetversion: Puppet.version, - facterversion: Facter.version, -} - -default_fact_files = [ - File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml')), - File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml')), -] - -default_fact_files.each do |f| - next unless File.exist?(f) && File.readable?(f) && File.size?(f) - - begin - default_facts.merge!(YAML.safe_load(File.read(f), [], [], true)) - rescue => e - RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}" - end -end - -# read default_facts and merge them over what is provided by facterdb -default_facts.each do |fact, value| - add_custom_fact fact, value -end +# puppetlabs_spec_helper will set up coverage if the env variable is set. +# We want to do this if lib exists and it hasn't been explicitly set. +ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../lib', __dir__)) -RSpec.configure do |c| - c.default_facts = default_facts - c.before :each do - # set to strictest setting for testing - # by default Puppet runs at warning level - Puppet.settings[:strict] = :warning - Puppet.settings[:strict_variables] = true - end - c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT'] - c.after(:suite) do - RSpec::Puppet::Coverage.report!(0) - end -end +require 'voxpupuli/test/spec_helper' -# Ensures that a module is defined -# @param module_name Name of the module -def ensure_module_defined(module_name) - module_name.split('::').reduce(Object) do |last_module, next_module| - last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false) - last_module.const_get(next_module, false) +if File.exist?(File.join(__dir__, 'default_module_facts.yml')) + facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) + facts&.each do |name, value| + add_custom_fact name.to_sym, value end end - -# 'spec_overrides' from sync.yml will appear below this line From 25d2ec72d0ce8d0f007798a9239de551a5847f2f Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 15 Dec 2021 20:36:08 +0100 Subject: [PATCH 16/92] modulesync 5.1.0 --- .msync.yml | 2 +- Gemfile | 2 +- Rakefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.msync.yml b/.msync.yml index ab186de..a83abd9 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.0.1' +modulesync_config_version: '5.1.0' diff --git a/Gemfile b/Gemfile index 4b2ffc0..b6dcf45 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" group :test do - gem 'voxpupuli-test', '~> 4.0', :require => false + gem 'voxpupuli-test', '~> 5.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 1.0', :require => false diff --git a/Rakefile b/Rakefile index 80b799d..f92f051 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -# Attempt to load voxupuli-test (which pulls in puppetlabs_spec_helper), +# Attempt to load voxpupuli-test (which pulls in puppetlabs_spec_helper), # otherwise attempt to load it directly. begin require 'voxpupuli/test/rake' From 47fd37346df89503cfa46edd515e02a82e72cfeb Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 2 Oct 2022 15:56:35 +0200 Subject: [PATCH 17/92] modulesync 5.3.0 --- .github/CONTRIBUTING.md | 7 +-- .github/workflows/ci.yml | 84 ++-------------------------- .github/workflows/release.yml | 32 ++++------- .msync.yml | 2 +- Dockerfile | 2 +- Gemfile | 6 +- Rakefile | 2 +- spec/acceptance/nodesets/default.yml | 11 ---- spec/spec_helper.rb | 2 + 9 files changed, 27 insertions(+), 121 deletions(-) delete mode 100644 spec/acceptance/nodesets/default.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 048d2b5..8b466cf 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -124,7 +124,7 @@ If you have Ruby 2.x or want a specific version of Puppet, you must set an environment variable such as: ```sh -export PUPPET_VERSION="~> 5.5.6" +export PUPPET_GEM_VERSION="~> 6.1.0" ``` You can install all needed gems for spec tests into the modules directory by @@ -232,17 +232,16 @@ simple tests against it after applying the module. You can run this with: ```sh -BEAKER_setfile=debian10-x64 bundle exec rake beaker +BEAKER_setfile=debian11-64 bundle exec rake beaker ``` You can replace the string `debian10` with any common operating system. The following strings are known to work: -* ubuntu1604 * ubuntu1804 * ubuntu2004 -* debian9 * debian10 +* debian11 * centos7 * centos8 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d08d05e..8a07791 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,84 +7,12 @@ name: CI on: pull_request concurrency: - group: ${{ github.head_ref }} + group: ${{ github.ref_name }} cancel-in-progress: true jobs: - setup_matrix: - name: 'Setup Test Matrix' - runs-on: ubuntu-latest - timeout-minutes: 40 - outputs: - puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} - github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }} - env: - BUNDLE_WITHOUT: development:system_tests:release - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - bundler-cache: true - - name: Run static validations - run: bundle exec rake validate lint check - - name: Run rake rubocop - run: bundle exec rake rubocop - - name: Setup Test Matrix - id: get-outputs - run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false - - unit: - needs: setup_matrix - runs-on: ubuntu-latest - timeout-minutes: 40 - strategy: - fail-fast: false - matrix: - include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}} - env: - BUNDLE_WITHOUT: development:system_tests:release - PUPPET_VERSION: "~> ${{ matrix.puppet }}.0" - name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }}) - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - name: Run tests - run: bundle exec rake parallel_spec - - acceptance: - needs: setup_matrix - runs-on: ubuntu-latest - env: - BUNDLE_WITHOUT: development:test:release - strategy: - fail-fast: false - matrix: - include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}} - name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }} - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - bundler-cache: true - - name: Run tests - run: bundle exec rake beaker - env: - BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }} - BEAKER_setfile: ${{ matrix.setfile.value }} - - tests: - needs: - - unit - - acceptance - runs-on: ubuntu-latest - name: Test suite - steps: - - run: echo Test suite completed + puppet: + name: Puppet + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1 + with: + pidfile_workaround: 'false' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 664ba69..15f1721 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,26 +9,14 @@ on: tags: - '*' -env: - BUNDLE_WITHOUT: development:test:system_tests - jobs: - deploy: - name: 'deploy to forge' - runs-on: ubuntu-latest - if: github.repository_owner == 'voxpupuli' - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7' - bundler-cache: true - - name: Build and Deploy - env: - # Configure secrets here: - # https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets - BLACKSMITH_FORGE_USERNAME: '${{ secrets.PUPPET_FORGE_USERNAME }}' - BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}' - run: bundle exec rake module:push + release: + name: Release + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1 + with: + allowed_owner: 'voxpupuli' + secrets: + # Configure secrets here: + # https://docs.github.com/en/actions/security-guides/encrypted-secrets + username: ${{ secrets.PUPPET_FORGE_USERNAME }} + api_key: ${{ secrets.PUPPET_FORGE_API_KEY }} diff --git a/.msync.yml b/.msync.yml index a83abd9..0235385 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.1.0' +modulesync_config_version: '5.3.0' diff --git a/Dockerfile b/Dockerfile index e3cf307..8dd82d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ WORKDIR /opt/puppet # https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39 RUN mkdir -p /etc/sv -ARG PUPPET_VERSION="~> 6.0" +ARG PUPPET_GEM_VERSION="~> 6.0" ARG PARALLEL_TEST_PROCESSORS=4 # Cache gems diff --git a/Gemfile b/Gemfile index b6dcf45..07209b7 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,10 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -source ENV['GEM_SOURCE'] || "https://rubygems.org" +source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 5.0', :require => false + gem 'voxpupuli-test', '~> 5.4', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 1.0', :require => false @@ -28,7 +28,7 @@ end gem 'rake', :require => false gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_VERSION'] || '>= 6.0' +puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby diff --git a/Rakefile b/Rakefile index f92f051..4bd934b 100644 --- a/Rakefile +++ b/Rakefile @@ -52,7 +52,7 @@ 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' - config.project = metadata.metadata['name'] + config.project = 'puppet-monit' end # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml deleted file mode 100644 index ce47212..0000000 --- a/spec/acceptance/nodesets/default.yml +++ /dev/null @@ -1,11 +0,0 @@ -HOSTS: - centos-64-x64: - roles: - - master - platform: el-6-x86_64 - box : centos-64-x64-vbox4210-nocm - box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box - hypervisor : vagrant -CONFIG: - log_level: debug - type: git diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5a6deb9..565248c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,6 +13,8 @@ require 'voxpupuli/test/spec_helper' +add_mocked_facts! + if File.exist?(File.join(__dir__, 'default_module_facts.yml')) facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) facts&.each do |name, value| From f1d95f1a27fb9d8f3fae9d88b899917eac6ab403 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 20 Dec 2022 16:24:43 +0100 Subject: [PATCH 18/92] modulesync 5.4.0 --- .msync.yml | 2 +- Gemfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.msync.yml b/.msync.yml index 0235385..f3156d1 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.3.0' +modulesync_config_version: '5.4.0' diff --git a/Gemfile b/Gemfile index 07209b7..b3827ba 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ group :test do gem 'voxpupuli-test', '~> 5.4', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 1.0', :require => false + gem 'puppet_metadata', '~> 2.0', :require => false end group :development do From 5335764a9e4ec4c868a2f77630db6e0b671cd909 Mon Sep 17 00:00:00 2001 From: Massimiliano Adamo Date: Sat, 15 Apr 2023 10:00:48 +0200 Subject: [PATCH 19/92] modulesync 5.5.0 --- .github/SECURITY.md | 3 --- .gitignore | 36 ++++++++++++------------- .msync.yml | 2 +- .pmtignore | 64 ++++++++++++++++++++++----------------------- Gemfile | 3 +-- Rakefile | 36 +++---------------------- 6 files changed, 56 insertions(+), 88 deletions(-) delete mode 100644 .github/SECURITY.md diff --git a/.github/SECURITY.md b/.github/SECURITY.md deleted file mode 100644 index cacadf2..0000000 --- a/.github/SECURITY.md +++ /dev/null @@ -1,3 +0,0 @@ -# Vox Pupuli Security Policy - -Our vulnerabilities reporting process is at https://voxpupuli.org/security/ diff --git a/.gitignore b/.gitignore index 9b95224..84fd904 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,23 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -pkg/ -Gemfile.lock -Gemfile.local -vendor/ -.vendor/ -spec/fixtures/manifests/ -spec/fixtures/modules/ -.vagrant/ -.bundle/ -.ruby-version -coverage/ -log/ -.idea/ -.dependencies/ -.librarian/ -Puppetfile.lock +/pkg/ +/Gemfile.lock +/Gemfile.local +/vendor/ +/.vendor/ +/spec/fixtures/manifests/ +/spec/fixtures/modules/ +/.vagrant/ +/.bundle/ +/.ruby-version +/coverage/ +/log/ +/.idea/ +/.dependencies/ +/.librarian/ +/Puppetfile.lock *.iml .*.sw? -.yardoc/ -Guardfile +/.yardoc/ +/Guardfile diff --git a/.msync.yml b/.msync.yml index f3156d1..a4b0069 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.4.0' +modulesync_config_version: '5.5.0' diff --git a/.pmtignore b/.pmtignore index 65f5051..58a0408 100644 --- a/.pmtignore +++ b/.pmtignore @@ -1,37 +1,37 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -docs/ -pkg/ -Gemfile -Gemfile.lock -Gemfile.local -vendor/ -.vendor/ -spec/ -Rakefile -.vagrant/ -.bundle/ -.ruby-version -coverage/ -log/ -.idea/ -.dependencies/ -.github/ -.librarian/ -Puppetfile.lock +/docs/ +/pkg/ +/Gemfile +/Gemfile.lock +/Gemfile.local +/vendor/ +/.vendor/ +/spec/ +/Rakefile +/.vagrant/ +/.bundle/ +/.ruby-version +/coverage/ +/log/ +/.idea/ +/.dependencies/ +/.github/ +/.librarian/ +/Puppetfile.lock *.iml -.editorconfig -.fixtures.yml -.gitignore -.msync.yml -.overcommit.yml -.pmtignore -.rspec -.rspec_parallel -.rubocop.yml -.sync.yml +/.editorconfig +/.fixtures.yml +/.gitignore +/.msync.yml +/.overcommit.yml +/.pmtignore +/.rspec +/.rspec_parallel +/.rubocop.yml +/.sync.yml .*.sw? -.yardoc/ -.yardopts -Dockerfile +/.yardoc/ +/.yardopts +/Dockerfile diff --git a/Gemfile b/Gemfile index b3827ba..15313c3 100644 --- a/Gemfile +++ b/Gemfile @@ -21,8 +21,7 @@ end group :release do gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' - gem 'voxpupuli-release', '>= 1.2.0', :require => false - gem 'puppet-strings', '>= 2.2', :require => false + gem 'voxpupuli-release', '~> 2.0', :require => false end gem 'rake', :require => false diff --git a/Rakefile b/Rakefile index 4bd934b..a9f7934 100644 --- a/Rakefile +++ b/Rakefile @@ -24,6 +24,10 @@ end begin require 'voxpupuli/release/rake_tasks' rescue LoadError + # voxpupuli-release not present +else + GCGConfig.user = 'voxpupuli' + GCGConfig.project = 'puppet-monit' end desc "Run main 'test' task and report merged results to coveralls" @@ -37,36 +41,4 @@ task test_with_coveralls: [:test] do end end -desc 'Generate REFERENCE.md' -task :reference, [:debug, :backtrace] do |t, args| - patterns = '' - Rake::Task['strings:generate:reference'].invoke(patterns, args[:debug], args[:backtrace]) -end - -begin - require 'github_changelog_generator/task' - require 'puppet_blacksmith' - GitHubChangelogGenerator::RakeTask.new :changelog do |config| - metadata = Blacksmith::Modulefile.new - config.future_release = "v#{metadata.version}" if metadata.version =~ /^\d+\.\d+.\d+$/ - 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' - config.project = 'puppet-monit' - 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 From fe0086ab02c299c51b18fa7d04242e12c3d2f963 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 12 May 2023 12:46:34 +0200 Subject: [PATCH 20/92] modulesync 6.0.0 --- .msync.yml | 2 +- Gemfile | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.msync.yml b/.msync.yml index a4b0069..b929160 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.5.0' +modulesync_config_version: '6.0.0' diff --git a/Gemfile b/Gemfile index 15313c3..98a04cf 100644 --- a/Gemfile +++ b/Gemfile @@ -4,10 +4,10 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 5.4', :require => false + gem 'voxpupuli-test', '~> 6.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 2.0', :require => false + gem 'puppet_metadata', '~> 3.0', :require => false end group :development do @@ -16,18 +16,19 @@ group :development do end group :system_tests do - gem 'voxpupuli-acceptance', '~> 1.0', :require => false + gem 'voxpupuli-acceptance', '~> 2.0', :require => false end group :release do - gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' - gem 'voxpupuli-release', '~> 2.0', :require => false + gem 'github_changelog_generator', '>= 1.16.1', :require => false + gem 'voxpupuli-release', '~> 3.0', :require => false + gem 'faraday-retry', '~> 2.1', :require => false end gem 'rake', :require => false gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0' +puppetversion = ENV['PUPPET_GEM_VERSION'] || '~> 7.24' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby From 22acd28a8b0ab2c994aa5d150efd6e24c3fe27e0 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 17 Aug 2023 16:32:58 +0200 Subject: [PATCH 21/92] modulesync 7.0.0 --- .github/CONTRIBUTING.md | 11 +++++++---- .msync.yml | 2 +- Gemfile | 2 +- spec/spec_helper.rb | 1 + 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8b466cf..6aaa603 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -232,18 +232,21 @@ simple tests against it after applying the module. You can run this with: ```sh -BEAKER_setfile=debian11-64 bundle exec rake beaker +BEAKER_PUPPET_COLLECTION=puppet7 BEAKER_setfile=debian11-64 bundle exec rake beaker ``` -You can replace the string `debian10` with any common operating system. +You can replace the string `debian11` with any common operating system. The following strings are known to work: -* ubuntu1804 * ubuntu2004 -* debian10 +* ubuntu2204 * debian11 * centos7 * centos8 +* centos9 +* almalinux8 +* almalinux9 +* fedora36 For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests). diff --git a/.msync.yml b/.msync.yml index b929160..dd3e957 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '6.0.0' +modulesync_config_version: '7.0.0' diff --git a/Gemfile b/Gemfile index 98a04cf..db21d3b 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 6.0', :require => false + gem 'voxpupuli-test', '~> 7.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 3.0', :require => false diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 565248c..7b6a562 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -21,3 +21,4 @@ add_custom_fact name.to_sym, value end end +Dir['./spec/support/spec/**/*.rb'].sort.each { |f| require f } From f768f0800021dbb4790287f60ef0860de6eb837a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 18 Aug 2023 08:23:58 +0200 Subject: [PATCH 22/92] rubocop: autofix --- .rubocop.yml | 2 + .rubocop_todo.yml | 27 ++++++++++ spec/classes/init_spec.rb | 70 +++++++++++++------------- spec/defines/check_spec.rb | 19 +++---- spec/unit/facter/monit_version_spec.rb | 8 +-- 5 files changed, 79 insertions(+), 47 deletions(-) create mode 100644 .rubocop_todo.yml diff --git a/.rubocop.yml b/.rubocop.yml index 53ac189..ea22bff 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,4 +1,6 @@ --- +inherit_from: .rubocop_todo.yml + # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 0000000..6db939c --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,27 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2023-08-17 21:35:05 UTC using RuboCop version 1.50.2. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 6 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/CommentedKeyword: + Exclude: + - 'spec/classes/init_spec.rb' + - 'spec/defines/check_spec.rb' + +# Offense count: 6 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, always_true, never +Style/FrozenStringLiteralComment: + Exclude: + - 'lib/facter/monit_version.rb' + - 'spec/acceptance/class_spec.rb' + - 'spec/classes/init_spec.rb' + - 'spec/defines/check_spec.rb' + - 'spec/spec_helper_acceptance.rb' + - 'spec/unit/facter/monit_version_spec.rb' diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index f6dbe0f..de5bdc4 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -74,8 +74,8 @@ if facts[:osfamily] == 'Debian' it do - is_expected.to contain_file('/etc/default/monit').with('notify' => 'Service[monit]') - .with_content(%r{^#{default_file_content}$}) + is_expected.to contain_file('/etc/default/monit').with('notify' => 'Service[monit]'). + with_content(%r{^#{default_file_content}$}) end else it { is_expected.not_to contain_file('/etc/default/monit') } @@ -233,11 +233,11 @@ end content = <<-END.gsub(%r{^\s+\|}, '') - |set mail-format \{ - | from: monit\@test.local - | message: Monit \$ACTION \$SERVICE at \$DATE on \$HOST: \$DESCRIPTION + |set mail-format { + | from: monit@test.local + | message: Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION | subject: spectesting - |\} + |} END it { is_expected.to contain_file('monit_config').with_content(%r{#{Regexp.escape(content)}}) } end @@ -340,9 +340,9 @@ end it 'fails' do - expect { + expect do is_expected.to contain_class('monit') - }.to raise_error(Puppet::PreformattedError, %r{expects an Integer\[1, 65535\] value}) + end.to raise_error(Puppet::PreformattedError, %r{expects an Integer\[1, 65535\] value}) end end end @@ -351,9 +351,9 @@ let(:params) { { check_interval: 0 } } it 'fails' do - expect { + expect do is_expected.to contain_class('monit') - }.to raise_error(Puppet::PreformattedError, %r{expects an Integer\[1}) + end.to raise_error(Puppet::PreformattedError, %r{expects an Integer\[1}) end end @@ -361,9 +361,9 @@ let(:params) { { start_delay: 0 } } it 'fails' do - expect { + expect do is_expected.to contain_class('monit') - }.to raise_error(Puppet::PreformattedError, %r{expects a value of type Undef or Integer\[1}) + end.to raise_error(Puppet::PreformattedError, %r{expects a value of type Undef or Integer\[1}) end end @@ -376,9 +376,9 @@ end it 'fails' do - expect { + expect do is_expected.to contain_class('monit') - }.to raise_error(Puppet::Error, %r{monit supports Amazon Linux 2\. Detected operatingsystemmajrelease is <3>}) + end.to raise_error(Puppet::Error, %r{monit supports Amazon Linux 2\. Detected operatingsystemmajrelease is <3>}) end end @@ -391,9 +391,9 @@ end it 'fails' do - expect { + expect do is_expected.to contain_class('monit') - }.to raise_error(Puppet::Error, %r{monit supports EL 5, 6 and 7\. Detected operatingsystemmajrelease is <4>}) + end.to raise_error(Puppet::Error, %r{monit supports EL 5, 6 and 7\. Detected operatingsystemmajrelease is <4>}) end end @@ -406,9 +406,9 @@ end it 'fails' do - expect { + expect do is_expected.to contain_class('monit') - }.to raise_error(Puppet::Error, %r{monit supports Debian 6 \(squeeze\), 7 \(wheezy\), 8 \(jessie\), 9 \(stretch\) and 10 \(buster\) \ + end.to raise_error(Puppet::Error, %r{monit supports Debian 6 \(squeeze\), 7 \(wheezy\), 8 \(jessie\), 9 \(stretch\) and 10 \(buster\) \ and Ubuntu 10\.04 \(lucid\), 12\.04 \(precise\), 14\.04 \(trusty\), 16\.04 \(xenial\) and 18\.04 \(bionic\)\. \ Detected lsbdistcodename is \.}) end @@ -423,9 +423,9 @@ end it 'fails' do - expect { + expect do is_expected.to contain_class('monit') - }.to raise_error(Puppet::Error, %r{monit supports Debian 6 \(squeeze\), 7 \(wheezy\), 8 \(jessie\), 9 \(stretch\) and 10 \(buster\) \ + end.to raise_error(Puppet::Error, %r{monit supports Debian 6 \(squeeze\), 7 \(wheezy\), 8 \(jessie\), 9 \(stretch\) and 10 \(buster\) \ and Ubuntu 10\.04 \(lucid\), 12\.04 \(precise\), 14\.04 \(trusty\), 16\.04 \(xenial\) and 18\.04 \(bionic\). \ Detected lsbdistcodename is \.}) end @@ -439,9 +439,9 @@ end it 'fails' do - expect { + expect do is_expected.to contain_class('monit') - }.to raise_error(Puppet::Error, %r{monit supports osfamilies Debian and RedHat\. Detected osfamily is \.}) + end.to raise_error(Puppet::Error, %r{monit supports osfamilies Debian and RedHat\. Detected osfamily is \.}) end end end @@ -459,31 +459,31 @@ end let(:validation_params) do { - #:param => 'value', + # :param => 'value', } end validations = { 'absolute_path' => { - name: ['config_file', 'config_dir'], + name: %w[config_file config_dir], valid: ['/absolute/filepath', '/absolute/directory/'], invalid: ['invalid', 3, 2.42, ['array'], { 'ha' => 'sh' }], message: '(expects a String value|is not an absolute path)', }, 'array' => { name: ['alert_emails'], - valid: [['valid', 'array']], + valid: [%w[valid array]], invalid: ['string', { 'ha' => 'sh' }, 3, 2.42, true], message: 'expects an Array value', }, 'bool_stringified' => { - name: ['httpd', 'manage_firewall', 'service_enable', 'service_manage', 'mmonit_https', 'mmonit_without_credential', 'config_dir_purge'], + name: %w[httpd manage_firewall service_enable service_manage mmonit_https mmonit_without_credential config_dir_purge], valid: [true, 'true', false, 'false'], invalid: ['invalid', 3, 2.42, ['array'], { 'ha' => 'sh' }, nil], message: 'expects a value of type Boolean or Enum', }, 'integer' => { - name: ['check_interval', 'httpd_port', 'mmonit_port'], + name: %w[check_interval httpd_port mmonit_port], valid: [242], invalid: [2.42, 'invalid', ['array'], { 'ha' => 'sh ' }, true, false, nil], message: 'expects an Integer', @@ -507,15 +507,15 @@ message: 'expects a value of type Undef or Hash', }, 'optional_string' => { - name: ['mailserver', 'mmonit_address'], + name: %w[mailserver mmonit_address], valid: ['present'], invalid: [['array'], { 'ha' => 'sh' }], message: 'expects a value of type Undef or String', }, 'string' => { - name: ['httpd_address', 'httpd_allow', 'httpd_user', 'httpd_password', - 'package_ensure', 'package_name', 'service_name', 'mmonit_user', - 'mmonit_password'], + name: %w[httpd_address httpd_allow httpd_user httpd_password + package_ensure package_name service_name mmonit_user + mmonit_password], valid: ['present'], invalid: [['array'], { 'ha' => 'sh' }], message: 'expects a String value', @@ -532,7 +532,7 @@ var[:name].each do |var_name| var[:valid].each do |valid| context "with #{var_name} (#{type}) set to valid #{valid} (as #{valid.class})" do - let(:params) { validation_params.merge(:"#{var_name}" => valid) } + let(:params) { validation_params.merge("#{var_name}": valid) } it { is_expected.to compile } end @@ -540,12 +540,12 @@ var[:invalid].each do |invalid| context "with #{var_name} (#{type}) set to invalid #{invalid} (as #{invalid.class})" do - let(:params) { validation_params.merge(:"#{var_name}" => invalid) } + let(:params) { validation_params.merge("#{var_name}": invalid) } it 'fails' do - expect { + expect do catalogue - }.to raise_error(Puppet::Error, %r{#{var[:message]}}) + end.to raise_error(Puppet::Error, %r{#{var[:message]}}) end end end diff --git a/spec/defines/check_spec.rb b/spec/defines/check_spec.rb index 1ec49e5..f988054 100644 --- a/spec/defines/check_spec.rb +++ b/spec/defines/check_spec.rb @@ -16,6 +16,7 @@ context 'with default values for parameters' do it { is_expected.to compile.with_all_deps } it { is_expected.to contain_class('monit') } + it do is_expected.to contain_file('/etc/monit/conf.d/test').with('ensure' => 'present', 'owner' => 'root', @@ -28,7 +29,7 @@ end end - ['absent', 'present'].each do |value| + %w[absent present].each do |value| context "with ensure set to valid <#{value}>" do let(:params) do { @@ -103,9 +104,9 @@ end it 'fails' do - expect { + expect do catalogue - }.to raise_error(Puppet::Error, %r{Parameters source and content are mutually exclusive}) + end.to raise_error(Puppet::Error, %r{Parameters source and content are mutually exclusive}) end end @@ -120,14 +121,14 @@ end let(:validation_params) do { - #:param => 'value', + # :param => 'value', } end validations = { 'regex_file_ensure' => { name: ['ensure'], - valid: ['present', 'absent'], + valid: %w[present absent], invalid: ['file', 'directory', 'link', ['array'], { 'ha' => 'sh' }, 3, 2.42, true, false, nil], message: 'match for Enum\[\'absent\', \'present\'\]', }, @@ -149,7 +150,7 @@ var[:name].each do |var_name| var[:valid].each do |valid| context "with #{var_name} (#{type}) set to valid #{valid} (as #{valid.class})" do - let(:params) { validation_params.merge(:"#{var_name}" => valid) } + let(:params) { validation_params.merge("#{var_name}": valid) } it { is_expected.to compile } end @@ -157,12 +158,12 @@ var[:invalid].each do |invalid| context "with #{var_name} (#{type}) set to invalid #{invalid} (as #{invalid.class})" do - let(:params) { validation_params.merge(:"#{var_name}" => invalid) } + let(:params) { validation_params.merge("#{var_name}": invalid) } it 'fails' do - expect { + expect do catalogue - }.to raise_error(Puppet::PreformattedError, %r{expects a #{var[:message]}}) + end.to raise_error(Puppet::PreformattedError, %r{expects a #{var[:message]}}) end end end diff --git a/spec/unit/facter/monit_version_spec.rb b/spec/unit/facter/monit_version_spec.rb index 8f64ccf..56ea2c4 100644 --- a/spec/unit/facter/monit_version_spec.rb +++ b/spec/unit/facter/monit_version_spec.rb @@ -1,23 +1,25 @@ require 'spec_helper' describe 'Facter::Util::Fact' do - before(:each) do + before do Facter.clear end context 'with monit v5.14 installed' do - before :each do + before do allow(Facter::Util::Resolution).to receive(:exec).with('monit -V 2>&1').and_return("This is Monit version 5.14\nCopyright (C) 2001-2015 Tildeslash Ltd. All Rights Reserved.") end + it 'returns 5.14' do expect(Facter.fact(:monit_version).value).to eq('5.14') end end context 'with monit not installed' do - before :each do + before do allow(Facter::Util::Resolution).to receive(:exec).with('monit -V 2>&1').and_return(nil) end + it 'is nil' do expect(Facter.fact(:monit_version).value).to be_nil end From 211c444e66cafc2ef720dfc5510167215d0fdb83 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 15 Dec 2023 13:23:29 +0100 Subject: [PATCH 23/92] modulesync 7.2.0 --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- .msync.yml | 2 +- .pmtignore | 1 + .rubocop.yml | 3 +-- Gemfile | 8 +++----- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a07791..b66d8ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,6 @@ concurrency: jobs: puppet: name: Puppet - uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1 + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2 with: pidfile_workaround: 'false' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 15f1721..55324aa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ on: jobs: release: name: Release - uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1 + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v2 with: allowed_owner: 'voxpupuli' secrets: diff --git a/.msync.yml b/.msync.yml index dd3e957..f818344 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '7.0.0' +modulesync_config_version: '7.2.0' diff --git a/.pmtignore b/.pmtignore index 58a0408..10b9830 100644 --- a/.pmtignore +++ b/.pmtignore @@ -35,3 +35,4 @@ /.yardoc/ /.yardopts /Dockerfile +/HISTORY.md diff --git a/.rubocop.yml b/.rubocop.yml index ea22bff..fded90c 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,8 +1,7 @@ --- -inherit_from: .rubocop_todo.yml - # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ +inherit_from: .rubocop_todo.yml inherit_gem: voxpupuli-test: rubocop.yml diff --git a/Gemfile b/Gemfile index db21d3b..a4a3b20 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ group :test do gem 'voxpupuli-test', '~> 7.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 3.0', :require => false + gem 'puppet_metadata', '~> 3.5', :require => false end group :development do @@ -16,13 +16,11 @@ group :development do end group :system_tests do - gem 'voxpupuli-acceptance', '~> 2.0', :require => false + gem 'voxpupuli-acceptance', '~> 3.0', :require => false end group :release do - gem 'github_changelog_generator', '>= 1.16.1', :require => false - gem 'voxpupuli-release', '~> 3.0', :require => false - gem 'faraday-retry', '~> 2.1', :require => false + gem 'voxpupuli-release', '~> 3.0', :require => false end gem 'rake', :require => false From cc82e0441b222f4d3e6e6ac81e8e0168d7d49960 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Sun, 4 Feb 2024 13:37:08 +0100 Subject: [PATCH 24/92] regenerate reference --- REFERENCE.md | 137 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 88 insertions(+), 49 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 08bac43..757e6d3 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -20,11 +20,11 @@ ### Defined types -* [`monit::check`](#monitcheck): Adds a Monit check. +* [`monit::check`](#monit--check): Adds a Monit check. ## Classes -### `monit` +### `monit` Main class, includes all other classes. @@ -38,9 +38,38 @@ class { 'monit': } #### Parameters -The following parameters are available in the `monit` class. - -##### `alert_emails` +The following parameters are available in the `monit` class: + +* [`alert_emails`](#-monit--alert_emails) +* [`check_interval`](#-monit--check_interval) +* [`config_file`](#-monit--config_file) +* [`config_dir`](#-monit--config_dir) +* [`config_dir_purge`](#-monit--config_dir_purge) +* [`httpd`](#-monit--httpd) +* [`httpd_port`](#-monit--httpd_port) +* [`httpd_address`](#-monit--httpd_address) +* [`httpd_allow`](#-monit--httpd_allow) +* [`httpd_user`](#-monit--httpd_user) +* [`httpd_password`](#-monit--httpd_password) +* [`logfile`](#-monit--logfile) +* [`mailserver`](#-monit--mailserver) +* [`mailformat`](#-monit--mailformat) +* [`manage_firewall`](#-monit--manage_firewall) +* [`mmonit_address`](#-monit--mmonit_address) +* [`mmonit_https`](#-monit--mmonit_https) +* [`mmonit_port`](#-monit--mmonit_port) +* [`mmonit_user`](#-monit--mmonit_user) +* [`mmonit_password`](#-monit--mmonit_password) +* [`mmonit_without_credential`](#-monit--mmonit_without_credential) +* [`package_ensure`](#-monit--package_ensure) +* [`package_name`](#-monit--package_name) +* [`service_ensure`](#-monit--service_ensure) +* [`service_manage`](#-monit--service_manage) +* [`service_name`](#-monit--service_name) +* [`start_delay`](#-monit--start_delay) +* [`service_enable`](#-monit--service_enable) + +##### `alert_emails` Data type: `Array[String]` @@ -48,15 +77,15 @@ Specifies one or more email addresses to send global alerts to. Default value: [ Default value: `$monit::params::alert_emails` -##### `check_interval` +##### `check_interval` -Data type: `Integer[0]` +Data type: `Integer[1]` Specifies the interval between two checks of Monit. Default value: 120 Default value: `$monit::params::check_interval` -##### `config_file` +##### `config_file` Data type: `String` @@ -64,7 +93,7 @@ Specifies a path to the main config file. Default value: varies with operating s Default value: `$monit::params::config_file` -##### `config_dir` +##### `config_dir` Data type: `String` @@ -72,7 +101,7 @@ Specifies a path to the config directory. Default value: varies with operating s Default value: `$monit::params::config_dir` -##### `config_dir_purge` +##### `config_dir_purge` Data type: `Variant[Boolean, Enum['true', 'false']]` @@ -80,7 +109,7 @@ Specifies if unmanaged files in the config directory should be purged. Default v Default value: `$monit::params::config_dir_purge` -##### `httpd` +##### `httpd` Data type: `Variant[Boolean, Enum['true', 'false']]` @@ -88,15 +117,15 @@ Specifies whether to enable the Monit Dashboard. Default value: 'false' Default value: `$monit::params::httpd` -##### `httpd_port` +##### `httpd_port` -Data type: `Integer[0, 65535]` +Data type: `Integer[1, 65535]` Specifies the port of the Monit Dashboard. Default value: 2812 Default value: `$monit::params::httpd_port` -##### `httpd_address` +##### `httpd_address` Data type: `String` @@ -104,7 +133,7 @@ Specifies the IP address of the Monit Dashboard. Default value: 'locahost' Default value: `$monit::params::httpd_address` -##### `httpd_allow` +##### `httpd_allow` Data type: `String` @@ -112,7 +141,7 @@ Specifies the allow option of the Monit Dashboard. Default value: '0.0.0.0/0.0.0 Default value: `$monit::params::httpd_allow` -##### `httpd_user` +##### `httpd_user` Data type: `String` @@ -120,7 +149,7 @@ Specifies the user to access the Monit Dashboard. Default value: 'admin' Default value: `$monit::params::httpd_user` -##### `httpd_password` +##### `httpd_password` Data type: `String` @@ -128,16 +157,16 @@ Specifies the password to access the Monit Dashboard. Default value: 'monit' Default value: `$monit::params::httpd_password` -##### `logfile` +##### `logfile` -Data type: `String` +Data type: `Optional[String]` Specifies the logfile directive value. Default value: '/var/log/monit.log' It is possible to use syslog instead of direct file logging. (e.g. 'syslog facility log\_daemon') Default value: `$monit::params::logfile` -##### `mailserver` +##### `mailserver` Data type: `Optional[String]` @@ -146,7 +175,7 @@ For more details, see: https://mmonit.com/monit/documentation/monit.html#Setting Default value: `$monit::params::mailserver` -##### `mailformat` +##### `mailformat` Data type: `Optional[Hash]` @@ -155,24 +184,26 @@ For more details, see: https://mmonit.com/monit/documentation/monit.html#Message Default value: `$monit::params::mailformat` -##### `manage_firewall` +##### `manage_firewall` Data type: `Variant[Boolean, Enum['true', 'false']]` -If true and if puppetlabs-firewall module is present, Puppet manages firewall to allow HTTP access for Monit Dashboard. Default value: 'false' +If true and if puppetlabs-firewall module is present, Puppet manages firewall to allow HTTP access for Monit Dashboard. +Default value: 'false' Default value: `$monit::params::manage_firewall` -##### `mmonit_address` +##### `mmonit_address` Data type: `Optional[String]` *Requires at least Monit 5.0*
-Specifies the remote address of an M/Monit server to be used by Monit agent for report. If set to undef, M/Monit connection is disabled. Default value: undef +Specifies the remote address of an M/Monit server to be used by Monit agent for report. If set to undef, M/Monit connection is disabled. +Default value: undef Default value: `$monit::params::mmonit_address` -##### `mmonit_https` +##### `mmonit_https` Data type: `Variant[Boolean, Enum['true', 'false']]` @@ -181,16 +212,16 @@ Specifies wheither the protocol of the M/Monit server is HTTPs. Default value: ' Default value: `$monit::params::mmonit_https` -##### `mmonit_port` +##### `mmonit_port` -Data type: `Integer[0, 65535]` +Data type: `Integer[1, 65535]` *Requires at least Monit 5.0*
Specifies the remote port of the M/Monit server. Default value: 8443 Default value: `$monit::params::mmonit_port` -##### `mmonit_user` +##### `mmonit_user` Data type: `String` @@ -200,7 +231,7 @@ If you set both user and password to an empty string, authentication is disabled Default value: `$monit::params::mmonit_user` -##### `mmonit_password` +##### `mmonit_password` Data type: `String` @@ -210,24 +241,28 @@ If you set both user and password to an empty string, authentication is disabled Default value: `$monit::params::mmonit_password` -##### `mmonit_without_credential` +##### `mmonit_without_credential` Data type: `Variant[Boolean, Enum['true', 'false']]` *Requires at least Monit 5.0*
-By default Monit registers credentials with M/Monit so M/Monit can smoothly communicate back to Monit and you don't have to register Monit credentials manually in M/Monit. It is possible to disable credential registration setting this option to 'true'. Default value: 'false' +By default Monit registers credentials with M/Monit so M/Monit can smoothly communicate back to Monit and you don't have to register +Monit credentials manually in M/Monit. It is possible to disable credential registration setting this option to 'true'. +Default value: 'false' Default value: `$monit::params::mmonit_without_credential` -##### `package_ensure` +##### `package_ensure` Data type: `String` -Tells Puppet whether the Monit package should be installed, and what version. Valid options: 'present', 'latest', or a specific version number. Default value: 'present' +Tells Puppet whether the Monit package should be installed, and what version. +Valid options: 'present', 'latest', or a specific version number. +Default value: 'present' Default value: `$monit::params::package_ensure` -##### `package_name` +##### `package_name` Data type: `String` @@ -235,7 +270,7 @@ Tells Puppet what Monit package to manage. Default value: 'monit' Default value: `$monit::params::package_name` -##### `service_ensure` +##### `service_ensure` Data type: `Enum['running', 'stopped']` @@ -243,7 +278,7 @@ Tells Puppet whether the Monit service should be running. Default value: 'runnin Default value: `$monit::params::service_ensure` -##### `service_manage` +##### `service_manage` Data type: `Variant[Boolean, Enum['true', 'false']]` @@ -251,7 +286,7 @@ Tells Puppet whether to manage the Monit service. Default value: 'true' Default value: `$monit::params::service_manage` -##### `service_name` +##### `service_name` Data type: `String` @@ -259,16 +294,16 @@ Tells Puppet what Monit service to manage. Default value: 'monit' Default value: `$monit::params::service_name` -##### `start_delay` +##### `start_delay` -Data type: `Integer[0]` +Data type: `Optional[Integer[1]]` *Requires at least Monit 5.0* -If set, Monit will wait the specified time in seconds before it starts checking services. Default value: 0 +If set, Monit will wait the specified time in seconds before it starts checking services. Default value: undef Default value: `$monit::params::start_delay` -##### `service_enable` +##### `service_enable` Data type: `Variant[Boolean, Enum['true', 'false']]` @@ -278,23 +313,27 @@ Default value: `$monit::params::service_enable` ## Defined types -### `monit::check` +### `monit::check` Adds a Monit check. #### Parameters -The following parameters are available in the `monit::check` defined type. +The following parameters are available in the `monit::check` defined type: + +* [`content`](#-monit--check--content) +* [`ensure`](#-monit--check--ensure) +* [`source`](#-monit--check--source) -##### `content` +##### `content` Data type: `Optional[String]` Specifies the content of the configuration file. The `content` and `source` parameters are exclusive of each other. -Default value: ``undef`` +Default value: `undef` -##### `ensure` +##### `ensure` Data type: `Enum['present', 'absent']` @@ -302,11 +341,11 @@ Tells Puppet whether the check should exist. Default value: `present` -##### `source` +##### `source` Data type: `Optional[String]` Tells Puppet what is the path of the configuration file. The `content` and `source` parameters are exclusive of each other. -Default value: ``undef`` +Default value: `undef` From bd8f4f7db6dcf43a5591941f3fbb862a5602eed8 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Sun, 4 Feb 2024 13:42:34 +0100 Subject: [PATCH 25/92] lint autofixes and removed anchor resources --- examples/check.pp | 2 +- examples/init.pp | 2 +- manifests/check.pp | 2 +- manifests/init.pp | 8 +++----- manifests/params.pp | 7 +++---- manifests/service.pp | 2 +- 6 files changed, 10 insertions(+), 13 deletions(-) diff --git a/examples/check.pp b/examples/check.pp index 143b5e1..f0d0943 100644 --- a/examples/check.pp +++ b/examples/check.pp @@ -1,4 +1,4 @@ -include ::monit +include monit monit::check { 'fake': content => 'fake content for the fake service check', diff --git a/examples/init.pp b/examples/init.pp index 06c91bc..ee082d5 100644 --- a/examples/init.pp +++ b/examples/init.pp @@ -9,4 +9,4 @@ # Learn more about module testing here: # http://docs.puppetlabs.com/guides/tests_smoke.html # -include ::monit +include monit diff --git a/manifests/check.pp b/manifests/check.pp index fd52f6c..b416ac9 100644 --- a/manifests/check.pp +++ b/manifests/check.pp @@ -26,7 +26,7 @@ } # - file { "${::monit::config_dir}/${name}": + file { "${monit::config_dir}/${name}": ensure => $ensure, owner => 'root', group => 'root', diff --git a/manifests/init.pp b/manifests/init.pp index 2a850ff..50e17d9 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -187,8 +187,8 @@ # Use the monit_version fact if available, else use the default for the # platform. - if defined('$::monit_version') and $::monit_version { - $monit_version_real = $::monit_version + if defined('$::monit_version') and $facts['monit_version'] { + $monit_version_real = $facts['monit_version'] } else { $monit_version_real = $monit::params::monit_version } @@ -197,10 +197,8 @@ fail("start_delay requires at least Monit 5.0. Detected version is <${monit_version_real}>.") } - anchor { "${module_name}::begin": } - -> class { "${module_name}::install": } + class { "${module_name}::install": } -> class { "${module_name}::config": } ~> class { "${module_name}::service": } -> class { "${module_name}::firewall": } - -> anchor { "${module_name}::end": } } diff --git a/manifests/params.pp b/manifests/params.pp index a676da6..503f4f0 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -31,7 +31,7 @@ $mmonit_without_credential = false # - case $::osfamily { + case $facts['os']['family'] { 'Debian': { $config_file = '/etc/monit/monitrc' $config_dir = '/etc/monit/conf.d' @@ -43,19 +43,18 @@ $config_dir = '/etc/monit.d' $service_hasstatus = true - case $::operatingsystem { + case $facts['os']['name'] { 'Amazon': { $monit_version = '5' $config_file = '/etc/monit.conf' } default: { $monit_version = '5' - $config_file = '/etc/monitrc' } } } default: { - fail("monit supports osfamilies Debian and RedHat. Detected osfamily is <${::osfamily}>.") + fail("monit supports osfamilies Debian and RedHat. Detected osfamily is <${facts['os']['family']}>.") } } # diff --git a/manifests/service.pp b/manifests/service.pp index 1fd8d5a..ff539e0 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -9,7 +9,7 @@ } if $monit::service_manage_bool { - if $::osfamily == 'Debian' { + if $facts['os']['family'] == 'Debian' { file { '/etc/default/monit': content => $monit::default_file_content, notify => Service[$monit::service_name], From 27c2d6009b4ef5e1d75591317ef177f8a615c267 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Sun, 4 Feb 2024 17:14:11 +0100 Subject: [PATCH 26/92] fix acceptance testing helper --- spec/spec_helper_acceptance.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 21d10c5..038d842 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,5 +1,4 @@ require 'beaker-rspec' -require 'pry' hosts.each do |host| # Install Puppet @@ -7,16 +6,14 @@ end RSpec.configure do |c| - module_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) - c.formatter = :documentation # Configure all nodes in nodeset c.before :suite do # Install module - puppet_module_install(source: module_root, module_name: 'monit') + install_local_module on(host) hosts.each do |host| - on host, puppet('module', 'install', 'puppetlabs-stdlib'), acceptable_exit_codes: [0, 1] + on host, 'puppet module install puppetlabs-stdlib' end end end From b09af3b415ba979062a424072cfdf9230d55dfd2 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Sun, 4 Feb 2024 17:50:06 +0100 Subject: [PATCH 27/92] use beaker install utils --- spec/spec_helper_acceptance.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 038d842..21ebeac 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,8 +1,8 @@ -require 'beaker-rspec' +require 'beaker_puppet_helpers' hosts.each do |host| # Install Puppet - on host, install_puppet + install_puppet_release_repo_on(host) end RSpec.configure do |c| @@ -13,7 +13,7 @@ # Install module install_local_module on(host) hosts.each do |host| - on host, 'puppet module install puppetlabs-stdlib' + install_puppet_module_via_pmt_on(host, stdlib) end end end From 74fe0be8fa3815e7d965a8f2f28f7b03a88afd2b Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 6 Feb 2024 12:35:37 +0100 Subject: [PATCH 28/92] modulesync 7.3.0 --- .github/workflows/ci.yml | 7 ++++++- .msync.yml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b66d8ca..7216724 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,12 @@ name: CI -on: pull_request +on: + pull_request: {} + push: + branches: + - main + - master concurrency: group: ${{ github.ref_name }} diff --git a/.msync.yml b/.msync.yml index f818344..f46ee02 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '7.2.0' +modulesync_config_version: '7.3.0' From 073a12de4beffc7d9569e9a8791562dc88a8b1c3 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 6 Feb 2024 15:39:59 +0100 Subject: [PATCH 29/92] rubcop fix --- spec/classes/init_spec.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index de5bdc4..be29eed 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -16,14 +16,13 @@ when 'RedHat' config_dir = '/etc/monit.d' service_hasstatus = true - case facts[:operatingsystem] - when 'Amazon' - monit_version = '5' - config_file = '/etc/monit.conf' - else - monit_version = '5' - config_file = '/etc/monitrc' - end + monit_version = '5' + config_file = case facts[:operatingsystem] + when 'Amazon' + '/etc/monit.conf' + else + '/etc/monitrc' + end else raise 'unsupported osfamily detected' end From 104ec2c0ada672a1ebb73fdb04d3cf31c2f5c4cc Mon Sep 17 00:00:00 2001 From: markuszilch Date: Mon, 12 Feb 2024 23:27:18 +0100 Subject: [PATCH 30/92] fixtures need to use https instead of git --- .fixtures.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 90cee1f..998bf07 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,10 +1,10 @@ fixtures: repositories: 'stdlib': - repo: 'git://github.com/puppetlabs/puppetlabs-stdlib.git' + repo: 'https://github.com/puppetlabs/puppetlabs-stdlib.git' ref: '4.6.0' 'firewall': - repo: 'git://github.com/puppetlabs/puppetlabs-firewall.git' + repo: 'https://github.com/puppetlabs/puppetlabs-firewall.git' ref: '1.7.1' symlinks: 'monit': "#{source_dir}" From af8571b8625cb1e435fd388e67877c6db952d733 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 00:26:26 +0100 Subject: [PATCH 31/92] revert to legacy osfamily fact --- manifests/params.pp | 3 +-- manifests/service.pp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index 503f4f0..87affdc 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -30,8 +30,7 @@ $mmonit_password = 'monit' $mmonit_without_credential = false - # - case $facts['os']['family'] { + case $facts['osfamily'] { 'Debian': { $config_file = '/etc/monit/monitrc' $config_dir = '/etc/monit/conf.d' diff --git a/manifests/service.pp b/manifests/service.pp index ff539e0..fa6979d 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -9,7 +9,7 @@ } if $monit::service_manage_bool { - if $facts['os']['family'] == 'Debian' { + if $facts['osfamily'] == 'Debian' { file { '/etc/default/monit': content => $monit::default_file_content, notify => Service[$monit::service_name], From 4ace092f817bec1024f78086f2b6344231def516 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 00:31:13 +0100 Subject: [PATCH 32/92] ignore legacy fact usage temporarily --- .puppet-lint.rc | 1 + 1 file changed, 1 insertion(+) diff --git a/.puppet-lint.rc b/.puppet-lint.rc index dd8272c..d2e5007 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1,3 +1,4 @@ --fail-on-warnings --no-parameter_documentation-check --no-parameter_types-check +--no-legacy_facts-check From fa025c4516368b5fefc0fb8f4ebdd5953595f4a2 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 00:41:27 +0100 Subject: [PATCH 33/92] readd accidentally deleted config_file --- manifests/params.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/params.pp b/manifests/params.pp index 87affdc..455c87f 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -49,6 +49,7 @@ } default: { $monit_version = '5' + $config_file = '/etc/monitrc' } } } From 5594019fb7b312e3a6c59abfc156ad00fa12b40e Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 00:51:46 +0100 Subject: [PATCH 34/92] remove non-supported OS tests --- spec/classes/init_spec.rb | 64 --------------------------------------- 1 file changed, 64 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index be29eed..b549d07 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -366,70 +366,6 @@ end end - context 'when major release of Amazon Linux is unsupported' do - let :facts do - { osfamily: 'RedHat', - operatingsystem: 'Amazon', - operatingsystemmajrelease: '3', - monit_version: '5' } - end - - it 'fails' do - expect do - is_expected.to contain_class('monit') - end.to raise_error(Puppet::Error, %r{monit supports Amazon Linux 2\. Detected operatingsystemmajrelease is <3>}) - end - end - - context 'when major release of EL is unsupported' do - let :facts do - { osfamily: 'RedHat', - operatingsystem: 'CentOS', - operatingsystemmajrelease: '4', - monit_version: '5' } - end - - it 'fails' do - expect do - is_expected.to contain_class('monit') - end.to raise_error(Puppet::Error, %r{monit supports EL 5, 6 and 7\. Detected operatingsystemmajrelease is <4>}) - end - end - - context 'when major release of Debian is unsupported' do - let :facts do - { osfamily: 'Debian', - operatingsystemmajrelease: '4', - lsbdistcodename: 'etch', - monit_version: '5' } - end - - it 'fails' do - expect do - is_expected.to contain_class('monit') - end.to raise_error(Puppet::Error, %r{monit supports Debian 6 \(squeeze\), 7 \(wheezy\), 8 \(jessie\), 9 \(stretch\) and 10 \(buster\) \ -and Ubuntu 10\.04 \(lucid\), 12\.04 \(precise\), 14\.04 \(trusty\), 16\.04 \(xenial\) and 18\.04 \(bionic\)\. \ -Detected lsbdistcodename is \.}) - end - end - - context 'when major release of Ubuntu is unsupported' do - let :facts do - { osfamily: 'Debian', - operatingsystemmajrelease: '8', - lsbdistcodename: 'hardy', - monit_version: '5' } - end - - it 'fails' do - expect do - is_expected.to contain_class('monit') - end.to raise_error(Puppet::Error, %r{monit supports Debian 6 \(squeeze\), 7 \(wheezy\), 8 \(jessie\), 9 \(stretch\) and 10 \(buster\) \ -and Ubuntu 10\.04 \(lucid\), 12\.04 \(precise\), 14\.04 \(trusty\), 16\.04 \(xenial\) and 18\.04 \(bionic\). \ -Detected lsbdistcodename is \.}) - end - end - context 'when osfamily is unsupported' do let :facts do { osfamily: 'Unsupported', From 58183b6c3175816c497232bf6d0a5c51f0bd014b Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 01:03:36 +0100 Subject: [PATCH 35/92] remove check for unsupported osfamily fact and puppet error --- spec/classes/init_spec.rb | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index b549d07..5acda7b 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -365,20 +365,6 @@ end.to raise_error(Puppet::PreformattedError, %r{expects a value of type Undef or Integer\[1}) end end - - context 'when osfamily is unsupported' do - let :facts do - { osfamily: 'Unsupported', - operatingsystemmajrelease: '9', - monit_version: '5' } - end - - it 'fails' do - expect do - is_expected.to contain_class('monit') - end.to raise_error(Puppet::Error, %r{monit supports osfamilies Debian and RedHat\. Detected osfamily is \.}) - end - end end describe 'variable type and content validations' do From 1e9c1931f93f7c1e83f91ab2e468eba570bbe4d8 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 01:08:49 +0100 Subject: [PATCH 36/92] replace spec_helper_acceptance with something more reasonable --- spec/spec_helper_acceptance.rb | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 21ebeac..0ea5df2 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,19 +1,8 @@ -require 'beaker_puppet_helpers' +require 'voxpupuli/acceptance/spec_helper_acceptance' -hosts.each do |host| +configure_beaker do |host| # Install Puppet install_puppet_release_repo_on(host) -end - -RSpec.configure do |c| - c.formatter = :documentation - - # Configure all nodes in nodeset - c.before :suite do - # Install module - install_local_module on(host) - hosts.each do |host| - install_puppet_module_via_pmt_on(host, stdlib) - end - end + install_local_module on(host) + install_puppet_module_via_pmt_on(host, stdlib) end From ae5d6e870a927f4bb809be5d286dd5c06c11d0f4 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 01:13:21 +0100 Subject: [PATCH 37/92] dont explicitly install puppet agent on host --- spec/spec_helper_acceptance.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 0ea5df2..7e8af00 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,8 +1,6 @@ require 'voxpupuli/acceptance/spec_helper_acceptance' configure_beaker do |host| - # Install Puppet - install_puppet_release_repo_on(host) - install_local_module on(host) + install_local_module_on(host) install_puppet_module_via_pmt_on(host, stdlib) end From f3d0ce7a560995fe1dbcab29c432cc4eaa790586 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 01:25:28 +0100 Subject: [PATCH 38/92] fix stdlib install --- spec/spec_helper_acceptance.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 7e8af00..0bf24dc 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -2,5 +2,5 @@ configure_beaker do |host| install_local_module_on(host) - install_puppet_module_via_pmt_on(host, stdlib) + install_puppet_module_via_pmt_on(host, 'puppetlabs-stdlib') end From 00caf418f5979e351ae50bb6e799db04b293b5c6 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 13:38:48 +0100 Subject: [PATCH 39/92] install epel-release for centos tests --- spec/spec_helper_acceptance.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 0bf24dc..192a7b4 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -3,4 +3,5 @@ configure_beaker do |host| install_local_module_on(host) install_puppet_module_via_pmt_on(host, 'puppetlabs-stdlib') + install_package(host, 'epel-release') if fact_on(host, 'os.name') == 'CentOS' end From 7c241208dd75b82a4f809fc43bade356fd766dea Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 13:43:40 +0100 Subject: [PATCH 40/92] install epel-release for all RedHat distro tests --- spec/spec_helper_acceptance.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 192a7b4..ab65c2d 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -3,5 +3,5 @@ configure_beaker do |host| install_local_module_on(host) install_puppet_module_via_pmt_on(host, 'puppetlabs-stdlib') - install_package(host, 'epel-release') if fact_on(host, 'os.name') == 'CentOS' + install_package(host, 'epel-release') if fact_on(host, 'os.family') == 'RedHat' end From 75611ea4a3d70a8180f85e6d9e1899207ab2d818 Mon Sep 17 00:00:00 2001 From: Markus Zilch <30926421+zilchms@users.noreply.github.com> Date: Tue, 13 Feb 2024 15:07:44 +0100 Subject: [PATCH 41/92] remove defined check on legacy fact Co-authored-by: Ewoud Kohl van Wijngaarden --- manifests/init.pp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 50e17d9..13d52c6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -187,11 +187,7 @@ # Use the monit_version fact if available, else use the default for the # platform. - if defined('$::monit_version') and $facts['monit_version'] { - $monit_version_real = $facts['monit_version'] - } else { - $monit_version_real = $monit::params::monit_version - } + $monit_version_real = pick(fact('monit_version'), $monit::params::monit_version) if($start_delay and $start_delay > 0 and versioncmp($monit_version_real,'5') < 0) { fail("start_delay requires at least Monit 5.0. Detected version is <${monit_version_real}>.") From cc19b044c8485c5b4484f674c55f4f2812531ebd Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 15:23:45 +0100 Subject: [PATCH 42/92] fix picking fact monitversion --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 13d52c6..b4640d1 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -187,7 +187,7 @@ # Use the monit_version fact if available, else use the default for the # platform. - $monit_version_real = pick(fact('monit_version'), $monit::params::monit_version) + $monit_version_real = pick($facts['monit_version'], $monit::params::monit_version) if($start_delay and $start_delay > 0 and versioncmp($monit_version_real,'5') < 0) { fail("start_delay requires at least Monit 5.0. Detected version is <${monit_version_real}>.") From f8ab196faf625fdddc83ae17be5785f5d4e550ec Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 15:26:11 +0100 Subject: [PATCH 43/92] add contain to replace anchor resources --- manifests/init.pp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index b4640d1..c1dc47b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -193,8 +193,10 @@ fail("start_delay requires at least Monit 5.0. Detected version is <${monit_version_real}>.") } - class { "${module_name}::install": } - -> class { "${module_name}::config": } - ~> class { "${module_name}::service": } - -> class { "${module_name}::firewall": } + contain "${module_name}::install" + contain "${module_name}::config" + contain "${module_name}::service" + contain "${module_name}::firewall" + + Class["${module_name}::install"] -> Class["${module_name}::config"] ~> Class["${module_name}::service"] -> Class["${module_name}::firewall"] } From e1c8197a23c7a1976eeffc18a2d1978ff0ebaf02 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 15:29:08 +0100 Subject: [PATCH 44/92] use heredoc --- spec/classes/init_spec.rb | 8 ++++---- spec/defines/check_spec.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 5acda7b..cd465bf 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -103,7 +103,7 @@ context 'when httpd is set to valid bool ' do let(:params) { { httpd: true } } - content = <<-END.gsub(%r{^\s+\|}, '') + content = <<~END |set httpd port 2812 and | use address localhost | allow 0.0.0.0/0.0.0.0 @@ -124,7 +124,7 @@ } end - content = <<-END.gsub(%r{^\s+\|}, '') + content = <<~END |set httpd port 2420 and | use address otherhost | allow 0.0.0.0/0.0.0.0 @@ -231,7 +231,7 @@ } end - content = <<-END.gsub(%r{^\s+\|}, '') + content = <<~END |set mail-format { | from: monit@test.local | message: Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION @@ -251,7 +251,7 @@ } end - content = <<-END.gsub(%r{^\s+\|}, '') + content = <<~END |set alert spec@test.local |set alert tester@test.local END diff --git a/spec/defines/check_spec.rb b/spec/defines/check_spec.rb index f988054..2170c67 100644 --- a/spec/defines/check_spec.rb +++ b/spec/defines/check_spec.rb @@ -51,7 +51,7 @@ end context 'with content set to a valid value' do - content = <<-END.gsub(%r{^\s+\|}, '') + content = <<~END |check process ntpd with pidfile /var/run/ntpd.pid |start program = "/etc/init.d/ntpd start" |stop program = "/etc/init.d/ntpd stop" From 0a432eec58a3e71347e145c3b0b635b1cf96f947 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 15:40:44 +0100 Subject: [PATCH 45/92] remove regex escape --- spec/classes/init_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index cd465bf..71b48cb 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -238,7 +238,7 @@ | subject: spectesting |} END - it { is_expected.to contain_file('monit_config').with_content(%r{#{Regexp.escape(content)}}) } + it { is_expected.to contain_file('monit_config').with_content(%r{#{content}}) } end context 'when alert_emails is set to valid array' do From 8fbf6eff250eafd26e5928ce59a8a5ee4747b274 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 15:45:22 +0100 Subject: [PATCH 46/92] use shortform for expected failure --- spec/classes/init_spec.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 71b48cb..c751411 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -339,9 +339,7 @@ end it 'fails' do - expect do - is_expected.to contain_class('monit') - end.to raise_error(Puppet::PreformattedError, %r{expects an Integer\[1, 65535\] value}) + is_expected.to compile.and_raise_error(%r{expects an Integer\[1, 65535\] value}) end end end From 7ded42e3377c789f475ed06126ec93b0201c7939 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 16:31:40 +0100 Subject: [PATCH 47/92] remove unnecessary | in heredoc --- spec/classes/init_spec.rb | 30 +++++++++++++++--------------- spec/defines/check_spec.rb | 10 +++++----- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index c751411..de94d96 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -104,10 +104,10 @@ let(:params) { { httpd: true } } content = <<~END - |set httpd port 2812 and - | use address localhost - | allow 0.0.0.0/0.0.0.0 - | allow admin:monit + set httpd port 2812 and + use address localhost + allow 0.0.0.0/0.0.0.0 + allow admin:monit END it { is_expected.to contain_file('monit_config').with_content(%r{#{content}}) } end @@ -125,10 +125,10 @@ end content = <<~END - |set httpd port 2420 and - | use address otherhost - | allow 0.0.0.0/0.0.0.0 - | allow tester:Passw0rd + set httpd port 2420 and + use address otherhost + allow 0.0.0.0/0.0.0.0 + allow tester:Passw0rd END it { is_expected.to contain_file('monit_config').with_content(%r{#{content}}) } end @@ -232,11 +232,11 @@ end content = <<~END - |set mail-format { - | from: monit@test.local - | message: Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION - | subject: spectesting - |} + set mail-format { + from: monit@test.local + message: Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION + subject: spectesting + } END it { is_expected.to contain_file('monit_config').with_content(%r{#{content}}) } end @@ -252,8 +252,8 @@ end content = <<~END - |set alert spec@test.local - |set alert tester@test.local + set alert spec@test.local + set alert tester@test.local END it { is_expected.to contain_file('monit_config').with_content(%r{#{content}}) } end diff --git a/spec/defines/check_spec.rb b/spec/defines/check_spec.rb index 2170c67..940e07d 100644 --- a/spec/defines/check_spec.rb +++ b/spec/defines/check_spec.rb @@ -52,11 +52,11 @@ context 'with content set to a valid value' do content = <<~END - |check process ntpd with pidfile /var/run/ntpd.pid - |start program = "/etc/init.d/ntpd start" - |stop program = "/etc/init.d/ntpd stop" - |if failed host 127.0.0.1 port 123 type udp then alert - |if 5 restarts within 5 cycles then timeout + check process ntpd with pidfile /var/run/ntpd.pid + start program = "/etc/init.d/ntpd start" + stop program = "/etc/init.d/ntpd stop" + if failed host 127.0.0.1 port 123 type udp then alert + if 5 restarts within 5 cycles then timeout END let(:params) do { From 61a3e18d73dc66ab0a99ac44e0557082793a95a1 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 16:46:42 +0100 Subject: [PATCH 48/92] readd regex escape to content check --- spec/classes/init_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index de94d96..70a8f4a 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -238,7 +238,7 @@ subject: spectesting } END - it { is_expected.to contain_file('monit_config').with_content(%r{#{content}}) } + it { is_expected.to contain_file('monit_config').with_content(%r{#{Regexp.escape(content)}}) } end context 'when alert_emails is set to valid array' do From dcdad9bcac1ffdfb4824275677a1438e9afcd3c2 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 16:51:29 +0100 Subject: [PATCH 49/92] use compile.and_raise_error where applicable --- spec/classes/init_spec.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 70a8f4a..327179b 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -349,8 +349,7 @@ it 'fails' do expect do - is_expected.to contain_class('monit') - end.to raise_error(Puppet::PreformattedError, %r{expects an Integer\[1}) + is_expected.to compile.and_raise_error(%r{expects an Integer\[1}) end end @@ -359,8 +358,7 @@ it 'fails' do expect do - is_expected.to contain_class('monit') - end.to raise_error(Puppet::PreformattedError, %r{expects a value of type Undef or Integer\[1}) + is_expected.to compile.and_raise_error(%r{expects a value of type Undef or Integer\[1}) end end end From 0e76d23a30f4b5a0cd6c2dcc13fd7453039e8728 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 16:56:08 +0100 Subject: [PATCH 50/92] fix introduced syntax errors --- spec/classes/init_spec.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 327179b..25d3c42 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -348,8 +348,7 @@ let(:params) { { check_interval: 0 } } it 'fails' do - expect do - is_expected.to compile.and_raise_error(%r{expects an Integer\[1}) + is_expected.to compile.and_raise_error(%r{expects an Integer\[1}) end end @@ -357,8 +356,7 @@ let(:params) { { start_delay: 0 } } it 'fails' do - expect do - is_expected.to compile.and_raise_error(%r{expects a value of type Undef or Integer\[1}) + is_expected.to compile.and_raise_error(%r{expects a value of type Undef or Integer\[1}) end end end From 1d8a28a400d31b6e3422bf316b60994b0661421a Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 22:43:40 +0100 Subject: [PATCH 51/92] beaker handles module installation; remove manual install --- spec/spec_helper_acceptance.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index ab65c2d..8e8817d 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,7 +1,5 @@ require 'voxpupuli/acceptance/spec_helper_acceptance' configure_beaker do |host| - install_local_module_on(host) - install_puppet_module_via_pmt_on(host, 'puppetlabs-stdlib') install_package(host, 'epel-release') if fact_on(host, 'os.family') == 'RedHat' end From 60357038d587c10a780e29303a7076c116f12271 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 22:52:48 +0100 Subject: [PATCH 52/92] rewrite the last Error tests to compile.and_raise_error --- spec/classes/init_spec.rb | 4 +--- spec/defines/check_spec.rb | 8 ++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 25d3c42..6663ebd 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -458,9 +458,7 @@ let(:params) { validation_params.merge("#{var_name}": invalid) } it 'fails' do - expect do - catalogue - end.to raise_error(Puppet::Error, %r{#{var[:message]}}) + is_expected.to compile.and_raise_error(%r{#{var[:message]}}) end end end diff --git a/spec/defines/check_spec.rb b/spec/defines/check_spec.rb index 940e07d..4ee93db 100644 --- a/spec/defines/check_spec.rb +++ b/spec/defines/check_spec.rb @@ -104,9 +104,7 @@ end it 'fails' do - expect do - catalogue - end.to raise_error(Puppet::Error, %r{Parameters source and content are mutually exclusive}) + is_expected.to compile.and_raise_error(%r{Parameters source and content are mutually exclusive}) end end @@ -161,9 +159,7 @@ let(:params) { validation_params.merge("#{var_name}": invalid) } it 'fails' do - expect do - catalogue - end.to raise_error(Puppet::PreformattedError, %r{expects a #{var[:message]}}) + is_expected.to compile.and_raise_error(%r{expects a #{var[:message]}}) end end end From 973ef11eaf23add783bc3c265e0737459fdbdc18 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Wed, 14 Feb 2024 14:31:40 +0100 Subject: [PATCH 53/92] add node setup for RedHat with epel-release; let modulesync manage spec_helper_acceptance --- .sync.yml | 3 +++ spec/setup_acceptance_node.pp | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 spec/setup_acceptance_node.pp diff --git a/.sync.yml b/.sync.yml index d2d11b0..6fd48f8 100644 --- a/.sync.yml +++ b/.sync.yml @@ -20,3 +20,6 @@ appveyor.yml: spec/spec_helper.rb: mock_with: ':rspec' coverage_report: true + +spec/spec_helper_acceptance.rb: + unmanaged: false diff --git a/spec/setup_acceptance_node.pp b/spec/setup_acceptance_node.pp new file mode 100644 index 0000000..a620147 --- /dev/null +++ b/spec/setup_acceptance_node.pp @@ -0,0 +1,5 @@ +if $facts['os']['family'] == 'RedHat' { + package {'epel-release': + ensure => installed + } +} From ad12c40ba9857c086a55bbd543849d28dac7ee18 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Wed, 14 Feb 2024 14:54:38 +0100 Subject: [PATCH 54/92] sync spec_helper_acceptance --- spec/spec_helper_acceptance.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 8e8817d..2681792 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,5 +1,10 @@ +# frozen_string_literal: true + +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + require 'voxpupuli/acceptance/spec_helper_acceptance' -configure_beaker do |host| - install_package(host, 'epel-release') if fact_on(host, 'os.family') == 'RedHat' -end +configure_beaker(modules: :metadata) + +Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f } From ecb46bdb164f6bf161d645bc4a16304aa4fa57c5 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 15:14:42 +0100 Subject: [PATCH 55/92] remove pins from fixtures and delete symlink --- .fixtures.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 998bf07..7cae334 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,10 +1,4 @@ fixtures: repositories: - 'stdlib': - repo: 'https://github.com/puppetlabs/puppetlabs-stdlib.git' - ref: '4.6.0' - 'firewall': - repo: 'https://github.com/puppetlabs/puppetlabs-firewall.git' - ref: '1.7.1' - symlinks: - 'monit': "#{source_dir}" + 'stdlib': 'https://github.com/puppetlabs/puppetlabs-stdlib.git' + 'firewall': 'https://github.com/puppetlabs/puppetlabs-firewall.git' From 989d75432d6facdf0f5982a4774d99d452688b52 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 17:09:46 +0100 Subject: [PATCH 56/92] replace legacy is_string function with datatype check --- manifests/init.pp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index c1dc47b..0e9f4c8 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -133,43 +133,43 @@ Optional[Integer[1]] $start_delay = $monit::params::start_delay, ) inherits monit::params { # - if is_string($httpd) == true { + if $httpd =~ String { $httpd_bool = str2bool($httpd) } else { $httpd_bool = $httpd } - if is_string($manage_firewall) == true { + if $manage_firewall =~ String { $manage_firewall_bool = str2bool($manage_firewall) } else { $manage_firewall_bool = $manage_firewall } - if is_string($service_enable) == true { + if $service_enable =~ String { $service_enable_bool = str2bool($service_enable) } else { $service_enable_bool = $service_enable } - if is_string($service_manage) == true { + if $service_manage =~ String { $service_manage_bool = str2bool($service_manage) } else { $service_manage_bool = $service_manage } - if is_string($mmonit_https) == true { + if $mmonit_https =~ String { $mmonit_https_bool = str2bool($mmonit_https) } else { $mmonit_https_bool = $mmonit_https } - if is_string($mmonit_without_credential) == true { + if $mmonit_without_credential =~ String { $mmonit_without_credential_bool = str2bool($mmonit_without_credential) } else { $mmonit_without_credential_bool = $mmonit_without_credential } - if is_string($config_dir_purge) == true { + if $config_dir_purge =~ String { $config_dir_purge_bool = str2bool($config_dir_purge) } else { $config_dir_purge_bool = $config_dir_purge From 30849e24b1cbc684a649eb6bf17350d09b83148f Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 17:17:05 +0100 Subject: [PATCH 57/92] use absolutepath type instead of validate function --- REFERENCE.md | 4 ++-- manifests/init.pp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 757e6d3..1979508 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -87,7 +87,7 @@ Default value: `$monit::params::check_interval` ##### `config_file` -Data type: `String` +Data type: `Stdlib::Absolutepath` Specifies a path to the main config file. Default value: varies with operating system @@ -95,7 +95,7 @@ Default value: `$monit::params::config_file` ##### `config_dir` -Data type: `String` +Data type: `Stdlib::Absolutepath` Specifies a path to the config directory. Default value: varies with operating system diff --git a/manifests/init.pp b/manifests/init.pp index 0e9f4c8..a85140f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -105,8 +105,8 @@ class monit ( Array[String] $alert_emails = $monit::params::alert_emails, Integer[1] $check_interval = $monit::params::check_interval, - String $config_file = $monit::params::config_file, - String $config_dir = $monit::params::config_dir, + Stdlib::Absolutepath $config_file = $monit::params::config_file, + Stdlib::Absolutepath $config_dir = $monit::params::config_dir, Variant[Boolean, Enum['true', 'false']] $config_dir_purge = $monit::params::config_dir_purge, Variant[Boolean, Enum['true', 'false']] $httpd = $monit::params::httpd, Integer[1, 65535] $httpd_port = $monit::params::httpd_port, @@ -177,8 +177,8 @@ # # - validate_absolute_path($config_file) - validate_absolute_path($config_dir) + $config_file + $config_dir if $logfile and !($logfile =~ /^syslog(\s+facility\s+log_(local[0-7]|daemon))?/) { validate_absolute_path($logfile) From 264cff18a632130afae7469ff04c5c03485a33cc Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 17:18:48 +0100 Subject: [PATCH 58/92] really remove validation --- manifests/init.pp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index a85140f..698c0d0 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -176,10 +176,6 @@ } # - # - $config_file - $config_dir - if $logfile and !($logfile =~ /^syslog(\s+facility\s+log_(local[0-7]|daemon))?/) { validate_absolute_path($logfile) } From 51a666362db6b54dc4cb4a817fdae679f3c62d8a Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 17:25:04 +0100 Subject: [PATCH 59/92] fix another path with assert_type --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 698c0d0..26fd7db 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -177,7 +177,7 @@ # if $logfile and !($logfile =~ /^syslog(\s+facility\s+log_(local[0-7]|daemon))?/) { - validate_absolute_path($logfile) + assert_type(Stdlib::Absolutepath, $logfile) } # From cc2f29375da7212e439df8fb2d209e43e89364c5 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 17:30:07 +0100 Subject: [PATCH 60/92] remove unnecessary commments --- manifests/init.pp | 3 --- 1 file changed, 3 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 26fd7db..15c7a72 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -132,7 +132,6 @@ String $service_name = $monit::params::service_name, Optional[Integer[1]] $start_delay = $monit::params::start_delay, ) inherits monit::params { - # if $httpd =~ String { $httpd_bool = str2bool($httpd) } else { @@ -174,12 +173,10 @@ } else { $config_dir_purge_bool = $config_dir_purge } - # if $logfile and !($logfile =~ /^syslog(\s+facility\s+log_(local[0-7]|daemon))?/) { assert_type(Stdlib::Absolutepath, $logfile) } - # # Use the monit_version fact if available, else use the default for the # platform. From 5399add5225be9ced4aace9a76a914040673b62f Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 21:39:34 +0100 Subject: [PATCH 61/92] replace legacy firewall parameter action with jump --- manifests/firewall.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/firewall.pp b/manifests/firewall.pp index 37a9d2e..cf10f1c 100644 --- a/manifests/firewall.pp +++ b/manifests/firewall.pp @@ -11,7 +11,7 @@ if $monit::httpd_bool and $monit::manage_firewall_bool { if defined('::firewall') { firewall { "${monit::httpd_port} allow Monit inbound traffic": - action => 'accept', + jump => 'accept', dport => $monit::httpd_port, proto => 'tcp', } From 3714d6dec30d904a40dc823220e99e0278852cfe Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 21:41:06 +0100 Subject: [PATCH 62/92] lint_fix --- manifests/firewall.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/firewall.pp b/manifests/firewall.pp index cf10f1c..0a1ec06 100644 --- a/manifests/firewall.pp +++ b/manifests/firewall.pp @@ -11,9 +11,9 @@ if $monit::httpd_bool and $monit::manage_firewall_bool { if defined('::firewall') { firewall { "${monit::httpd_port} allow Monit inbound traffic": - jump => 'accept', - dport => $monit::httpd_port, - proto => 'tcp', + jump => 'accept', + dport => $monit::httpd_port, + proto => 'tcp', } } } From 86ae20ded695d1ae981b91f685427045475b158c Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 21:43:13 +0100 Subject: [PATCH 63/92] change spec test to reflect jump firewall parameter --- spec/classes/init_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 6663ebd..9fab2c8 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -159,7 +159,7 @@ end it do - is_expected.to contain_firewall('2812 allow Monit inbound traffic').with('action' => 'accept', + is_expected.to contain_firewall('2812 allow Monit inbound traffic').with('jump' => 'accept', 'dport' => '2812', 'proto' => 'tcp') end From ab162f406e0154c2b58cea85b40d912b08b29632 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 21:44:56 +0100 Subject: [PATCH 64/92] rubocop autocorrect --- spec/classes/init_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 9fab2c8..764657a 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -160,8 +160,8 @@ it do is_expected.to contain_firewall('2812 allow Monit inbound traffic').with('jump' => 'accept', - 'dport' => '2812', - 'proto' => 'tcp') + 'dport' => '2812', + 'proto' => 'tcp') end end From 234f496fd5906edc3996e5c1b95b1bb59a48d017 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 22:26:18 +0100 Subject: [PATCH 65/92] remove type tests, we have typing in puppet now --- spec/classes/init_spec.rb | 149 -------------------------------------- 1 file changed, 149 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 764657a..adf8dad 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -316,153 +316,4 @@ end end end - - describe 'failures' do - let(:facts) do - { - osfamily: 'Debian', - lsbdistcodename: 'squeeze', - monit_version: '5', - } - end - - [-1, 65_536].each do |value| - context "when httpd_port is set to invalid value <#{value}>" do - let(:params) do - { - httpd: true, - httpd_port: value, - httpd_address: 'otherhost', - httpd_user: 'tester', - httpd_password: 'Passw0rd', - } - end - - it 'fails' do - is_expected.to compile.and_raise_error(%r{expects an Integer\[1, 65535\] value}) - end - end - end - - context 'when check_interval is set to invalid value <0>' do - let(:params) { { check_interval: 0 } } - - it 'fails' do - is_expected.to compile.and_raise_error(%r{expects an Integer\[1}) - end - end - - context 'when start_delay is set to invalid value <0>' do - let(:params) { { start_delay: 0 } } - - it 'fails' do - is_expected.to compile.and_raise_error(%r{expects a value of type Undef or Integer\[1}) - end - end - end - - describe 'variable type and content validations' do - # set needed custom facts and variables - let(:facts) do - { - osfamily: 'Debian', - operatingsystemrelease: '6.0', - operatingsystemmajrelease: '6', - lsbdistcodename: 'squeeze', - monit_version: '5', - } - end - let(:validation_params) do - { - # :param => 'value', - } - end - - validations = { - 'absolute_path' => { - name: %w[config_file config_dir], - valid: ['/absolute/filepath', '/absolute/directory/'], - invalid: ['invalid', 3, 2.42, ['array'], { 'ha' => 'sh' }], - message: '(expects a String value|is not an absolute path)', - }, - 'array' => { - name: ['alert_emails'], - valid: [%w[valid array]], - invalid: ['string', { 'ha' => 'sh' }, 3, 2.42, true], - message: 'expects an Array value', - }, - 'bool_stringified' => { - name: %w[httpd manage_firewall service_enable service_manage mmonit_https mmonit_without_credential config_dir_purge], - valid: [true, 'true', false, 'false'], - invalid: ['invalid', 3, 2.42, ['array'], { 'ha' => 'sh' }, nil], - message: 'expects a value of type Boolean or Enum', - }, - 'integer' => { - name: %w[check_interval httpd_port mmonit_port], - valid: [242], - invalid: [2.42, 'invalid', ['array'], { 'ha' => 'sh ' }, true, false, nil], - message: 'expects an Integer', - }, - 'optional_integer' => { - name: ['start_delay'], - valid: [242], - invalid: [2.42, 'invalid', ['array'], { 'ha' => 'sh ' }, true, false, nil], - message: 'expects a value of type Undef or Integer', - }, - 'optional_logfile' => { - name: ['logfile'], - valid: ['/absolute/filepath', '/absolute/directory/', 'syslog', 'syslog facility log_local0'], - invalid: ['invalid', 3, 2.42, ['array'], { 'ha' => 'sh' }], - message: '(expects a value of type Undef or String|is not an absolute path)', - }, - 'optional_hash' => { - name: ['mailformat'], - valid: [{ 'ha' => 'sh' }], - invalid: ['string', 3, 2.42, ['array'], true, false, nil], - message: 'expects a value of type Undef or Hash', - }, - 'optional_string' => { - name: %w[mailserver mmonit_address], - valid: ['present'], - invalid: [['array'], { 'ha' => 'sh' }], - message: 'expects a value of type Undef or String', - }, - 'string' => { - name: %w[httpd_address httpd_allow httpd_user httpd_password - package_ensure package_name service_name mmonit_user - mmonit_password], - valid: ['present'], - invalid: [['array'], { 'ha' => 'sh' }], - message: 'expects a String value', - }, - 'service_ensure_string' => { - name: ['service_ensure'], - valid: ['running'], - invalid: [['array'], { 'ha' => 'sh' }], - message: 'expects a match for Enum\[\'running\', \'stopped\'\]', - }, - } - - validations.sort.each do |type, var| - var[:name].each do |var_name| - var[:valid].each do |valid| - context "with #{var_name} (#{type}) set to valid #{valid} (as #{valid.class})" do - let(:params) { validation_params.merge("#{var_name}": valid) } - - it { is_expected.to compile } - end - end - - var[:invalid].each do |invalid| - context "with #{var_name} (#{type}) set to invalid #{invalid} (as #{invalid.class})" do - let(:params) { validation_params.merge("#{var_name}": invalid) } - - it 'fails' do - is_expected.to compile.and_raise_error(%r{#{var[:message]}}) - end - end - end - end # var[:name].each - end # validations.sort.each - end # describe 'variable type and content validations' end From 887024dfbb77f66a0b783e99e48a964baf3a442c Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 15 Feb 2024 09:58:12 +0100 Subject: [PATCH 66/92] set httpd to strictly be boolean --- manifests/init.pp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 15c7a72..1f5aa80 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -108,7 +108,7 @@ Stdlib::Absolutepath $config_file = $monit::params::config_file, Stdlib::Absolutepath $config_dir = $monit::params::config_dir, Variant[Boolean, Enum['true', 'false']] $config_dir_purge = $monit::params::config_dir_purge, - Variant[Boolean, Enum['true', 'false']] $httpd = $monit::params::httpd, + Boolean $httpd = $monit::params::httpd, Integer[1, 65535] $httpd_port = $monit::params::httpd_port, String $httpd_address = $monit::params::httpd_address, String $httpd_allow = $monit::params::httpd_allow, @@ -132,11 +132,6 @@ String $service_name = $monit::params::service_name, Optional[Integer[1]] $start_delay = $monit::params::start_delay, ) inherits monit::params { - if $httpd =~ String { - $httpd_bool = str2bool($httpd) - } else { - $httpd_bool = $httpd - } if $manage_firewall =~ String { $manage_firewall_bool = str2bool($manage_firewall) From d9d8159059b4113fde0b50af29bf9e015a5fcfd5 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 15 Feb 2024 09:59:14 +0100 Subject: [PATCH 67/92] set manage_firewall to strictly be boolean --- manifests/init.pp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 1f5aa80..e75e9e1 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -117,7 +117,7 @@ Optional[String] $logfile = $monit::params::logfile, Optional[String] $mailserver = $monit::params::mailserver, Optional[Hash] $mailformat = $monit::params::mailformat, - Variant[Boolean, Enum['true', 'false']] $manage_firewall = $monit::params::manage_firewall, + Boolean $manage_firewall = $monit::params::manage_firewall, Optional[String] $mmonit_address = $monit::params::mmonit_address, Variant[Boolean, Enum['true', 'false']] $mmonit_https = $monit::params::mmonit_https, Integer[1, 65535] $mmonit_port = $monit::params::mmonit_port, @@ -133,12 +133,6 @@ Optional[Integer[1]] $start_delay = $monit::params::start_delay, ) inherits monit::params { - if $manage_firewall =~ String { - $manage_firewall_bool = str2bool($manage_firewall) - } else { - $manage_firewall_bool = $manage_firewall - } - if $service_enable =~ String { $service_enable_bool = str2bool($service_enable) } else { From e70025dc3c59eca0d95e875d32d43b8e6ff51cb7 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 15 Feb 2024 10:00:42 +0100 Subject: [PATCH 68/92] set service_enable to strictly be boolean --- manifests/init.pp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index e75e9e1..f89502b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -126,19 +126,13 @@ Variant[Boolean, Enum['true', 'false']] $mmonit_without_credential = $monit::params::mmonit_without_credential, String $package_ensure = $monit::params::package_ensure, String $package_name = $monit::params::package_name, - Variant[Boolean, Enum['true', 'false']] $service_enable = $monit::params::service_enable, + Boolean $service_enable = $monit::params::service_enable, Enum['running', 'stopped'] $service_ensure = $monit::params::service_ensure, Variant[Boolean, Enum['true', 'false']] $service_manage = $monit::params::service_manage, String $service_name = $monit::params::service_name, Optional[Integer[1]] $start_delay = $monit::params::start_delay, ) inherits monit::params { - if $service_enable =~ String { - $service_enable_bool = str2bool($service_enable) - } else { - $service_enable_bool = $service_enable - } - if $service_manage =~ String { $service_manage_bool = str2bool($service_manage) } else { From e468e53fbc4575861a017e3e8c0102a04a98ea93 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 15 Feb 2024 10:01:25 +0100 Subject: [PATCH 69/92] set service_manage to strictly be boolean --- manifests/init.pp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index f89502b..c49df8d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -128,17 +128,11 @@ String $package_name = $monit::params::package_name, Boolean $service_enable = $monit::params::service_enable, Enum['running', 'stopped'] $service_ensure = $monit::params::service_ensure, - Variant[Boolean, Enum['true', 'false']] $service_manage = $monit::params::service_manage, + Boolean $service_manage = $monit::params::service_manage, String $service_name = $monit::params::service_name, Optional[Integer[1]] $start_delay = $monit::params::start_delay, ) inherits monit::params { - if $service_manage =~ String { - $service_manage_bool = str2bool($service_manage) - } else { - $service_manage_bool = $service_manage - } - if $mmonit_https =~ String { $mmonit_https_bool = str2bool($mmonit_https) } else { From 899daad7b896feefe50aa9826102a1b62b33aea8 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 15 Feb 2024 10:03:47 +0100 Subject: [PATCH 70/92] set mmonit_https to strictly be boolean --- manifests/init.pp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index c49df8d..93cb42a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -119,7 +119,7 @@ Optional[Hash] $mailformat = $monit::params::mailformat, Boolean $manage_firewall = $monit::params::manage_firewall, Optional[String] $mmonit_address = $monit::params::mmonit_address, - Variant[Boolean, Enum['true', 'false']] $mmonit_https = $monit::params::mmonit_https, + Boolean $mmonit_https = $monit::params::mmonit_https, Integer[1, 65535] $mmonit_port = $monit::params::mmonit_port, String $mmonit_user = $monit::params::mmonit_user, String $mmonit_password = $monit::params::mmonit_password, @@ -133,12 +133,6 @@ Optional[Integer[1]] $start_delay = $monit::params::start_delay, ) inherits monit::params { - if $mmonit_https =~ String { - $mmonit_https_bool = str2bool($mmonit_https) - } else { - $mmonit_https_bool = $mmonit_https - } - if $mmonit_without_credential =~ String { $mmonit_without_credential_bool = str2bool($mmonit_without_credential) } else { From a1dce22c87a28ac8565cbc18f81aedc1b539ecef Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 15 Feb 2024 10:04:40 +0100 Subject: [PATCH 71/92] set mmonit_without_credentials to strictly be boolean --- manifests/init.pp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 93cb42a..055b480 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -123,7 +123,7 @@ Integer[1, 65535] $mmonit_port = $monit::params::mmonit_port, String $mmonit_user = $monit::params::mmonit_user, String $mmonit_password = $monit::params::mmonit_password, - Variant[Boolean, Enum['true', 'false']] $mmonit_without_credential = $monit::params::mmonit_without_credential, + Boolean $mmonit_without_credential = $monit::params::mmonit_without_credential, String $package_ensure = $monit::params::package_ensure, String $package_name = $monit::params::package_name, Boolean $service_enable = $monit::params::service_enable, @@ -133,12 +133,6 @@ Optional[Integer[1]] $start_delay = $monit::params::start_delay, ) inherits monit::params { - if $mmonit_without_credential =~ String { - $mmonit_without_credential_bool = str2bool($mmonit_without_credential) - } else { - $mmonit_without_credential_bool = $mmonit_without_credential - } - if $config_dir_purge =~ String { $config_dir_purge_bool = str2bool($config_dir_purge) } else { From 543112123c3a97a30cebbb276898d556b511c6a2 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 15 Feb 2024 10:05:41 +0100 Subject: [PATCH 72/92] set config_dir_purge to strictly be boolean --- manifests/init.pp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 055b480..89cd75b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -107,7 +107,7 @@ Integer[1] $check_interval = $monit::params::check_interval, Stdlib::Absolutepath $config_file = $monit::params::config_file, Stdlib::Absolutepath $config_dir = $monit::params::config_dir, - Variant[Boolean, Enum['true', 'false']] $config_dir_purge = $monit::params::config_dir_purge, + Boolean $config_dir_purge = $monit::params::config_dir_purge, Boolean $httpd = $monit::params::httpd, Integer[1, 65535] $httpd_port = $monit::params::httpd_port, String $httpd_address = $monit::params::httpd_address, @@ -133,12 +133,6 @@ Optional[Integer[1]] $start_delay = $monit::params::start_delay, ) inherits monit::params { - if $config_dir_purge =~ String { - $config_dir_purge_bool = str2bool($config_dir_purge) - } else { - $config_dir_purge_bool = $config_dir_purge - } - if $logfile and !($logfile =~ /^syslog(\s+facility\s+log_(local[0-7]|daemon))?/) { assert_type(Stdlib::Absolutepath, $logfile) } From 239c7addc591fa632ae120ad6b3677dee86b9dbe Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 15 Feb 2024 10:08:15 +0100 Subject: [PATCH 73/92] regenerate reference --- REFERENCE.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 1979508..0c1b25a 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -103,7 +103,7 @@ Default value: `$monit::params::config_dir` ##### `config_dir_purge` -Data type: `Variant[Boolean, Enum['true', 'false']]` +Data type: `Boolean` Specifies if unmanaged files in the config directory should be purged. Default value: 'false' @@ -111,7 +111,7 @@ Default value: `$monit::params::config_dir_purge` ##### `httpd` -Data type: `Variant[Boolean, Enum['true', 'false']]` +Data type: `Boolean` Specifies whether to enable the Monit Dashboard. Default value: 'false' @@ -186,7 +186,7 @@ Default value: `$monit::params::mailformat` ##### `manage_firewall` -Data type: `Variant[Boolean, Enum['true', 'false']]` +Data type: `Boolean` If true and if puppetlabs-firewall module is present, Puppet manages firewall to allow HTTP access for Monit Dashboard. Default value: 'false' @@ -205,7 +205,7 @@ Default value: `$monit::params::mmonit_address` ##### `mmonit_https` -Data type: `Variant[Boolean, Enum['true', 'false']]` +Data type: `Boolean` *Requires at least Monit 5.0*
Specifies wheither the protocol of the M/Monit server is HTTPs. Default value: 'true' @@ -243,7 +243,7 @@ Default value: `$monit::params::mmonit_password` ##### `mmonit_without_credential` -Data type: `Variant[Boolean, Enum['true', 'false']]` +Data type: `Boolean` *Requires at least Monit 5.0*
By default Monit registers credentials with M/Monit so M/Monit can smoothly communicate back to Monit and you don't have to register @@ -280,7 +280,7 @@ Default value: `$monit::params::service_ensure` ##### `service_manage` -Data type: `Variant[Boolean, Enum['true', 'false']]` +Data type: `Boolean` Tells Puppet whether to manage the Monit service. Default value: 'true' @@ -305,7 +305,7 @@ Default value: `$monit::params::start_delay` ##### `service_enable` -Data type: `Variant[Boolean, Enum['true', 'false']]` +Data type: `Boolean` From c11940e85666692d8542afe5dc259f8b1821ad64 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 15 Feb 2024 10:09:51 +0100 Subject: [PATCH 74/92] lint_fix --- manifests/init.pp | 1 - 1 file changed, 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 89cd75b..aa8ec20 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -132,7 +132,6 @@ String $service_name = $monit::params::service_name, Optional[Integer[1]] $start_delay = $monit::params::start_delay, ) inherits monit::params { - if $logfile and !($logfile =~ /^syslog(\s+facility\s+log_(local[0-7]|daemon))?/) { assert_type(Stdlib::Absolutepath, $logfile) } From 5f53294a5b130ac2a2d13dce552f95b06f4effc2 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 15 Feb 2024 10:16:44 +0100 Subject: [PATCH 75/92] reference correct variable --- manifests/firewall.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/firewall.pp b/manifests/firewall.pp index 0a1ec06..86abbc4 100644 --- a/manifests/firewall.pp +++ b/manifests/firewall.pp @@ -8,7 +8,7 @@ fail("Use of private class ${name} by ${caller_module_name}") } - if $monit::httpd_bool and $monit::manage_firewall_bool { + if $monit::httpd and $monit::manage_firewall { if defined('::firewall') { firewall { "${monit::httpd_port} allow Monit inbound traffic": jump => 'accept', From d8640dd571931362912670b64c2c201228f319e2 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 15 Feb 2024 10:22:45 +0100 Subject: [PATCH 76/92] cleanup last _bool variables --- manifests/config.pp | 4 ++-- manifests/service.pp | 2 +- templates/monitrc.erb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index b20ba5e..adb5302 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -21,8 +21,8 @@ owner => 'root', group => 'root', mode => '0755', - purge => $monit::config_dir_purge_bool, - recurse => $monit::config_dir_purge_bool, + purge => $monit::config_dir_purge, + recurse => $monit::config_dir_purge, require => Package['monit'], } diff --git a/manifests/service.pp b/manifests/service.pp index fa6979d..4275b88 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -8,7 +8,7 @@ fail("Use of private class ${name} by ${caller_module_name}") } - if $monit::service_manage_bool { + if $monit::service_manage { if $facts['osfamily'] == 'Debian' { file { '/etc/default/monit': content => $monit::default_file_content, diff --git a/templates/monitrc.erb b/templates/monitrc.erb index eac9509..6b8a8d6 100644 --- a/templates/monitrc.erb +++ b/templates/monitrc.erb @@ -40,8 +40,8 @@ set httpd port <%= @httpd_port %> and <%- end -%> <%- end -%> <%- if @mmonit_address -%> -set mmonit http<% if @mmonit_https_bool %>s<%- end -%>://<%= @mmonit_user %>:<%= @mmonit_password %>@<%= @mmonit_address %>:<%= @mmonit_port %>/collector -<%- if @mmonit_without_credential_bool -%> and register without credentials<%- end -%> +set mmonit http<% if @mmonit_https %>s<%- end -%>://<%= @mmonit_user %>:<%= @mmonit_password %>@<%= @mmonit_address %>:<%= @mmonit_port %>/collector +<%- if @mmonit_without_credential -%> and register without credentials<%- end -%> <%- end -%> include <%= @config_dir -%>/* From 6b093b6cb03210c902aa3d77f596892c91427aa1 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 15 Feb 2024 10:34:54 +0100 Subject: [PATCH 77/92] allow puppetlabs-firewall 8.x --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 771fcd7..6409c89 100644 --- a/metadata.json +++ b/metadata.json @@ -14,7 +14,7 @@ }, { "name": "puppetlabs/firewall", - "version_requirement": ">= 1.7.1 < 2.0.0" + "version_requirement": ">= 1.7.1 < 9.0.0" } ], "operatingsystem_support": [ From 4f3aa794899fc527b22b21badd8c84fff044191c Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 1 Jul 2023 15:48:44 +0200 Subject: [PATCH 78/92] puppetlabs/stdlib: Allow 9.x --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 6409c89..89b6e70 100644 --- a/metadata.json +++ b/metadata.json @@ -10,7 +10,7 @@ "dependencies": [ { "name": "puppetlabs/stdlib", - "version_requirement": ">= 4.6.0 < 6.0.0" + "version_requirement": ">= 4.6.0 < 10.0.0" }, { "name": "puppetlabs/firewall", From 7871a22d6c951ad638887cba0dc4722df7fb4ccd Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 15:52:47 +0100 Subject: [PATCH 79/92] remove legacy fact syntax --- .puppet-lint.rc | 1 - spec/classes/init_spec.rb | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.puppet-lint.rc b/.puppet-lint.rc index d2e5007..dd8272c 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1,4 +1,3 @@ --fail-on-warnings --no-parameter_documentation-check --no-parameter_types-check ---no-legacy_facts-check diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index adf8dad..e6b15f8 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -6,7 +6,7 @@ context "on #{os}" do let(:facts) { facts } - case facts[:osfamily] + case facts[:os]['family'] when 'Debian' config_file = '/etc/monit/monitrc' config_dir = '/etc/monit/conf.d' @@ -17,7 +17,7 @@ config_dir = '/etc/monit.d' service_hasstatus = true monit_version = '5' - config_file = case facts[:operatingsystem] + config_file = case facts[:os]['name'] when 'Amazon' '/etc/monit.conf' else @@ -64,14 +64,14 @@ end monit_config_fixture = if monit_version == '4' - File.read(fixtures("monitrc.4.#{facts[:osfamily]}")) + File.read(fixtures("monitrc.4.#{facts[:os]['family']}")) else - File.read(fixtures("monitrc.#{facts[:osfamily]}")) + File.read(fixtures("monitrc.#{facts[:os]['family']}")) end it { is_expected.to contain_file('monit_config').with_content(monit_config_fixture) } - if facts[:osfamily] == 'Debian' + if facts[:os]['family'] == 'Debian' it do is_expected.to contain_file('/etc/default/monit').with('notify' => 'Service[monit]'). with_content(%r{^#{default_file_content}$}) From 82577257a577c04c5d2508e29bb686f867385bba Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 16:17:06 +0100 Subject: [PATCH 80/92] remove legacy facts in pp files as well --- manifests/params.pp | 2 +- manifests/service.pp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index 455c87f..73cd68a 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -30,7 +30,7 @@ $mmonit_password = 'monit' $mmonit_without_credential = false - case $facts['osfamily'] { + case $facts['os']['family'] { 'Debian': { $config_file = '/etc/monit/monitrc' $config_dir = '/etc/monit/conf.d' diff --git a/manifests/service.pp b/manifests/service.pp index 4275b88..c76250a 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -9,7 +9,7 @@ } if $monit::service_manage { - if $facts['osfamily'] == 'Debian' { + if $facts['os']['family'] == 'Debian' { file { '/etc/default/monit': content => $monit::default_file_content, notify => Service[$monit::service_name], From ba66e53b2d3759454e98f58b8c209572f2b2b4a9 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 13 Feb 2024 23:20:56 +0100 Subject: [PATCH 81/92] remove unnecessary comment --- manifests/params.pp | 1 - 1 file changed, 1 deletion(-) diff --git a/manifests/params.pp b/manifests/params.pp index 73cd68a..2979961 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -57,5 +57,4 @@ fail("monit supports osfamilies Debian and RedHat. Detected osfamily is <${facts['os']['family']}>.") } } - #
} From a55cb2621d338f78b29bdcaa67ee531b031865f6 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 15 Feb 2024 11:18:08 +0100 Subject: [PATCH 82/92] set os facts for tests --- spec/defines/check_spec.rb | 236 ++++++++++++++----------------------- 1 file changed, 89 insertions(+), 147 deletions(-) diff --git a/spec/defines/check_spec.rb b/spec/defines/check_spec.rb index 4ee93db..0630d0e 100644 --- a/spec/defines/check_spec.rb +++ b/spec/defines/check_spec.rb @@ -5,165 +5,107 @@ 'include ::monit' end let(:title) { 'test' } - let(:facts) do - { - osfamily: 'Debian', - lsbdistcodename: 'squeeze', - monit_version: '5', - } - end - - context 'with default values for parameters' do - it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_class('monit') } - - it do - is_expected.to contain_file('/etc/monit/conf.d/test').with('ensure' => 'present', - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0644', - 'source' => nil, - 'content' => nil, - 'notify' => 'Service[monit]', - 'require' => 'Package[monit]') - end - end - %w[absent present].each do |value| - context "with ensure set to valid <#{value}>" do - let(:params) do - { - ensure: value, - } + on_supported_os.each do |os, facts| + context "on #{os}" do + let(:facts) do + facts end - it do - is_expected.to contain_file('/etc/monit/conf.d/test').with('ensure' => value, - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0644', - 'source' => nil, - 'content' => nil, - 'notify' => 'Service[monit]', - 'require' => 'Package[monit]') + context 'with default values for parameters' do + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_class('monit') } + + it do + is_expected.to contain_file('/etc/monit/conf.d/test').with('ensure' => 'present', + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0644', + 'source' => nil, + 'content' => nil, + 'notify' => 'Service[monit]', + 'require' => 'Package[monit]') + end end - end - end - - context 'with content set to a valid value' do - content = <<~END - check process ntpd with pidfile /var/run/ntpd.pid - start program = "/etc/init.d/ntpd start" - stop program = "/etc/init.d/ntpd stop" - if failed host 127.0.0.1 port 123 type udp then alert - if 5 restarts within 5 cycles then timeout - END - let(:params) do - { - content: content, - } - end - it do - is_expected.to contain_file('/etc/monit/conf.d/test').with('ensure' => 'present', - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0644', - 'source' => nil, - 'content' => content, - 'notify' => 'Service[monit]', - 'require' => 'Package[monit]') - end - end - - context 'with source set to a valid value' do - let(:params) do - { - source: 'puppet:///modules/monit/ntp', - } - end - - it do - is_expected.to contain_file('/etc/monit/conf.d/test').with('ensure' => 'present', - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0644', - 'source' => 'puppet:///modules/monit/ntp', - 'content' => nil, - 'notify' => 'Service[monit]', - 'require' => 'Package[monit]') - end - end - - context 'with content and source set at the same time' do - let(:params) do - { - content: 'content', - source: 'puppet:///modules/subject/test', - } - end + %w[absent present].each do |value| + context "with ensure set to valid <#{value}>" do + let(:params) do + { + ensure: value, + } + end - it 'fails' do - is_expected.to compile.and_raise_error(%r{Parameters source and content are mutually exclusive}) - end - end + it do + is_expected.to contain_file('/etc/monit/conf.d/test').with('ensure' => value, + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0644', + 'source' => nil, + 'content' => nil, + 'notify' => 'Service[monit]', + 'require' => 'Package[monit]') + end + end + end - describe 'variable type and content validations' do - # set needed custom facts and variables - let(:facts) do - { - osfamily: 'Debian', - lsbdistcodename: 'squeeze', - monit_version: '5', - } - end - let(:validation_params) do - { - # :param => 'value', - } - end + context 'with content set to a valid value' do + content = <<~END + check process ntpd with pidfile /var/run/ntpd.pid + start program = "/etc/init.d/ntpd start" + stop program = "/etc/init.d/ntpd stop" + if failed host 127.0.0.1 port 123 type udp then alert + if 5 restarts within 5 cycles then timeout + END + let(:params) do + { + content: content, + } + end - validations = { - 'regex_file_ensure' => { - name: ['ensure'], - valid: %w[present absent], - invalid: ['file', 'directory', 'link', ['array'], { 'ha' => 'sh' }, 3, 2.42, true, false, nil], - message: 'match for Enum\[\'absent\', \'present\'\]', - }, - 'string' => { - name: ['content'], - valid: ['string'], - invalid: [['array'], { 'ha' => 'sh' }, 3, 2.42, true, false], - message: 'value of type Undef or String', - }, - 'string_file_source' => { - name: ['source'], - valid: ['puppet:///modules/subject/test'], - invalid: [['array'], { 'ha' => 'sh' }, 3, 2.42, true, false], - message: 'value of type Undef or String', - }, - } + it do + is_expected.to contain_file('/etc/monit/conf.d/test').with('ensure' => 'present', + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0644', + 'source' => nil, + 'content' => content, + 'notify' => 'Service[monit]', + 'require' => 'Package[monit]') + end + end - validations.sort.each do |type, var| - var[:name].each do |var_name| - var[:valid].each do |valid| - context "with #{var_name} (#{type}) set to valid #{valid} (as #{valid.class})" do - let(:params) { validation_params.merge("#{var_name}": valid) } + context 'with source set to a valid value' do + let(:params) do + { + source: 'puppet:///modules/monit/ntp', + } + end - it { is_expected.to compile } - end + it do + is_expected.to contain_file('/etc/monit/conf.d/test').with('ensure' => 'present', + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0644', + 'source' => 'puppet:///modules/monit/ntp', + 'content' => nil, + 'notify' => 'Service[monit]', + 'require' => 'Package[monit]') end + end - var[:invalid].each do |invalid| - context "with #{var_name} (#{type}) set to invalid #{invalid} (as #{invalid.class})" do - let(:params) { validation_params.merge("#{var_name}": invalid) } + context 'with content and source set at the same time' do + let(:params) do + { + content: 'content', + source: 'puppet:///modules/subject/test', + } + end - it 'fails' do - is_expected.to compile.and_raise_error(%r{expects a #{var[:message]}}) - end - end + it 'fails' do + is_expected.to compile.and_raise_error(%r{Parameters source and content are mutually exclusive}) end - end # var[:name].each - end # validations.sort.each - end # describe 'variable type and content validations' + end + end + end end From f484339e67ae653f7af985ac7d9190d7a06bb09b Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 15 Feb 2024 21:20:08 +0100 Subject: [PATCH 83/92] dynamic confdir resolution for tests --- spec/defines/check_spec.rb | 70 +++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/spec/defines/check_spec.rb b/spec/defines/check_spec.rb index 0630d0e..35594e7 100644 --- a/spec/defines/check_spec.rb +++ b/spec/defines/check_spec.rb @@ -12,19 +12,25 @@ facts end + confdir = if facts[:os]['family'] == 'RedHat' + '/etc/monit.d' + else + '/etc/monit/conf.d' + end + context 'with default values for parameters' do it { is_expected.to compile.with_all_deps } it { is_expected.to contain_class('monit') } it do - is_expected.to contain_file('/etc/monit/conf.d/test').with('ensure' => 'present', - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0644', - 'source' => nil, - 'content' => nil, - 'notify' => 'Service[monit]', - 'require' => 'Package[monit]') + is_expected.to contain_file("#{confdir}/test").with('ensure' => 'present', + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0644', + 'source' => nil, + 'content' => nil, + 'notify' => 'Service[monit]', + 'require' => 'Package[monit]') end end @@ -37,14 +43,14 @@ end it do - is_expected.to contain_file('/etc/monit/conf.d/test').with('ensure' => value, - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0644', - 'source' => nil, - 'content' => nil, - 'notify' => 'Service[monit]', - 'require' => 'Package[monit]') + is_expected.to contain_file("#{confdir}/test").with('ensure' => value, + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0644', + 'source' => nil, + 'content' => nil, + 'notify' => 'Service[monit]', + 'require' => 'Package[monit]') end end end @@ -64,14 +70,14 @@ end it do - is_expected.to contain_file('/etc/monit/conf.d/test').with('ensure' => 'present', - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0644', - 'source' => nil, - 'content' => content, - 'notify' => 'Service[monit]', - 'require' => 'Package[monit]') + is_expected.to contain_file("#{confdir}/test").with('ensure' => 'present', + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0644', + 'source' => nil, + 'content' => content, + 'notify' => 'Service[monit]', + 'require' => 'Package[monit]') end end @@ -83,14 +89,14 @@ end it do - is_expected.to contain_file('/etc/monit/conf.d/test').with('ensure' => 'present', - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0644', - 'source' => 'puppet:///modules/monit/ntp', - 'content' => nil, - 'notify' => 'Service[monit]', - 'require' => 'Package[monit]') + is_expected.to contain_file("#{confdir}/test").with('ensure' => 'present', + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0644', + 'source' => 'puppet:///modules/monit/ntp', + 'content' => nil, + 'notify' => 'Service[monit]', + 'require' => 'Package[monit]') end end From 3286aa5fe77558a89d02c0694358084e596ff317 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 3 Jul 2023 00:01:14 +0200 Subject: [PATCH 84/92] Add Puppet 8 support --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 89b6e70..9cab714 100644 --- a/metadata.json +++ b/metadata.json @@ -66,7 +66,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 7.0.0 < 8.0.0" + "version_requirement": ">= 7.0.0 < 9.0.0" } ], "tags": [ From a8b7a7020d1ddeb70b5ba4a5c695e42402f0e5f9 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 15 Feb 2024 21:35:37 +0100 Subject: [PATCH 85/92] drop support for puppetlabs-firewall <5.0.0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 9cab714..0970013 100644 --- a/metadata.json +++ b/metadata.json @@ -14,7 +14,7 @@ }, { "name": "puppetlabs/firewall", - "version_requirement": ">= 1.7.1 < 9.0.0" + "version_requirement": ">= 5.0.0 < 9.0.0" } ], "operatingsystem_support": [ From 6b6e5b766fb8ae8d1bca8275753515d4b87c9540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Wed, 22 Nov 2023 16:35:39 -1000 Subject: [PATCH 86/92] Remove legacy top-scope syntax --- README.md | 2 +- spec/acceptance/class_spec.rb | 2 +- spec/defines/check_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 83c7c61..1485d4f 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ You can use the module [stahnma-epel](https://forge.puppetlabs.com/stahnma/epel) ### Beginning with monit ```puppet -include ::monit +include monit ``` ## Usage diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 2141f92..6bf5086 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -5,7 +5,7 @@ # Using puppet_apply as a helper it 'works with no errors' do pp = <<-EOS - include ::monit + include monit EOS # Run it twice and test for idempotency diff --git a/spec/defines/check_spec.rb b/spec/defines/check_spec.rb index 35594e7..834fd28 100644 --- a/spec/defines/check_spec.rb +++ b/spec/defines/check_spec.rb @@ -2,7 +2,7 @@ describe 'monit::check' do let :pre_condition do - 'include ::monit' + 'include monit' end let(:title) { 'test' } From 7de23c570c7a8a61da5a65493a6a4fa05d5eff30 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 15 Feb 2024 21:54:09 +0100 Subject: [PATCH 87/92] add debian 12 support --- metadata.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 0970013..1b26873 100644 --- a/metadata.json +++ b/metadata.json @@ -27,7 +27,8 @@ { "operatingsystem": "Debian", "operatingsystemrelease": [ - "11" + "11", + "12" ] }, { From 75311b9e52652b95db3164a997bba50f30ba8fd4 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 15 Feb 2024 21:55:27 +0100 Subject: [PATCH 88/92] add ubuntu 20.04 and 22.04 support --- metadata.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 1b26873..312d2c8 100644 --- a/metadata.json +++ b/metadata.json @@ -34,7 +34,9 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "18.04" + "18.04", + "20.04", + "22.04" ] }, { From 6cbf5034e317278293a1e5a50a65dd48cc6668e2 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 15 Feb 2024 22:29:14 +0100 Subject: [PATCH 89/92] drop ubuntu 18.04 support --- metadata.json | 1 - 1 file changed, 1 deletion(-) diff --git a/metadata.json b/metadata.json index 312d2c8..94cd461 100644 --- a/metadata.json +++ b/metadata.json @@ -34,7 +34,6 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "18.04", "20.04", "22.04" ] From 1330d26ee2bffd774f8ec5d0ea191945ea2918be Mon Sep 17 00:00:00 2001 From: markuszilch Date: Fri, 16 Feb 2024 06:57:41 +0100 Subject: [PATCH 90/92] add EL 8 and 9 support --- metadata.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/metadata.json b/metadata.json index 94cd461..3bc9193 100644 --- a/metadata.json +++ b/metadata.json @@ -41,14 +41,17 @@ { "operatingsystem": "RedHat", "operatingsystemrelease": [ - "7" + "7", + "8", + "9" ] }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ "7", - "8" + "8", + "9" ] }, { From d60897181b94a8af227e2008ba958aeae6913715 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Fri, 16 Feb 2024 07:05:15 +0100 Subject: [PATCH 91/92] add AlmaLinux 8 and 9 support --- metadata.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/metadata.json b/metadata.json index 3bc9193..56229e0 100644 --- a/metadata.json +++ b/metadata.json @@ -61,6 +61,13 @@ "9" ] }, + { + "operatingsystem": "AlmaLinux", + "operatingsystemrelease": [ + "8", + "9" + ] + }, { "operatingsystem": "Scientific", "operatingsystemrelease": [ From fb13728c3c00fc26bfd823ba67cdcdea77a31196 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Fri, 16 Feb 2024 07:06:45 +0100 Subject: [PATCH 92/92] add Rocky 8 and 9 support --- metadata.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/metadata.json b/metadata.json index 56229e0..4f172fc 100644 --- a/metadata.json +++ b/metadata.json @@ -68,6 +68,13 @@ "9" ] }, + { + "operatingsystem": "Rocky", + "operatingsystemrelease": [ + "8", + "9" + ] + }, { "operatingsystem": "Scientific", "operatingsystemrelease": [