From 1621389e69e080b7c70064622702da0c066fe1aa Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 25 Nov 2020 17:02:46 +0100 Subject: [PATCH 01/27] modulesync 4.0.0 --- .github/CONTRIBUTING.md | 5 +-- .github/workflows/ci.yml | 75 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 29 ++++++++++++++ .msync.yml | 2 +- .pmtignore | 17 +++++++- .travis.yml | 49 ----------------------- Gemfile | 27 +++---------- Rakefile | 9 ++++- 8 files changed, 136 insertions(+), 77 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index cace33e6..f1f88ccf 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -232,14 +232,14 @@ simple tests against it after applying the module. You can run this with: ```sh -bundle exec rake acceptance +bundle exec rake beaker ``` This will run the tests on the module's default nodeset. You can override the nodeset used, e.g., ```sh -BEAKER_set=centos-7-x64 bundle exec rake acceptance +BEAKER_set=centos-7-x64 bundle exec rake beaker ``` There are default rake tasks for the various acceptance test modules, e.g., @@ -269,7 +269,6 @@ The following strings are known to work: * ubuntu2004 * debian9 * debian10 -* centos6 * centos7 * centos8 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..b4f47e87 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,75 @@ +name: CI + +on: pull_request + +jobs: + setup_matrix: + name: 'Setup Test Matrix' + runs-on: ubuntu-latest + outputs: + beaker_setfiles: ${{ steps.get-outputs.outputs.beaker_setfiles }} + puppet_major_versions: ${{ steps.get-outputs.outputs.puppet_major_versions }} + puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} + env: + BUNDLE_WITHOUT: development:test:release + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + - name: Run rake validate + run: bundle exec rake validate + - name: Setup Test Matrix + id: get-outputs + run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false + + unit: + needs: setup_matrix + runs-on: ubuntu-latest + 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 + + acceptance: + needs: setup_matrix + runs-on: ubuntu-latest + env: + BUNDLE_WITHOUT: development:test:release + strategy: + fail-fast: false + matrix: + setfile: ${{fromJson(needs.setup_matrix.outputs.beaker_setfiles)}} + puppet: ${{fromJson(needs.setup_matrix.outputs.puppet_major_versions)}} + name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }} + steps: + - name: Enable IPv6 on docker + run: | + echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json + sudo service docker restart + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + - name: Run tests + run: bundle exec rake beaker + env: + BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }} + BEAKER_setfile: ${{ matrix.setfile.value }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..68b85284 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,29 @@ +name: Release + +on: + push: + tags: + - '*' + +env: + BUNDLE_WITHOUT: development:test:system_tests + +jobs: + deploy: + name: 'deploy to forge' + runs-on: ubuntu-latest + 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/.msync.yml b/.msync.yml index 5758aced..a0770a83 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1,2 +1,2 @@ --- -modulesync_config_version: '3.1.0' +modulesync_config_version: '4.0.0' diff --git a/.pmtignore b/.pmtignore index 4e6d54b8..33a8c65d 100644 --- a/.pmtignore +++ b/.pmtignore @@ -1,11 +1,12 @@ docs/ pkg/ +Gemfile Gemfile.lock Gemfile.local vendor/ .vendor/ -spec/fixtures/manifests/ -spec/fixtures/modules/ +spec/ +Rakefile .vagrant/ .bundle/ .ruby-version @@ -13,9 +14,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/.travis.yml b/.travis.yml deleted file mode 100644 index c0929b19..00000000 --- a/.travis.yml +++ /dev/null @@ -1,49 +0,0 @@ ---- -# yamllint disable rule:line-length rule:truthy -os: linux -dist: focal -language: ruby -cache: bundler -before_install: - - yes | gem update --system - - bundle --version -script: - - 'bundle exec rake $CHECK' -jobs: - fast_finish: true - include: - - rvm: 2.4.4 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 5.0" CHECK=test - - rvm: 2.5.3 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 6.0" CHECK=test_with_coveralls - - rvm: 2.5.3 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 6.0" CHECK=rubocop - - rvm: 2.4.4 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes -branches: - only: - - master - - /^v\d/ -notifications: - email: false - webhooks: https://voxpupu.li/incoming/travis - irc: - on_success: always - on_failure: always - channels: - - "chat.freenode.org#voxpupuli-notifications" -deploy: - provider: puppetforge - username: puppet - password: - secure: "I/IK9bG88UOVll0hpuxluGp6IY5gicLaDHug/jGwfuWlN4R3coPAqWO/sGOyaEMbc9V5/Fw0H0ThQdYY3eI3rW5M4a1r9TSg/Z9d46JximPat/XvcpLvUc0G+QxCVhTRmYqD7u0wuX5VSric0PQU6KSjH84ZbKgAA8l04NGObgUI6ugjaNBhkaoIP3glYcHY1fgn5vwER2T/iiXZ5q3qDtYboR2GWLUODLWSpXWZRy7oYvp/RGTSe1fKjDwkbtrZiFvRoyzQvDhEAr+0MFDxJiOLdoKJFeBs6BrF2lyUJ6udlOmEYV94DfKoxEhhlZbxkPCh4SedT79i3c3xkKlf9wfAsEyGSTfc9OtyYBfoHcE9GMRZIvLf2Jn2mpHMO2694Fil4d7JdhLYQ/9Gv9VgFrYosQdVlDh+RxE2CXzrO39LhA1GeOY/n1r+DdvuCJs1fZfBZ1ORb7eQNp1BknurJ8FoYCKlEgihS223IJEnGueDdYkchMSRjS6C3a/HIzBz0RvEDGXD3WgrY5edRIaGziSoSr5eXzumK7N1FFBlpfY/7j38zI1ibWN4PRakmZppeeWOb1xiuVS5JkngCLoYerxLJEEjt8+klXhwnqqJukFuObaVsyprSWp+aAu/UHD/4w/6/lC6Elv+VzccLpITOR5b7VdAuCttQ5PGse6fits=" - on: - tags: true - # all_branches is required to use tags - all_branches: true - # Only publish the build marked with "DEPLOY_TO_FORGE" - condition: "$DEPLOY_TO_FORGE = yes" diff --git a/Gemfile b/Gemfile index 2fce93ce..0d0a9fb2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,15 +1,5 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" -def location_for(place, fake_version = nil) - if place =~ /^(git[:@][^#]*)#(.*)/ - [fake_version, { :git => $1, :branch => $2, :require => false }].compact - elsif place =~ /^file:\/\/(.*)/ - ['>= 0', { :path => File.expand_path($1), :require => false }] - else - [place, { :require => false }] - end -end - group :test do gem 'voxpupuli-test', '~> 2.1', :require => false gem 'coveralls', :require => false @@ -17,14 +7,13 @@ group :test do end group :development do - gem 'travis', :require => false - gem 'travis-lint', :require => false gem 'guard-rake', :require => false gem 'overcommit', '>= 0.39.1', :require => false end group :system_tests do - gem 'voxpupuli-acceptance', :require => false + gem 'puppet_metadata', '~> 0.3.0', :require => false + gem 'voxpupuli-acceptance', :require => false end group :release do @@ -34,15 +23,11 @@ group :release do gem 'puppet-strings', '>= 2.2', :require => false end +gem 'puppetlabs_spec_helper', '~> 2.0', :require => false +gem 'rake', :require => false +gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] - -if facterversion = ENV['FACTER_GEM_VERSION'] - gem 'facter', facterversion.to_s, :require => false, :groups => [:test] -else - gem 'facter', :require => false, :groups => [:test] -end - -ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 6.0' : puppetversion = ENV['PUPPET_VERSION'].to_s +puppetversion = ENV['PUPPET_VERSION'] || '~> 6.0' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby diff --git a/Rakefile b/Rakefile index b450fe7b..d1bf7491 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,10 @@ -require 'voxpupuli/test/rake' +# Attempt to load voxupuli-test (which pulls in puppetlabs_spec_helper), +# otherwise attempt to load it directly. +begin + require 'voxpupuli/test/rake' +rescue LoadError + require 'puppetlabs_spec_helper/rake_tasks' +end # load optional tasks for releases # only available if gem group releases is installed @@ -26,6 +32,7 @@ end begin require 'github_changelog_generator/task' + require 'puppet_blacksmith' GitHubChangelogGenerator::RakeTask.new :changelog do |config| version = (Blacksmith::Modulefile.new).version config.future_release = "v#{version}" if version =~ /^\d+\.\d+.\d+$/ From 0711110c098dcf0fe4d02882ede57b03914a1ecd Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 17 Sep 2021 23:48:29 +0200 Subject: [PATCH 02/27] modulesync 4.2.0 --- .editorconfig | 3 ++- .github/CONTRIBUTING.md | 36 +++-------------------------- .github/workflows/ci.yml | 43 +++++++++++++++++++++++------------ .github/workflows/release.yml | 5 ++++ .gitignore | 3 +++ .msync.yml | 5 +++- .overcommit.yml | 3 ++- .pmtignore | 3 +++ .rspec | 3 +++ .rspec_parallel | 3 +++ .rubocop.yml | 3 +++ .yardopts | 2 -- Dockerfile | 5 +++- Gemfile | 23 ++++++++++--------- Rakefile | 23 ++++++++++++++----- spec/spec_helper.rb | 5 ++-- 16 files changed, 95 insertions(+), 73 deletions(-) delete mode 100644 .yardopts diff --git a/.editorconfig b/.editorconfig index d77700e3..ecb10a80 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,6 +1,7 @@ # editorconfig.org -# MANAGED BY MODULESYNC +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ root = true diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index f1f88ccf..048d2b55 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -25,7 +25,7 @@ By participating in this project you agree to abide by its terms. * Fork the repo. * Create a separate branch for your change. -* We only take pull requests with passing tests, and documentation. [travis-ci](http://travis-ci.org) runs the tests for us. You can also execute them locally. This is explained [in a later section](#the-test-matrix). +* 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. @@ -232,33 +232,7 @@ simple tests against it after applying the module. You can run this with: ```sh -bundle exec rake beaker -``` - -This will run the tests on the module's default nodeset. You can override the -nodeset used, e.g., - -```sh -BEAKER_set=centos-7-x64 bundle exec rake beaker -``` - -There are default rake tasks for the various acceptance test modules, e.g., - -```sh -bundle exec rake beaker:centos-7-x64 -bundle exec rake beaker:ssh:centos-7-x64 -``` - -If you don't want to have to recreate the virtual machine every time you can -use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will at -least need `BEAKER_provision` set to yes (the default). The Vagrantfile for the -created virtual machines will be in `.vagrant/beaker_vagrant_files`. - -Beaker also supports docker containers. We also use that in our automated CI -pipeline at [travis-ci](http://travis-ci.org). To use that instead of Vagrant: - -```sh -PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian10-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker +BEAKER_setfile=debian10-x64 bundle exec rake beaker ``` You can replace the string `debian10` with any common operating system. @@ -272,11 +246,7 @@ The following strings are known to work: * centos7 * centos8 -The easiest way to debug in a docker container is to open a shell: - -```sh -docker exec -it -u root ${container_id_or_name} bash -``` +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/workflows/ci.yml b/.github/workflows/ci.yml index b4f47e87..d08d05e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,26 +1,36 @@ +--- +# 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: - beaker_setfiles: ${{ steps.get-outputs.outputs.beaker_setfiles }} - puppet_major_versions: ${{ steps.get-outputs.outputs.puppet_major_versions }} 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:test:release + BUNDLE_WITHOUT: development:system_tests:release steps: - uses: actions/checkout@v2 - name: Setup ruby uses: ruby/setup-ruby@v1 with: - ruby-version: '2.7' + ruby-version: '3.0' bundler-cache: true - - name: Run rake validate - run: bundle exec rake validate + - 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 @@ -28,6 +38,7 @@ jobs: unit: needs: setup_matrix runs-on: ubuntu-latest + timeout-minutes: 40 strategy: fail-fast: false matrix: @@ -44,7 +55,7 @@ jobs: ruby-version: ${{ matrix.ruby }} bundler-cache: true - name: Run tests - run: bundle exec rake + run: bundle exec rake parallel_spec acceptance: needs: setup_matrix @@ -54,22 +65,26 @@ jobs: strategy: fail-fast: false matrix: - setfile: ${{fromJson(needs.setup_matrix.outputs.beaker_setfiles)}} - puppet: ${{fromJson(needs.setup_matrix.outputs.puppet_major_versions)}} + include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}} name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }} steps: - - name: Enable IPv6 on docker - run: | - echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json - sudo service docker restart - uses: actions/checkout@v2 - name: Setup ruby uses: ruby/setup-ruby@v1 with: - ruby-version: '2.7' + 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 index 68b85284..664ba694 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,3 +1,7 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + name: Release on: @@ -12,6 +16,7 @@ jobs: deploy: name: 'deploy to forge' runs-on: ubuntu-latest + if: github.repository_owner == 'voxpupuli' steps: - name: Checkout repository uses: actions/checkout@v2 diff --git a/.gitignore b/.gitignore index e9b3cf4b..9b95224c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + pkg/ Gemfile.lock Gemfile.local diff --git a/.msync.yml b/.msync.yml index a0770a83..43966c2f 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1,2 +1,5 @@ --- -modulesync_config_version: '4.0.0' +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +modulesync_config_version: '4.2.0' diff --git a/.overcommit.yml b/.overcommit.yml index 0af0fdc0..d367adae 100644 --- a/.overcommit.yml +++ b/.overcommit.yml @@ -1,4 +1,5 @@ -# Managed by https://github.com/voxpupuli/modulesync_configs +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ # # Hooks are only enabled if you take action. # diff --git a/.pmtignore b/.pmtignore index 33a8c65d..65f50514 100644 --- a/.pmtignore +++ b/.pmtignore @@ -1,3 +1,6 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + docs/ pkg/ Gemfile diff --git a/.rspec b/.rspec index 8c18f1ab..f634583d 100644 --- a/.rspec +++ b/.rspec @@ -1,2 +1,5 @@ +# 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 index e4d136b7..a9a84f85 100644 --- a/.rspec_parallel +++ b/.rspec_parallel @@ -1 +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 198a3599..53ac1898 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,6 @@ --- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + inherit_gem: voxpupuli-test: rubocop.yml diff --git a/.yardopts b/.yardopts deleted file mode 100644 index 3687f518..00000000 --- a/.yardopts +++ /dev/null @@ -1,2 +0,0 @@ ---markup markdown ---output-dir docs/ diff --git a/Dockerfile b/Dockerfile index 6fd63422..e3cf307f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,7 @@ -FROM ruby:2.5.3 +# MANAGED BY MODULESYNC +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +FROM ruby:2.7 WORKDIR /opt/puppet diff --git a/Gemfile b/Gemfile index 0d0a9fb2..a39114ce 100644 --- a/Gemfile +++ b/Gemfile @@ -1,9 +1,13 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + source ENV['GEM_SOURCE'] || "https://rubygems.org" group :test do - gem 'voxpupuli-test', '~> 2.1', :require => false - gem 'coveralls', :require => false - gem 'simplecov-console', :require => false + gem 'voxpupuli-test', '~> 2.5', :require => false + gem 'coveralls', :require => false + gem 'simplecov-console', :require => false + gem 'puppet_metadata', '~> 1.0', :require => false end group :development do @@ -12,22 +16,19 @@ group :development do end group :system_tests do - gem 'puppet_metadata', '~> 0.3.0', :require => false - gem 'voxpupuli-acceptance', :require => false + gem 'voxpupuli-acceptance', '~> 1.0', :require => false end group :release do - gem 'github_changelog_generator', :require => false, :git => 'https://github.com/voxpupuli/github-changelog-generator', :branch => 'voxpupuli_essential_fixes' - gem 'puppet-blacksmith', :require => false - gem 'voxpupuli-release', :require => false - gem 'puppet-strings', '>= 2.2', :require => false + gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' + gem 'voxpupuli-release', '>= 1.0.2', :require => false + gem 'puppet-strings', '>= 2.2', :require => false end -gem 'puppetlabs_spec_helper', '~> 2.0', :require => false gem 'rake', :require => false gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_VERSION'] || '~> 6.0' +puppetversion = ENV['PUPPET_VERSION'] || '>= 6.0' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby diff --git a/Rakefile b/Rakefile index d1bf7491..80b799d6 100644 --- a/Rakefile +++ b/Rakefile @@ -1,9 +1,22 @@ +# 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), # otherwise attempt to load it directly. begin require 'voxpupuli/test/rake' rescue LoadError - require 'puppetlabs_spec_helper/rake_tasks' + begin + require 'puppetlabs_spec_helper/rake_tasks' + rescue LoadError + end +end + +# load optional tasks for acceptance +# only available if gem group releases is installed +begin + require 'voxpupuli/acceptance/rake' +rescue LoadError end # load optional tasks for releases @@ -34,14 +47,12 @@ begin require 'github_changelog_generator/task' require 'puppet_blacksmith' GitHubChangelogGenerator::RakeTask.new :changelog do |config| - version = (Blacksmith::Modulefile.new).version - config.future_release = "v#{version}" if version =~ /^\d+\.\d+.\d+$/ + 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' - metadata_json = File.join(File.dirname(__FILE__), 'metadata.json') - metadata = JSON.load(File.read(metadata_json)) - config.project = metadata['name'] + config.project = metadata.metadata['name'] end # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 59041394..13da4ce5 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,5 @@ -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ RSpec.configure do |c| c.mock_with :mocha From 825e0da4eaff46e92a5cffc016c9374431ef4ef5 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 15 Dec 2021 19:57:37 +0100 Subject: [PATCH 03/27] modulesync 5.1.0 --- .msync.yml | 2 +- .puppet-lint.rc | 3 +++ Gemfile | 4 ++-- Rakefile | 2 +- spec/spec_helper.rb | 10 +++++----- 5 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 .puppet-lint.rc diff --git a/.msync.yml b/.msync.yml index 43966c2f..a83abd9b 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: '4.2.0' +modulesync_config_version: '5.1.0' diff --git a/.puppet-lint.rc b/.puppet-lint.rc new file mode 100644 index 00000000..dd8272c7 --- /dev/null +++ b/.puppet-lint.rc @@ -0,0 +1,3 @@ +--fail-on-warnings +--no-parameter_documentation-check +--no-parameter_types-check diff --git a/Gemfile b/Gemfile index a39114ce..b6dcf456 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" group :test do - gem 'voxpupuli-test', '~> 2.5', :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 @@ -21,7 +21,7 @@ end group :release do gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' - gem 'voxpupuli-release', '>= 1.0.2', :require => false + gem 'voxpupuli-release', '>= 1.2.0', :require => false gem 'puppet-strings', '>= 2.2', :require => false end diff --git a/Rakefile b/Rakefile index 80b799d6..f92f0516 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' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 13da4ce5..78e8b77e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ @@ -7,15 +9,13 @@ # 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', __FILE__)) +ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../lib', __dir__)) require 'voxpupuli/test/spec_helper' if File.exist?(File.join(__dir__, 'default_module_facts.yml')) facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) - if facts - facts.each do |name, value| - add_custom_fact name.to_sym, value - end + facts&.each do |name, value| + add_custom_fact name.to_sym, value end end From 758dc26aaea02ca728e1638e26dc42ea0a979f99 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 15 Dec 2021 20:42:28 +0100 Subject: [PATCH 04/27] rubocop: autofix --- lib/facter/cassandracmsheapnewsize.rb | 2 + lib/facter/cassandracmsmaxheapsize.rb | 2 + lib/facter/cassandraheapnewsize.rb | 2 + lib/facter/cassandramajorversion.rb | 2 + lib/facter/cassandramaxheapsize.rb | 2 + lib/facter/cassandraminorversion.rb | 2 + lib/facter/cassandrapatchversion.rb | 2 + lib/facter/cassandrarelease.rb | 2 + spec/acceptance/bootstrap_spec.rb | 4 +- spec/acceptance/cassandra_spec.rb | 13 +- spec/classes/apache_repo_spec.rb | 32 ++--- spec/classes/datastax_agent_spec.rb | 64 ++++----- spec/classes/datastax_repo_spec.rb | 28 ++-- spec/classes/dse_spec.rb | 10 +- spec/classes/firewall_ports_spec.rb | 10 +- spec/classes/init_spec.rb | 126 +++++++++--------- spec/classes/java_spec.rb | 70 +++++----- spec/classes/optutils_spec.rb | 26 ++-- spec/classes/params_spec.rb | 8 +- spec/classes/schema_spec.rb | 30 +++-- spec/classes/system/swapoff_spec.rb | 16 ++- spec/classes/system/sysctl_spec.rb | 28 ++-- .../system/transparent_hugepage_spec.rb | 22 +-- spec/defines/file_spec.rb | 16 ++- .../private/firewall_ports/rule_spec.rb | 6 +- spec/defines/schema/cql_type_spec.rb | 56 ++++---- spec/defines/schema/index_spec.rb | 56 ++++---- spec/defines/schema/keyspace_spec.rb | 54 ++++---- spec/defines/schema/permission_spec.rb | 94 ++++++------- spec/defines/schema/table_spec.rb | 34 ++--- spec/defines/schema/user_spec.rb | 80 +++++------ spec/spec_helper_acceptance.rb | 34 ++--- .../facter/cassandracmsheapnewsize_spec.rb | 3 + .../facter/cassandracmsmaxheapsize_spec.rb | 3 + spec/unit/facter/cassandraheapnewsize_spec.rb | 3 + .../unit/facter/cassandramajorversion_spec.rb | 3 + spec/unit/facter/cassandramaxheapsize_spec.rb | 3 + .../unit/facter/cassandraminorversion_spec.rb | 3 + .../unit/facter/cassandrapatchversion_spec.rb | 3 + spec/unit/facter/cassandrarelease_spec.rb | 3 + 40 files changed, 524 insertions(+), 433 deletions(-) diff --git a/lib/facter/cassandracmsheapnewsize.rb b/lib/facter/cassandracmsheapnewsize.rb index 5a8b210d..f4b346de 100644 --- a/lib/facter/cassandracmsheapnewsize.rb +++ b/lib/facter/cassandracmsheapnewsize.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Returns a value (MB) that might be suitable to set the HEAP_NEWSIZE when using # the Concurrent Mark Sweep (CMS) Collector. # See [Tuning Java resources] diff --git a/lib/facter/cassandracmsmaxheapsize.rb b/lib/facter/cassandracmsmaxheapsize.rb index 29b87e18..0a1dd5db 100644 --- a/lib/facter/cassandracmsmaxheapsize.rb +++ b/lib/facter/cassandracmsmaxheapsize.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Returns a value (MB) that might be suitable to set the MAX_HEAP_SIZE when using # the Concurrent Mark Sweep (CMS) Collector. # See [Tuning Java resources] diff --git a/lib/facter/cassandraheapnewsize.rb b/lib/facter/cassandraheapnewsize.rb index d98bfab2..0c4a2ca9 100644 --- a/lib/facter/cassandraheapnewsize.rb +++ b/lib/facter/cassandraheapnewsize.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Returns a value (MB) that might be suitable to set the HEAP_NEWSIZE. # See [Tuning Java resources] # (https://docs.datastax.com/en/cassandra/2.1/cassandra/operations/ops_tune_jvm_c.html) diff --git a/lib/facter/cassandramajorversion.rb b/lib/facter/cassandramajorversion.rb index a4e79624..5240699f 100644 --- a/lib/facter/cassandramajorversion.rb +++ b/lib/facter/cassandramajorversion.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Extract the major version from the cassandrarelease fact. # @caveats # Requires that the cassandrarelease has been successfully retrieved. diff --git a/lib/facter/cassandramaxheapsize.rb b/lib/facter/cassandramaxheapsize.rb index 8251d1c6..a83c1140 100644 --- a/lib/facter/cassandramaxheapsize.rb +++ b/lib/facter/cassandramaxheapsize.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Returns a value (MB) that might be suitable to set the MAX_HEAP_SIZE. # See [Tuning Java resources] # (https://docs.datastax.com/en/cassandra/2.1/cassandra/operations/ops_tune_jvm_c.html) diff --git a/lib/facter/cassandraminorversion.rb b/lib/facter/cassandraminorversion.rb index 35f2418c..ff5af824 100644 --- a/lib/facter/cassandraminorversion.rb +++ b/lib/facter/cassandraminorversion.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Extract the minor version from the cassandrarelease fact. # @caveats # Requires that the cassandrarelease has been successfully retrieved. diff --git a/lib/facter/cassandrapatchversion.rb b/lib/facter/cassandrapatchversion.rb index 6339a947..fa7c5cc3 100644 --- a/lib/facter/cassandrapatchversion.rb +++ b/lib/facter/cassandrapatchversion.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Extract the patch version from the cassandrarelease fact. # @caveats # Requires that the cassandrarelease has been successfully retrieved. diff --git a/lib/facter/cassandrarelease.rb b/lib/facter/cassandrarelease.rb index 13bf139f..ea085e39 100644 --- a/lib/facter/cassandrarelease.rb +++ b/lib/facter/cassandrarelease.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Extract the release string from the running Cassandra instance. # # @resolution diff --git a/spec/acceptance/bootstrap_spec.rb b/spec/acceptance/bootstrap_spec.rb index c92fd61d..18c6e595 100644 --- a/spec/acceptance/bootstrap_spec.rb +++ b/spec/acceptance/bootstrap_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' osfamily = fact('osfamily') @@ -6,7 +8,7 @@ bootstrap_pp = t.bootstrap_pp() describe 'Test Entry Criteria' do - it "Should work with no errors (#{osfamily})" do + it "works with no errors (#{osfamily})" do apply_manifest(bootstrap_pp, catch_failures: true) shell('[ -d /opt/rh/ruby200 ] && /usr/bin/gem install puppet -v 3.8.7 --no-rdoc --no-ri; true') end diff --git a/spec/acceptance/cassandra_spec.rb b/spec/acceptance/cassandra_spec.rb index d7f4716b..b14be986 100644 --- a/spec/acceptance/cassandra_spec.rb +++ b/spec/acceptance/cassandra_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' describe 'cassandra' do @@ -26,16 +28,16 @@ describe service('cassandra') do it "check Cassandra-#{version} is running and enabled" do - is_expected.to be_running - is_expected.to be_enabled + expect(subject).to be_running + expect(subject).to be_enabled end end if fact('osfamily') == 'RedHat' describe service('datastax-agent') do it 'check service status' do - is_expected.to be_running - is_expected.to be_enabled + expect(subject).to be_running + expect(subject).to be_enabled end end end @@ -45,6 +47,7 @@ apply_manifest(t.schema_create_pp, catch_failures: true) end + # rubocop:disable Lint/FloatComparison if version != 2.1 it 'check code is idempotent' do expect(apply_manifest(t.schema_create_pp, catch_failures: true).exit_code).to be_zero @@ -119,6 +122,8 @@ end next unless version != 3.0 + # rubocop:enable Lint/FloatComparison + describe "Uninstall #{version}." do it 'works with no errors' do apply_manifest(t.cassandra_uninstall_pp, catch_failures: true) diff --git a/spec/classes/apache_repo_spec.rb b/spec/classes/apache_repo_spec.rb index 7a143c12..69aec965 100644 --- a/spec/classes/apache_repo_spec.rb +++ b/spec/classes/apache_repo_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra::apache_repo' do context 'On a RedHat OS with defaults for all parameters' do @@ -5,9 +7,9 @@ { osfamily: 'RedHat', os: { - 'family' => 'RedHat', + 'family' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -22,16 +24,16 @@ end it do - is_expected.to have_resource_count(1) + expect(subject).to have_resource_count(1) - is_expected.to contain_class('cassandra::apache_repo').only_with( - 'descr' => 'Repo for Apache Cassandra', - 'key_id' => 'A26E528B271F19B9E5D8E19EA278B781FE4B2BDA', + expect(subject).to contain_class('cassandra::apache_repo').only_with( + 'descr' => 'Repo for Apache Cassandra', + 'key_id' => 'A26E528B271F19B9E5D8E19EA278B781FE4B2BDA', 'key_url' => 'https://www.apache.org/dist/cassandra/KEYS', 'release' => '311x' ) - is_expected.to contain_yumrepo('cassandra_apache').with( + expect(subject).to contain_yumrepo('cassandra_apache').with( ensure: 'present', descr: 'Repo for Apache Cassandra', baseurl: 'http://www.apache.org/dist/cassandra/redhat/311x', @@ -49,10 +51,10 @@ lsbdistid: 'Debian', lsbdistrelease: '9', os: { - 'family' => 'Debian', - 'name' => 'Debian', + 'family' => 'Debian', + 'name' => 'Debian', 'release' => { - 'full' => '9.9', + 'full' => '9.9', 'major' => '9', 'minor' => '9' } @@ -61,22 +63,22 @@ end it do - is_expected.to contain_class('apt') - is_expected.to contain_class('apt::update') + expect(subject).to contain_class('apt') + expect(subject).to contain_class('apt::update') - is_expected.to contain_apt__key('apache.cassandra').with( + expect(subject).to contain_apt__key('apache.cassandra').with( id: 'A26E528B271F19B9E5D8E19EA278B781FE4B2BDA', source: 'https://www.apache.org/dist/cassandra/KEYS' ) - is_expected.to contain_apt__source('cassandra.sources').with( + expect(subject).to contain_apt__source('cassandra.sources').with( location: 'http://www.apache.org/dist/cassandra/debian', comment: 'Repo for Apache Cassandra', release: 'main', include: { 'src' => false } ).that_notifies('Exec[update-apache-cassandra-repo]') - is_expected.to contain_exec('update-apache-cassandra-repo').with( + expect(subject).to contain_exec('update-apache-cassandra-repo').with( refreshonly: true, command: '/bin/true' ) diff --git a/spec/classes/datastax_agent_spec.rb b/spec/classes/datastax_agent_spec.rb index 883f7b05..5847d7e7 100644 --- a/spec/classes/datastax_agent_spec.rb +++ b/spec/classes/datastax_agent_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra::datastax_agent' do @@ -7,10 +9,10 @@ osfamily: 'RedHat', operatingsystemmajrelease: '6', os: { - 'name' => 'RedHat', - 'family' => 'RedHat', + 'name' => 'RedHat', + 'family' => 'RedHat', 'release' => { - 'full' => '6.10', + 'full' => '6.10', 'major' => '6', 'minor' => '10' } @@ -19,27 +21,27 @@ end it do - is_expected.to compile.with_all_deps - - is_expected.to have_resource_count(10) - - is_expected.to contain_class('cassandra::datastax_agent').with( - 'address_config_file' => '/var/lib/datastax-agent/conf/address.yaml', - 'defaults_file' => '/etc/default/datastax-agent', - 'package_ensure' => 'present', - 'package_name' => 'datastax-agent', - 'service_ensure' => 'running', - 'service_enable' => true, - 'service_name' => 'datastax-agent', - 'settings' => {} + expect(subject).to compile.with_all_deps + + expect(subject).to have_resource_count(10) + + expect(subject).to contain_class('cassandra::datastax_agent').with( + 'address_config_file' => '/var/lib/datastax-agent/conf/address.yaml', + 'defaults_file' => '/etc/default/datastax-agent', + 'package_ensure' => 'present', + 'package_name' => 'datastax-agent', + 'service_ensure' => 'running', + 'service_enable' => true, + 'service_name' => 'datastax-agent', + 'settings' => {} ) - is_expected.to contain_package('datastax-agent').with( + expect(subject).to contain_package('datastax-agent').with( ensure: 'present', notify: 'Exec[datastax_agent_reload_systemctl]' ).that_notifies('Exec[datastax_agent_reload_systemctl]') - is_expected.to contain_exec('datastax_agent_reload_systemctl').only_with( + expect(subject).to contain_exec('datastax_agent_reload_systemctl').only_with( command: '/usr/bin/systemctl daemon-reload', onlyif: 'test -x /usr/bin/systemctl', path: ['/usr/bin', '/bin'], @@ -47,14 +49,14 @@ notify: 'Service[datastax-agent]' ).that_notifies('Service[datastax-agent]') - is_expected.to contain_file('/var/lib/datastax-agent/conf/address.yaml'). + expect(subject).to contain_file('/var/lib/datastax-agent/conf/address.yaml'). with( owner: 'cassandra', group: 'cassandra', mode: '0644' ).that_requires('Package[datastax-agent]') - is_expected.to contain_service('datastax-agent').only_with( + expect(subject).to contain_service('datastax-agent').only_with( ensure: 'running', enable: true, name: 'datastax-agent' @@ -68,9 +70,9 @@ osfamily: 'Debian', operatingsystemmajrelease: '7', os: { - 'family' => 'Debian', + 'family' => 'Debian', 'release' => { - 'full' => '7.8', + 'full' => '7.8', 'major' => '7', 'minor' => '8' } @@ -79,7 +81,7 @@ end it do - is_expected.to contain_exec('datastax_agent_reload_systemctl').with( + expect(subject).to contain_exec('datastax_agent_reload_systemctl').with( command: '/bin/systemctl daemon-reload', onlyif: 'test -x /bin/systemctl', path: ['/usr/bin', '/bin'], @@ -94,9 +96,9 @@ osfamily: 'Debian', operatingsystemmajrelease: '7', os: { - 'family' => 'Debian', + 'family' => 'Debian', 'release' => { - 'full' => '7.8', + 'full' => '7.8', 'major' => '7', 'minor' => '8' } @@ -111,7 +113,7 @@ end it do - is_expected.to contain_ini_setting('java_home').with( + expect(subject).to contain_ini_setting('java_home').with( ensure: 'present', path: '/etc/default/datastax-agent', section: '', @@ -128,9 +130,9 @@ osfamily: 'Debian', operatingsystemmajrelease: '7', os: { - 'family' => 'Debian', + 'family' => 'Debian', 'release' => { - 'full' => '7.8', + 'full' => '7.8', 'major' => '7', 'minor' => '8' } @@ -143,11 +145,11 @@ settings: { 'agent_alias' => { 'setting' => 'agent_alias', - 'value' => 'foobar' + 'value' => 'foobar' }, 'stomp_interface' => { 'setting' => 'stomp_interface', - 'value' => 'localhost' + 'value' => 'localhost' }, 'async_pool_size' => { 'ensure' => 'absent' @@ -157,7 +159,7 @@ end it do - is_expected.to have_resource_count(16) + expect(subject).to have_resource_count(16) end end end diff --git a/spec/classes/datastax_repo_spec.rb b/spec/classes/datastax_repo_spec.rb index a1698d4a..f6acc1a0 100644 --- a/spec/classes/datastax_repo_spec.rb +++ b/spec/classes/datastax_repo_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra::datastax_repo' do context 'On a RedHat OS with defaults for all parameters' do @@ -5,9 +7,9 @@ { osfamily: 'RedHat', os: { - 'family' => 'RedHat', + 'family' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -16,16 +18,16 @@ end it do - is_expected.to have_resource_count(1) + expect(subject).to have_resource_count(1) - is_expected.to contain_class('cassandra::datastax_repo').only_with( - 'descr' => 'DataStax Repo for Apache Cassandra', - 'key_id' => '7E41C00F85BFC1706C4FFFB3350200F2B999A372', + expect(subject).to contain_class('cassandra::datastax_repo').only_with( + 'descr' => 'DataStax Repo for Apache Cassandra', + 'key_id' => '7E41C00F85BFC1706C4FFFB3350200F2B999A372', 'key_url' => 'http://debian.datastax.com/debian/repo_key', 'release' => 'stable' ) - is_expected.to contain_yumrepo('datastax').with( + expect(subject).to contain_yumrepo('datastax').with( ensure: 'present', descr: 'DataStax Repo for Apache Cassandra', baseurl: 'http://rpm.datastax.com/community', @@ -47,29 +49,29 @@ 'release' => { 'major' => '9', 'minor' => '9', - 'full' => '9.9' + 'full' => '9.9' } } } end it do - is_expected.to contain_class('apt') - is_expected.to contain_class('apt::update') + expect(subject).to contain_class('apt') + expect(subject).to contain_class('apt::update') - is_expected.to contain_apt__key('datastaxkey').with( + expect(subject).to contain_apt__key('datastaxkey').with( id: '7E41C00F85BFC1706C4FFFB3350200F2B999A372', source: 'http://debian.datastax.com/debian/repo_key' ) - is_expected.to contain_apt__source('datastax').with( + expect(subject).to contain_apt__source('datastax').with( location: 'http://debian.datastax.com/community', comment: 'DataStax Repo for Apache Cassandra', release: 'stable', include: { 'src' => false } ).that_notifies('Exec[update-cassandra-repos]') - is_expected.to contain_exec('update-cassandra-repos').with( + expect(subject).to contain_exec('update-cassandra-repos').with( refreshonly: true, command: '/bin/true' ) diff --git a/spec/classes/dse_spec.rb b/spec/classes/dse_spec.rb index 2d76a6de..9e29b768 100644 --- a/spec/classes/dse_spec.rb +++ b/spec/classes/dse_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra::dse' do context 'with defaults for all parameters' do @@ -9,7 +11,7 @@ 'family' => 'RedHat', 'name' => 'Redhat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -18,10 +20,10 @@ end it do - is_expected.to have_resource_count(13) - is_expected.to contain_class('cassandra') + expect(subject).to have_resource_count(13) + expect(subject).to contain_class('cassandra') - is_expected.to contain_class('cassandra::dse').with( + expect(subject).to contain_class('cassandra::dse').with( config_file_mode: '0644', config_file: '/etc/dse/dse.yaml' ) diff --git a/spec/classes/firewall_ports_spec.rb b/spec/classes/firewall_ports_spec.rb index c808c7f4..223d3e37 100644 --- a/spec/classes/firewall_ports_spec.rb +++ b/spec/classes/firewall_ports_spec.rb @@ -1,11 +1,13 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra::firewall_ports' do context 'Run with defaults.' do it do - is_expected.to have_resource_count(2) - is_expected.to contain_firewall('200 - Cassandra (Public) - 0.0.0.0/0') + expect(subject).to have_resource_count(2) + expect(subject).to contain_firewall('200 - Cassandra (Public) - 0.0.0.0/0') - is_expected.to contain_class('cassandra::firewall_ports').with( + expect(subject).to contain_class('cassandra::firewall_ports').with( client_ports: [9042, 9160], client_subnets: ['0.0.0.0/0'], inter_node_ports: [7000, 7001, 7199], @@ -17,7 +19,7 @@ opscenter_subnets: ['0.0.0.0/0'] ) - is_expected.to contain_cassandra__private__firewall_ports__rule('200_Public_0.0.0.0/0').with(ports: [8888, 22]) + expect(subject).to contain_cassandra__private__firewall_ports__rule('200_Public_0.0.0.0/0').with(ports: [8888, 22]) end end end diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 25402807..8273bb8b 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra' do @@ -7,9 +9,9 @@ operatingsystemmajrelease: '16', osfamily: 'Darwin', os: { - 'family' => 'Darwin', + 'family' => 'Darwin', 'release' => { - 'full' => '16.0.0', + 'full' => '16.0.0', 'major' => '16', 'minor' => '0' } @@ -29,7 +31,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -38,26 +40,26 @@ end it do - is_expected.to contain_package('cassandra').with( + expect(subject).to contain_package('cassandra').with( ensure: 'present', name: 'cassandra22' ).that_notifies('Exec[cassandra_reload_systemctl]') - is_expected.to contain_exec('cassandra_reload_systemctl').only_with( + expect(subject).to contain_exec('cassandra_reload_systemctl').only_with( command: '/usr/bin/systemctl daemon-reload', onlyif: 'test -x /usr/bin/systemctl', path: ['/usr/bin', '/bin'], refreshonly: true ) - is_expected.to contain_file('/etc/cassandra/default.conf').with( + expect(subject).to contain_file('/etc/cassandra/default.conf').with( ensure: 'directory', group: 'cassandra', owner: 'cassandra', mode: '0755' ).that_requires('Package[cassandra]') - is_expected.to contain_file('/etc/cassandra/default.conf/cassandra.yaml'). + expect(subject).to contain_file('/etc/cassandra/default.conf/cassandra.yaml'). with( ensure: 'file', owner: 'cassandra', @@ -66,10 +68,10 @@ ). that_requires('Package[cassandra]') - is_expected.to contain_class('cassandra').only_with( + expect(subject).to contain_class('cassandra').only_with( baseline_settings: {}, cassandra_2356_sleep_seconds: 5, - cassandra_9822: false, + cassandra_9822: false, # rubocop:disable Naming/VariableNumber cassandra_yaml_tmpl: 'cassandra/cassandra.yaml.erb', commitlog_directory_mode: '0750', manage_config_file: true, @@ -101,9 +103,9 @@ osfamily: 'RedHat', operatingsystemmajrelease: '7', os: { - 'family' => 'RedHat', + 'family' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -122,11 +124,11 @@ end it do - is_expected.to have_resource_count(10) - is_expected.to contain_file('/var/lib/cassandra/commitlog') - is_expected.to contain_file('/var/lib/cassandra/data') - is_expected.to contain_file('/var/lib/cassandra/hints') - is_expected.to contain_file('/var/lib/cassandra/saved_caches') + expect(subject).to have_resource_count(10) + expect(subject).to contain_file('/var/lib/cassandra/commitlog') + expect(subject).to contain_file('/var/lib/cassandra/data') + expect(subject).to contain_file('/var/lib/cassandra/hints') + expect(subject).to contain_file('/var/lib/cassandra/saved_caches') end end @@ -136,9 +138,9 @@ osfamily: 'RedHat', operatingsystemmajrelease: '7', os: { - 'family' => 'RedHat', + 'family' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -153,8 +155,8 @@ end it do - is_expected.to have_resource_count(7) - is_expected.to contain_exec('/sbin/chkconfig --add cassandra').with( + expect(subject).to have_resource_count(7) + expect(subject).to contain_exec('/sbin/chkconfig --add cassandra').with( unless: '/sbin/chkconfig --list cassandra' ). that_requires('Package[cassandra]'). @@ -168,9 +170,9 @@ operatingsystemmajrelease: '8', osfamily: 'Debian', os: { - 'family' => 'Debian', + 'family' => 'Debian', 'release' => { - 'full' => '8.11', + 'full' => '8.11', 'major' => '8', 'minor' => '11' } @@ -179,28 +181,28 @@ end it do - is_expected.to contain_class('cassandra') - is_expected.to contain_group('cassandra').with_ensure('present') + expect(subject).to contain_class('cassandra') + expect(subject).to contain_group('cassandra').with_ensure('present') - is_expected.to contain_package('cassandra').with( + expect(subject).to contain_package('cassandra').with( ensure: 'present', name: 'cassandra' ).that_notifies('Exec[cassandra_reload_systemctl]') - is_expected.to contain_exec('cassandra_reload_systemctl').only_with( + expect(subject).to contain_exec('cassandra_reload_systemctl').only_with( command: '/bin/systemctl daemon-reload', onlyif: 'test -x /bin/systemctl', path: ['/usr/bin', '/bin'], refreshonly: true ) - is_expected.to contain_service('cassandra').with( + expect(subject).to contain_service('cassandra').with( ensure: nil, name: 'cassandra', enable: 'true' ) - is_expected.to contain_exec('CASSANDRA-2356 sleep'). + expect(subject).to contain_exec('CASSANDRA-2356 sleep'). with( command: '/bin/sleep 5', refreshonly: true, @@ -209,7 +211,7 @@ that_subscribes_to('Package[cassandra]'). that_comes_before('Service[cassandra]') - is_expected.to contain_user('cassandra'). + expect(subject).to contain_user('cassandra'). with( ensure: 'present', comment: 'Cassandra database,,,', @@ -220,14 +222,14 @@ ). that_requires('Group[cassandra]') - is_expected.to contain_file('/etc/cassandra').with( + expect(subject).to contain_file('/etc/cassandra').with( ensure: 'directory', group: 'cassandra', owner: 'cassandra', mode: '0755' ) - is_expected.to contain_file('/etc/cassandra/cassandra.yaml'). + expect(subject).to contain_file('/etc/cassandra/cassandra.yaml'). with( ensure: 'file', owner: 'cassandra', @@ -237,7 +239,7 @@ that_comes_before('Package[cassandra]'). that_requires(['User[cassandra]', 'File[/etc/cassandra]']) - is_expected.to contain_file('/etc/cassandra/cassandra-rackdc.properties'). + expect(subject).to contain_file('/etc/cassandra/cassandra-rackdc.properties'). with( ensure: 'file', owner: 'cassandra', @@ -247,7 +249,7 @@ that_requires(['File[/etc/cassandra]', 'User[cassandra]']). that_comes_before('Package[cassandra]') - is_expected.to contain_service('cassandra'). + expect(subject).to contain_service('cassandra'). that_subscribes_to( [ 'File[/etc/cassandra/cassandra.yaml]', @@ -266,10 +268,10 @@ lsbdistid: 'Ubuntu', lsbdistrelease: '16.04', os: { - 'name' => 'Ubuntu', - 'family' => 'Debian', + 'name' => 'Ubuntu', + 'family' => 'Debian', 'release' => { - 'full' => '16.04', + 'full' => '16.04', 'major' => '16.04' } } @@ -278,12 +280,12 @@ let :params do { - cassandra_9822: true + cassandra_9822: true # rubocop:disable Naming/VariableNumber } end it do - is_expected.to contain_file('/etc/init.d/cassandra').with( + expect(subject).to contain_file('/etc/init.d/cassandra').with( source: 'puppet:///modules/cassandra/CASSANDRA-9822/cassandra', mode: '0555' ).that_comes_before('Package[cassandra]') @@ -296,9 +298,9 @@ operatingsystemmajrelease: '7', osfamily: 'RedHat', os: { - 'family' => 'RedHat', + 'family' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -316,10 +318,10 @@ end it do - is_expected.to contain_file('/etc/dse/cassandra/cassandra.yaml').that_notifies('Service[cassandra]') - is_expected.to contain_file('/etc/dse/cassandra') + expect(subject).to contain_file('/etc/dse/cassandra/cassandra.yaml').that_notifies('Service[cassandra]') + expect(subject).to contain_file('/etc/dse/cassandra') - is_expected.to contain_file('/etc/dse/cassandra/cassandra-rackdc.properties'). + expect(subject).to contain_file('/etc/dse/cassandra/cassandra-rackdc.properties'). with( ensure: 'file', owner: 'cassandra', @@ -328,11 +330,11 @@ ). that_notifies('Service[cassandra]') - is_expected.to contain_package('cassandra').with( + expect(subject).to contain_package('cassandra').with( ensure: '4.7.0-1', name: 'dse-full' ) - is_expected.to contain_service('cassandra').with_name('dse') + expect(subject).to contain_service('cassandra').with_name('dse') end end @@ -342,9 +344,9 @@ operatingsystemmajrelease: '16', osfamily: 'Darwin', os: { - 'family' => 'Darwin', + 'family' => 'Darwin', 'release' => { - 'full' => '16.0.0', + 'full' => '16.0.0', 'major' => '16', 'minor' => '0' } @@ -363,9 +365,9 @@ end it do - is_expected.to contain_file('/etc/cassandra/cassandra.yaml').with('mode' => '0755') - is_expected.to contain_service('cassandra').with(provider: 'base') - is_expected.to have_resource_count(6) + expect(subject).to contain_file('/etc/cassandra/cassandra.yaml').with('mode' => '0755') + expect(subject).to contain_service('cassandra').with(provider: 'base') + expect(subject).to have_resource_count(6) end end @@ -375,9 +377,9 @@ operatingsystemmajrelease: '8', osfamily: 'Debian', os: { - 'family' => 'Debian', + 'family' => 'Debian', 'release' => { - 'full' => '8.11', + 'full' => '8.11', 'major' => '8', 'minor' => '11' } @@ -393,7 +395,7 @@ end it do - is_expected.to contain_service('cassandra'). + expect(subject).to contain_service('cassandra'). with(ensure: 'stopped', name: 'cassandra', enable: 'false') @@ -406,9 +408,9 @@ operatingsystemmajrelease: '8', osfamily: 'Debian', os: { - 'family' => 'Debian', + 'family' => 'Debian', 'release' => { - 'full' => '8.11', + 'full' => '8.11', 'major' => '8', 'minor' => '11' } @@ -417,7 +419,7 @@ end it do - is_expected.to contain_file('/etc/cassandra/cassandra-rackdc.properties'). + expect(subject).to contain_file('/etc/cassandra/cassandra-rackdc.properties'). with_content(%r{^dc=DC1}). with_content(%r{^rack=RAC1$}). with_content(%r{^#dc_suffix=$}). @@ -431,9 +433,9 @@ operatingsystemmajrelease: '7', osfamily: 'RedHat', os: { - 'family' => 'RedHat', + 'family' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -442,7 +444,7 @@ end it do - is_expected.to contain_file('/etc/cassandra/default.conf/cassandra-rackdc.properties'). + expect(subject).to contain_file('/etc/cassandra/default.conf/cassandra-rackdc.properties'). with_content(%r{^dc=DC1}). with_content(%r{^rack=RAC1$}). with_content(%r{^#dc_suffix=$}). @@ -456,9 +458,9 @@ operatingsystemmajrelease: '7', osfamily: 'RedHat', os: { - 'family' => 'RedHat', + 'family' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -477,7 +479,7 @@ end it do - is_expected.to contain_file('/etc/cassandra/default.conf/cassandra-topology.properties'). + expect(subject).to contain_file('/etc/cassandra/default.conf/cassandra-topology.properties'). with_content(%r{^dc=NYC$}). with_content(%r{^rack=R101$}). with_content(%r{^dc_suffix=_1_cassandra$}). diff --git a/spec/classes/java_spec.rb b/spec/classes/java_spec.rb index 144ddf5f..fcfeb0e7 100644 --- a/spec/classes/java_spec.rb +++ b/spec/classes/java_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra::java' do context 'On a RedHat OS with defaults for all parameters' do @@ -6,9 +8,9 @@ operatingsystemmajrelease: '7', osfamily: 'RedHat', os: { - 'family' => 'RedHat', + 'family' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -17,9 +19,9 @@ end it do - is_expected.to contain_class('cassandra::java') - is_expected.to contain_package('java-1.8.0-openjdk-headless') - is_expected.to contain_package('jna') + expect(subject).to contain_class('cassandra::java') + expect(subject).to contain_package('java-1.8.0-openjdk-headless') + expect(subject).to contain_package('jna') end end @@ -30,10 +32,10 @@ osfamily: 'Debian', lsbdistid: 'Debian', os: { - 'name' => 'Debian', - 'family' => 'Debian', + 'name' => 'Debian', + 'family' => 'Debian', 'release' => { - 'full' => '7.8', + 'full' => '7.8', 'major' => '7', 'minor' => '8' } @@ -42,10 +44,10 @@ end it do - is_expected.to contain_class('cassandra::java') - is_expected.to contain_package('openjdk-7-jre-headless') - is_expected.to contain_package('libjna-java') - is_expected.to have_resource_count(2) + expect(subject).to contain_class('cassandra::java') + expect(subject).to contain_package('openjdk-7-jre-headless') + expect(subject).to contain_package('libjna-java') + expect(subject).to have_resource_count(2) end end @@ -56,10 +58,10 @@ osfamily: 'Debian', lsbdistid: 'Debian', os: { - 'name' => 'Debian', - 'family' => 'Debian', + 'name' => 'Debian', + 'family' => 'Debian', 'release' => { - 'full' => '7.8', + 'full' => '7.8', 'major' => '7', 'minor' => '8' } @@ -74,7 +76,7 @@ end it do - is_expected.to contain_package('openjdk-7-jre-headless').with_ensure('2.1.13') + expect(subject).to contain_package('openjdk-7-jre-headless').with_ensure('2.1.13') end end @@ -84,9 +86,9 @@ operatingsystemmajrelease: '7', osfamily: 'RedHat', os: { - 'family' => 'RedHat', + 'family' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -104,8 +106,8 @@ end it do - is_expected.to contain_package('foobar-java').with(ensure: 42) - is_expected.to contain_package('foobar-jna').with(ensure: 'latest') + expect(subject).to contain_package('foobar-java').with(ensure: 42) + expect(subject).to contain_package('foobar-jna').with(ensure: 'latest') end end @@ -115,9 +117,9 @@ operatingsystemmajrelease: '7', osfamily: 'RedHat', os: { - 'family' => 'RedHat', + 'family' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -130,14 +132,14 @@ yumrepo: { 'ACME' => { 'baseurl' => 'http://yum.acme.org/repos', - 'descr' => 'YUM Repository for ACME Products' + 'descr' => 'YUM Repository for ACME Products' } } } end it do - is_expected.to contain_yumrepo('ACME').with( + expect(subject).to contain_yumrepo('ACME').with( baseurl: 'http://yum.acme.org/repos', descr: 'YUM Repository for ACME Products' ).that_comes_before('Package[java-1.8.0-openjdk-headless]') @@ -151,10 +153,10 @@ osfamily: 'Debian', lsbdistid: 'Debian', os: { - 'name' => 'Debian', - 'family' => 'Debian', + 'name' => 'Debian', + 'family' => 'Debian', 'release' => { - 'full' => '7.8', + 'full' => '7.8', 'major' => '7', 'minor' => '8' } @@ -166,36 +168,36 @@ { aptkey: { 'openjdk-r' => { - 'id' => 'DA1A4A13543B466853BAF164EB9B1D8886F44E2A', + 'id' => 'DA1A4A13543B466853BAF164EB9B1D8886F44E2A', 'server' => 'keyserver.ubuntu.com' } }, aptsource: { 'openjdk-r' => { - 'comment' => 'OpenJDK builds (all archs)', + 'comment' => 'OpenJDK builds (all archs)', 'location' => 'http://ppa.launchpad.net/openjdk-r/ppa/ubuntu', - 'repos' => 'main', - 'release' => 'trusty' + 'repos' => 'main', + 'release' => 'trusty' } } } end it do - is_expected.to contain_apt__key('openjdk-r'). + expect(subject).to contain_apt__key('openjdk-r'). with( id: 'DA1A4A13543B466853BAF164EB9B1D8886F44E2A', server: 'keyserver.ubuntu.com' ). that_comes_before('Package[openjdk-7-jre-headless]') - is_expected.to contain_apt__source('openjdk-r'). + expect(subject).to contain_apt__source('openjdk-r'). with( comment: 'OpenJDK builds (all archs)', location: 'http://ppa.launchpad.net/openjdk-r/ppa/ubuntu', repos: 'main', release: 'trusty' ) - is_expected.to contain_exec('cassandra::java::apt_update'). + expect(subject).to contain_exec('cassandra::java::apt_update'). with( refreshonly: true, command: '/bin/true' diff --git a/spec/classes/optutils_spec.rb b/spec/classes/optutils_spec.rb index 63d3aa90..e6705b0c 100644 --- a/spec/classes/optutils_spec.rb +++ b/spec/classes/optutils_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra::optutils' do context 'On a RedHat OS with defaults for all parameters' do @@ -9,7 +11,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -18,10 +20,10 @@ end it do - is_expected.to have_resource_count(7) - is_expected.to contain_package('cassandra22-tools').with(ensure: 'present') + expect(subject).to have_resource_count(7) + expect(subject).to contain_package('cassandra22-tools').with(ensure: 'present') - is_expected.to contain_class('cassandra::optutils').with( + expect(subject).to contain_class('cassandra::optutils').with( package_ensure: 'present', package_name: 'cassandra22-tools' ) @@ -37,7 +39,7 @@ 'family' => 'Debian', 'name' => 'Debian', 'release' => { - 'full' => '7.8', + 'full' => '7.8', 'major' => '7', 'minor' => '8' } @@ -46,9 +48,9 @@ end it do - is_expected.to contain_package('cassandra-tools').with(ensure: 'present') + expect(subject).to contain_package('cassandra-tools').with(ensure: 'present') - is_expected.to contain_class('cassandra::optutils').with( + expect(subject).to contain_class('cassandra::optutils').with( package_ensure: 'present', package_name: 'cassandra-tools' ) @@ -61,9 +63,9 @@ operatingsystemmajrelease: '7', osfamily: 'Debian', os: { - 'family' => 'Debian', + 'family' => 'Debian', 'release' => { - 'full' => '7.8', + 'full' => '7.8', 'major' => '7', 'minor' => '8' } @@ -79,7 +81,7 @@ end it do - is_expected.to contain_package('foobar-java').with(ensure: 42) + expect(subject).to contain_package('foobar-java').with(ensure: 42) end end @@ -89,9 +91,9 @@ operatingsystemmajrelease: '7', osfamily: 'Debian', os: { - 'family' => 'Debian', + 'family' => 'Debian', 'release' => { - 'full' => '7.8', + 'full' => '7.8', 'major' => '7', 'minor' => '8' } diff --git a/spec/classes/params_spec.rb b/spec/classes/params_spec.rb index 116e8e9f..7e05320b 100644 --- a/spec/classes/params_spec.rb +++ b/spec/classes/params_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra::params' do @@ -17,8 +19,8 @@ end it do - is_expected.to compile - is_expected.to contain_class('cassandra::params') - is_expected.to have_resource_count(0) + expect(subject).to compile + expect(subject).to contain_class('cassandra::params') + expect(subject).to have_resource_count(0) end end diff --git a/spec/classes/schema_spec.rb b/spec/classes/schema_spec.rb index d5f24c64..b7a7eba2 100644 --- a/spec/classes/schema_spec.rb +++ b/spec/classes/schema_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra::schema' do context 'Ensure that a connection test is made.' do @@ -9,7 +11,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -18,7 +20,7 @@ end it do - is_expected.to contain_class('cassandra::schema'). + expect(subject).to contain_class('cassandra::schema'). with(connection_tries: 6, connection_try_sleep: 30, cqlsh_additional_options: '', @@ -30,7 +32,7 @@ read_command = '/usr/bin/cqlsh -e \'DESC KEYSPACES\' localhost 9042' - is_expected.to contain_exec('cassandra::schema connection test'). + expect(subject).to contain_exec('::cassandra::schema connection test'). only_with(command: read_command, returns: 0, tries: 6, @@ -48,7 +50,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -64,7 +66,7 @@ end it do - is_expected.to contain_class('cassandra::schema'). + expect(subject).to contain_class('cassandra::schema'). with(connection_tries: 6, connection_try_sleep: 30, cqlsh_additional_options: '', @@ -76,7 +78,7 @@ read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \'DESC KEYSPACES\' localhost 9042"' - is_expected.to contain_exec('cassandra::schema connection test'). + expect(subject).to contain_exec('::cassandra::schema connection test'). only_with(command: read_command, returns: 0, tries: 6, @@ -96,7 +98,7 @@ 'family' => 'Debian', 'name' => 'Debian', 'release' => { - 'full' => '7.8', + 'full' => '7.8', 'major' => '7', 'minor' => '8' } @@ -117,7 +119,7 @@ end it do - is_expected.to contain_file('/root/.puppetcqlshrc').with( + expect(subject).to contain_file('/root/.puppetcqlshrc').with( ensure: 'file', group: 0, mode: '0600', @@ -127,7 +129,7 @@ read_command = "/usr/bin/cqlsh --cqlshrc=/root/.puppetcqlshrc -e 'DESC KEYSPACES' localhost 9042" - is_expected.to contain_exec('cassandra::schema connection test'). + expect(subject).to contain_exec('::cassandra::schema connection test'). only_with(command: read_command, returns: 0, tries: 6, @@ -147,7 +149,7 @@ 'family' => 'Debian', 'name' => 'Debian', 'release' => { - 'full' => '7.8', + 'full' => '7.8', 'major' => '7', 'minor' => '8' } @@ -169,7 +171,7 @@ end it do - is_expected.to contain_file('/root/.puppetcqlshrc').with( + expect(subject).to contain_file('/root/.puppetcqlshrc').with( ensure: 'file', group: 0, mode: '0600', @@ -179,7 +181,7 @@ read_command = "/usr/bin/cqlsh --cqlshrc=/root/.puppetcqlshrc -e 'DESC KEYSPACES' localhost 9042" - is_expected.to contain_exec('cassandra::schema connection test'). + expect(subject).to contain_exec('::cassandra::schema connection test'). only_with(command: read_command, returns: 0, tries: 6, @@ -197,7 +199,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -214,7 +216,7 @@ it do read_command = "/usr/bin/cqlsh -u cassandra -p topsecret -e 'DESC KEYSPACES' localhost 9042" - is_expected.to contain_exec('cassandra::schema connection test'). + expect(subject).to contain_exec('::cassandra::schema connection test'). only_with(command: read_command, returns: 0, tries: 6, diff --git a/spec/classes/system/swapoff_spec.rb b/spec/classes/system/swapoff_spec.rb index 13dc298c..a4d15c7a 100644 --- a/spec/classes/system/swapoff_spec.rb +++ b/spec/classes/system/swapoff_spec.rb @@ -1,11 +1,13 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra::system::swapoff' do context 'Test the default parameters' do it do - is_expected.to have_resource_count(1) - is_expected.to contain_class('cassandra::system::swapoff') - is_expected.to contain_exec('Disable Swap') + expect(subject).to have_resource_count(1) + expect(subject).to contain_class('cassandra::system::swapoff') + expect(subject).to contain_exec('Disable Swap') end end @@ -17,10 +19,10 @@ end it do - is_expected.to have_resource_count(2) - is_expected.to contain_class('cassandra::system::swapoff') - is_expected.to contain_exec('Disable Swap') - is_expected.to contain_mount('swap').with( + expect(subject).to have_resource_count(2) + expect(subject).to contain_class('cassandra::system::swapoff') + expect(subject).to contain_exec('Disable Swap') + expect(subject).to contain_mount('swap').with( ensure: 'absent', device: '/dev/mapper/centos-swap', fstype: 'swap' diff --git a/spec/classes/system/sysctl_spec.rb b/spec/classes/system/sysctl_spec.rb index 087a232c..551edc24 100644 --- a/spec/classes/system/sysctl_spec.rb +++ b/spec/classes/system/sysctl_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra::system::sysctl' do @@ -7,9 +9,9 @@ osfamily: 'RedHat', operatingsystemmajrelease: '7', os: { - 'family' => 'RedHat', + 'family' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -18,17 +20,17 @@ end it do - is_expected.to have_resource_count(9) - is_expected.to contain_class('Cassandra::System::Sysctl') - is_expected.to contain_ini_setting('net.core.optmem_max = 40960') - is_expected.to contain_ini_setting('net.core.rmem_default = 16777216') - is_expected.to contain_ini_setting('net.core.rmem_max = 16777216') - is_expected.to contain_ini_setting('net.core.wmem_default = 16777216') - is_expected.to contain_ini_setting('net.core.wmem_max = 16777216') - is_expected.to contain_ini_setting('net.ipv4.tcp_rmem = 4096, 87380, 16777216') - is_expected.to contain_ini_setting('net.ipv4.tcp_wmem = 4096, 65536, 16777216') - is_expected.to contain_ini_setting('vm.max_map_count = 1048575') - is_expected.to contain_exec('Apply sysctl changes').with( + expect(subject).to have_resource_count(9) + expect(subject).to contain_class('Cassandra::System::Sysctl') + expect(subject).to contain_ini_setting('net.core.optmem_max = 40960') + expect(subject).to contain_ini_setting('net.core.rmem_default = 16777216') + expect(subject).to contain_ini_setting('net.core.rmem_max = 16777216') + expect(subject).to contain_ini_setting('net.core.wmem_default = 16777216') + expect(subject).to contain_ini_setting('net.core.wmem_max = 16777216') + expect(subject).to contain_ini_setting('net.ipv4.tcp_rmem = 4096, 87380, 16777216') + expect(subject).to contain_ini_setting('net.ipv4.tcp_wmem = 4096, 65536, 16777216') + expect(subject).to contain_ini_setting('vm.max_map_count = 1048575') + expect(subject).to contain_exec('Apply sysctl changes').with( command: '/sbin/sysctl -p /etc/sysctl.d/10-cassandra.conf' ) end diff --git a/spec/classes/system/transparent_hugepage_spec.rb b/spec/classes/system/transparent_hugepage_spec.rb index ad8372d4..8b3ae78d 100644 --- a/spec/classes/system/transparent_hugepage_spec.rb +++ b/spec/classes/system/transparent_hugepage_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra::system::transparent_hugepage' do @@ -7,9 +9,9 @@ osfamily: 'RedHat', operatingsystemmajrelease: 7, os: { - 'family' => 'RedHat', + 'family' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -18,9 +20,9 @@ end it do - is_expected.to have_resource_count(1) - is_expected.to contain_class('cassandra::system::transparent_hugepage') - is_expected.to contain_exec('Disable Java Hugepages') + expect(subject).to have_resource_count(1) + expect(subject).to contain_class('cassandra::system::transparent_hugepage') + expect(subject).to contain_exec('Disable Java Hugepages') end end @@ -30,9 +32,9 @@ osfamily: 'Debian', operatingsystemmajrelease: 7, os: { - 'family' => 'Debian', + 'family' => 'Debian', 'release' => { - 'full' => '7.8', + 'full' => '7.8', 'major' => '7', 'minor' => '8' } @@ -41,9 +43,9 @@ end it do - is_expected.to have_resource_count(1) - is_expected.to contain_class('cassandra::system::transparent_hugepage') - is_expected.to contain_exec('Disable Java Hugepages') + expect(subject).to have_resource_count(1) + expect(subject).to contain_class('cassandra::system::transparent_hugepage') + expect(subject).to contain_exec('Disable Java Hugepages') end end end diff --git a/spec/defines/file_spec.rb b/spec/defines/file_spec.rb index a333a41a..233e7351 100644 --- a/spec/defines/file_spec.rb +++ b/spec/defines/file_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra::file' do @@ -10,7 +12,7 @@ 'family' => 'Debian', 'name' => 'Debian', 'release' => { - 'full' => '8.11', + 'full' => '8.11', 'major' => '8', 'minor' => '11' } @@ -25,7 +27,7 @@ config_path: '/etc/cassandra', 'file_lines' => { 'MAX_HEAP_SIZE 4GB' => { - 'line' => 'MAX_HEAP_SIZE="4G"', + 'line' => 'MAX_HEAP_SIZE="4G"', 'match' => '^#MAX_HEAP_SIZE="4G"$' } } @@ -33,12 +35,12 @@ end it do - is_expected.to contain_class('cassandra') - is_expected.to contain_class('cassandra::params') - is_expected.to contain_class('stdlib') - is_expected.to contain_cassandra__file('cassandra-env.sh') + expect(subject).to contain_class('cassandra') + expect(subject).to contain_class('cassandra::params') + expect(subject).to contain_class('stdlib') + expect(subject).to contain_cassandra__file('cassandra-env.sh') - is_expected.to contain_file_line('MAX_HEAP_SIZE 4GB').with( + expect(subject).to contain_file_line('MAX_HEAP_SIZE 4GB').with( path: '/etc/cassandra/cassandra-env.sh', line: 'MAX_HEAP_SIZE="4G"', match: '^#MAX_HEAP_SIZE="4G"$' diff --git a/spec/defines/private/firewall_ports/rule_spec.rb b/spec/defines/private/firewall_ports/rule_spec.rb index a507c562..c0868205 100644 --- a/spec/defines/private/firewall_ports/rule_spec.rb +++ b/spec/defines/private/firewall_ports/rule_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra::private::firewall_ports::rule' do context 'Test that rules can be set.' do @@ -9,13 +11,13 @@ end it do - is_expected.to contain_firewall('200 - Cassandra (Public) - 0.0.0.0/0').with( + expect(subject).to contain_firewall('200 - Cassandra (Public) - 0.0.0.0/0').with( action: 'accept', dport: [8888, 22], proto: 'tcp', source: '0.0.0.0/0' ) - is_expected.to have_resource_count(2) + expect(subject).to have_resource_count(2) end end end diff --git a/spec/defines/schema/cql_type_spec.rb b/spec/defines/schema/cql_type_spec.rb index 54858817..19e200b0 100644 --- a/spec/defines/schema/cql_type_spec.rb +++ b/spec/defines/schema/cql_type_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra::schema::cql_type' do @@ -10,7 +12,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -26,21 +28,21 @@ fields: { 'firstname' => 'text', - 'lastname' => 'text' + 'lastname' => 'text' }, - 'use_scl' => false, + 'use_scl' => false, 'scl_name' => 'nodefault' } end it do - is_expected.to compile - is_expected.to contain_class('cassandra::schema') - is_expected.to contain_cassandra__schema__cql_type('fullname') + expect(subject).to compile + expect(subject).to contain_class('cassandra::schema') + expect(subject).to contain_cassandra__schema__cql_type('fullname') read_command = '/usr/bin/cqlsh -e "DESC TYPE Excelsior.fullname" localhost 9042' exec_command = '/usr/bin/cqlsh -e "CREATE TYPE IF NOT EXISTS Excelsior.fullname ' exec_command += '(firstname text, lastname text)" localhost 9042' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(unless: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -55,7 +57,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -71,21 +73,21 @@ fields: { 'firstname' => 'text', - 'lastname' => 'text' + 'lastname' => 'text' }, - 'use_scl' => true, + 'use_scl' => true, 'scl_name' => 'testscl' } end it do - is_expected.to compile - is_expected.to contain_class('cassandra::schema') - is_expected.to contain_cassandra__schema__cql_type('fullname') + expect(subject).to compile + expect(subject).to contain_class('cassandra::schema') + expect(subject).to contain_cassandra__schema__cql_type('fullname') read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DESC TYPE Excelsior.fullname\" localhost 9042"' exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE TYPE IF NOT EXISTS Excelsior.fullname ' exec_command += '(firstname text, lastname text)\" localhost 9042"' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(unless: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -100,7 +102,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -111,19 +113,19 @@ let(:title) { 'address' } let(:params) do { - 'ensure' => 'absent', + 'ensure' => 'absent', 'keyspace' => 'Excalibur', - 'use_scl' => false, + 'use_scl' => false, 'scl_name' => 'nodefault' } end it do - is_expected.to compile - is_expected.to contain_cassandra__schema__cql_type('address') + expect(subject).to compile + expect(subject).to contain_cassandra__schema__cql_type('address') read_command = '/usr/bin/cqlsh -e "DESC TYPE Excalibur.address" localhost 9042' exec_command = '/usr/bin/cqlsh -e "DROP type Excalibur.address" localhost 9042' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(onlyif: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -138,7 +140,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -149,19 +151,19 @@ let(:title) { 'address' } let(:params) do { - 'ensure' => 'absent', + 'ensure' => 'absent', 'keyspace' => 'Excalibur', - 'use_scl' => true, + 'use_scl' => true, 'scl_name' => 'testscl' } end it do - is_expected.to compile - is_expected.to contain_cassandra__schema__cql_type('address') + expect(subject).to compile + expect(subject).to contain_cassandra__schema__cql_type('address') read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DESC TYPE Excalibur.address\" localhost 9042"' exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DROP type Excalibur.address\" localhost 9042"' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(onlyif: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -176,7 +178,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } diff --git a/spec/defines/schema/index_spec.rb b/spec/defines/schema/index_spec.rb index 0f2000a1..0679729d 100644 --- a/spec/defines/schema/index_spec.rb +++ b/spec/defines/schema/index_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra::schema::index' do @@ -10,7 +12,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -31,11 +33,11 @@ end it do - is_expected.to compile - is_expected.to contain_cassandra__schema__index('user_index') + expect(subject).to compile + expect(subject).to contain_cassandra__schema__index('user_index') read_command = '/usr/bin/cqlsh -e "DESC INDEX mykeyspace.user_index" localhost 9042' exec_command = '/usr/bin/cqlsh -e "CREATE INDEX IF NOT EXISTS user_index ON mykeyspace.users (lname)" localhost 9042' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(unless: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -50,7 +52,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -71,11 +73,11 @@ end it do - is_expected.to compile - is_expected.to contain_cassandra__schema__index('user_index') + expect(subject).to compile + expect(subject).to contain_cassandra__schema__index('user_index') read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DESC INDEX mykeyspace.user_index\" localhost 9042"' exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE INDEX IF NOT EXISTS user_index ON mykeyspace.users (lname)\" localhost 9042"' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(unless: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -90,7 +92,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -112,10 +114,10 @@ end it do - is_expected.to compile + expect(subject).to compile read_command = '/usr/bin/cqlsh -e "DESC INDEX Excelsior.user_index" localhost 9042' exec_command = '/usr/bin/cqlsh -e "CREATE CUSTOM INDEX IF NOT EXISTS user_index ON Excelsior.users (email) USING \'path.to.the.IndexClass\'" localhost 9042' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(unless: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -130,7 +132,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -152,10 +154,10 @@ end it do - is_expected.to compile + expect(subject).to compile read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DESC INDEX Excelsior.user_index\" localhost 9042"' exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE CUSTOM INDEX IF NOT EXISTS user_index ON Excelsior.users (email) USING \'path.to.the.IndexClass\'\" localhost 9042"' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(unless: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -170,7 +172,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -193,12 +195,12 @@ end it do - is_expected.to compile + expect(subject).to compile read_command = '/usr/bin/cqlsh -e "DESC INDEX Excelsior.user_index" localhost 9042' exec_command = '/usr/bin/cqlsh -e "CREATE CUSTOM INDEX IF NOT EXISTS user_index ON ' exec_command += 'Excelsior.users (email) USING \'path.to.the.IndexClass\' WITH OPTIONS = {' exec_command += '\'storage\': \'/mnt/ssd/indexes/\'}" localhost 9042' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(unless: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -213,7 +215,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -236,12 +238,12 @@ end it do - is_expected.to compile + expect(subject).to compile read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DESC INDEX Excelsior.user_index\" localhost 9042"' exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE CUSTOM INDEX IF NOT EXISTS user_index ON ' exec_command += 'Excelsior.users (email) USING \'path.to.the.IndexClass\' WITH OPTIONS = {' exec_command += '\'storage\': \'/mnt/ssd/indexes/\'}\" localhost 9042"' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(unless: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -256,7 +258,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -278,10 +280,10 @@ end it do - is_expected.to compile + expect(subject).to compile read_command = '/usr/bin/cqlsh -e "DESC INDEX Excelsior.user_index" localhost 9042' exec_command = '/usr/bin/cqlsh -e "DROP INDEX Excelsior.user_index" localhost 9042' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(onlyif: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -296,7 +298,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -318,10 +320,10 @@ end it do - is_expected.to compile + expect(subject).to compile read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DESC INDEX Excelsior.user_index\" localhost 9042"' exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DROP INDEX Excelsior.user_index\" localhost 9042"' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(onlyif: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -336,7 +338,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } diff --git a/spec/defines/schema/keyspace_spec.rb b/spec/defines/schema/keyspace_spec.rb index 7dade35b..ef46d46e 100644 --- a/spec/defines/schema/keyspace_spec.rb +++ b/spec/defines/schema/keyspace_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra::schema::keyspace' do @@ -10,7 +12,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -25,7 +27,7 @@ ensure: 'present', replication_map: { - 'keyspace_class' => 'SimpleStrategy', + 'keyspace_class' => 'SimpleStrategy', 'replication_factor' => 3 }, use_scl: false, @@ -34,13 +36,13 @@ end it do - is_expected.to compile - is_expected.to contain_class('cassandra::schema') + expect(subject).to compile + expect(subject).to contain_class('cassandra::schema') read_command = '/usr/bin/cqlsh -e "DESC KEYSPACE foobar" localhost 9042' exec_command = '/usr/bin/cqlsh -e "CREATE KEYSPACE IF NOT EXISTS foobar WITH REPLICATION = ' exec_command += '{ \'class\' : \'SimpleStrategy\', \'replication_factor\' : 3 } ' exec_command += 'AND DURABLE_WRITES = true" localhost 9042' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(unless: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -55,7 +57,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -70,7 +72,7 @@ ensure: 'present', replication_map: { - 'keyspace_class' => 'SimpleStrategy', + 'keyspace_class' => 'SimpleStrategy', 'replication_factor' => 3 }, use_scl: true, @@ -79,12 +81,12 @@ end it do - is_expected.to compile + expect(subject).to compile read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DESC KEYSPACE foobar\" localhost 9042"' exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE KEYSPACE IF NOT EXISTS foobar WITH REPLICATION = ' exec_command += '{ \'class\' : \'SimpleStrategy\', \'replication_factor\' : 3 } ' exec_command += 'AND DURABLE_WRITES = true\" localhost 9042"' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(unless: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -99,7 +101,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -115,8 +117,8 @@ replication_map: { 'keyspace_class' => 'NetworkTopologyStrategy', - 'dc1' => '3', - 'dc2' => '2' + 'dc1' => '3', + 'dc2' => '2' }, use_scl: false, scl_name: 'nodefault' @@ -124,12 +126,12 @@ end it do - is_expected.to contain_cassandra__schema__keyspace('foobar') + expect(subject).to contain_cassandra__schema__keyspace('foobar') read_command = '/usr/bin/cqlsh -e "DESC KEYSPACE foobar" localhost 9042' exec_command = '/usr/bin/cqlsh -e "CREATE KEYSPACE IF NOT EXISTS foobar WITH REPLICATION = ' exec_command += '{ \'class\' : \'NetworkTopologyStrategy\', \'dc1\': 3, \'dc2\': 2 } ' exec_command += 'AND DURABLE_WRITES = true" localhost 9042' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(unless: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -144,7 +146,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -160,8 +162,8 @@ replication_map: { 'keyspace_class' => 'NetworkTopologyStrategy', - 'dc1' => '3', - 'dc2' => '2' + 'dc1' => '3', + 'dc2' => '2' }, use_scl: true, scl_name: 'testscl' @@ -169,12 +171,12 @@ end it do - is_expected.to contain_cassandra__schema__keyspace('foobar') + expect(subject).to contain_cassandra__schema__keyspace('foobar') read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DESC KEYSPACE foobar\" localhost 9042"' exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE KEYSPACE IF NOT EXISTS foobar WITH REPLICATION = ' exec_command += '{ \'class\' : \'NetworkTopologyStrategy\', \'dc1\': 3, \'dc2\': 2 } ' exec_command += 'AND DURABLE_WRITES = true\" localhost 9042"' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(unless: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -189,7 +191,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -207,10 +209,10 @@ end it do - is_expected.to compile + expect(subject).to compile read_command = '/usr/bin/cqlsh -e "DESC KEYSPACE foobar" localhost 9042' exec_command = '/usr/bin/cqlsh -e "DROP KEYSPACE foobar" localhost 9042' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(onlyif: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -225,7 +227,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -243,10 +245,10 @@ end it do - is_expected.to compile + expect(subject).to compile read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DESC KEYSPACE foobar\" localhost 9042"' exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DROP KEYSPACE foobar\" localhost 9042"' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(onlyif: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -261,7 +263,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } diff --git a/spec/defines/schema/permission_spec.rb b/spec/defines/schema/permission_spec.rb index 0d640e45..b0c583f0 100644 --- a/spec/defines/schema/permission_spec.rb +++ b/spec/defines/schema/permission_spec.rb @@ -1,7 +1,9 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra::schema::permission' do - context 'Set ensure to latest' do + context 'with user_name' do let :facts do { operatingsystemmajrelease: 7, @@ -10,7 +12,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -37,7 +39,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -65,7 +67,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -83,13 +85,13 @@ end it do - is_expected.to have_resource_count(9) - is_expected.to contain_cassandra__schema__permission('spillman:SELECT:ALL') + expect(subject).to have_resource_count(9) + expect(subject).to contain_cassandra__schema__permission('spillman:SELECT:ALL') read_script = '/usr/bin/cqlsh -e "LIST ALL PERMISSIONS ON ALL KEYSPACES" ' read_script += 'localhost 9042 | grep \' spillman | *spillman | .* SELECT$\'' script_command = 'GRANT SELECT ON ALL KEYSPACES TO spillman' exec_command = "/usr/bin/cqlsh -e \"#{script_command}\" localhost 9042" - is_expected.to contain_exec(script_command). + expect(subject).to contain_exec(script_command). only_with(command: exec_command, unless: read_script, require: 'Exec[::cassandra::schema connection test]') @@ -106,7 +108,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -124,13 +126,13 @@ end it do - is_expected.to have_resource_count(9) - is_expected.to contain_cassandra__schema__permission('spillman:SELECT:ALL') + expect(subject).to have_resource_count(9) + expect(subject).to contain_cassandra__schema__permission('spillman:SELECT:ALL') read_script = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ALL PERMISSIONS ON ALL KEYSPACES\" ' read_script += 'localhost 9042 | grep \' spillman | *spillman | .* SELECT$\'"' script_command = 'GRANT SELECT ON ALL KEYSPACES TO spillman' exec_command = "/usr/bin/scl enable testscl \"/usr/bin/cqlsh -e \\\"#{script_command}\\\" localhost 9042\"" - is_expected.to contain_exec(script_command). + expect(subject).to contain_exec(script_command). only_with(command: exec_command, unless: read_script, require: 'Exec[::cassandra::schema connection test]') @@ -147,7 +149,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -166,13 +168,13 @@ end it do - is_expected.to have_resource_count(9) - is_expected.to contain_cassandra__schema__permission('akers:modify:field') + expect(subject).to have_resource_count(9) + expect(subject).to contain_cassandra__schema__permission('akers:modify:field') read_script = '/usr/bin/cqlsh -e "LIST ALL PERMISSIONS ON KEYSPACE field" ' read_script += 'localhost 9042 | grep \' akers | *akers | .* MODIFY$\'' script_command = 'GRANT MODIFY ON KEYSPACE field TO akers' exec_command = "/usr/bin/cqlsh -e \"#{script_command}\" localhost 9042" - is_expected.to contain_exec(script_command). + expect(subject).to contain_exec(script_command). only_with(command: exec_command, unless: read_script, require: 'Exec[::cassandra::schema connection test]') @@ -189,7 +191,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -208,13 +210,13 @@ end it do - is_expected.to have_resource_count(9) - is_expected.to contain_cassandra__schema__permission('akers:modify:field') + expect(subject).to have_resource_count(9) + expect(subject).to contain_cassandra__schema__permission('akers:modify:field') read_script = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ALL PERMISSIONS ON KEYSPACE field\" ' read_script += 'localhost 9042 | grep \' akers | *akers | .* MODIFY$\'"' script_command = 'GRANT MODIFY ON KEYSPACE field TO akers' exec_command = "/usr/bin/scl enable testscl \"/usr/bin/cqlsh -e \\\"#{script_command}\\\" localhost 9042\"" - is_expected.to contain_exec(script_command). + expect(subject).to contain_exec(script_command). only_with(command: exec_command, unless: read_script, require: 'Exec[::cassandra::schema connection test]') @@ -231,7 +233,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -250,13 +252,13 @@ end it do - is_expected.to have_resource_count(9) - is_expected.to contain_cassandra__schema__permission('boone:alter:forty9ers') + expect(subject).to have_resource_count(9) + expect(subject).to contain_cassandra__schema__permission('boone:alter:forty9ers') read_script = '/usr/bin/cqlsh -e "LIST ALL PERMISSIONS ON KEYSPACE forty9ers" ' read_script += 'localhost 9042 | grep \' boone | *boone | .* ALTER$\'' script_command = 'GRANT ALTER ON KEYSPACE forty9ers TO boone' exec_command = "/usr/bin/cqlsh -e \"#{script_command}\" localhost 9042" - is_expected.to contain_exec(script_command). + expect(subject).to contain_exec(script_command). only_with(command: exec_command, unless: read_script, require: 'Exec[::cassandra::schema connection test]') @@ -273,7 +275,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -292,13 +294,13 @@ end it do - is_expected.to have_resource_count(9) - is_expected.to contain_cassandra__schema__permission('boone:alter:forty9ers') + expect(subject).to have_resource_count(9) + expect(subject).to contain_cassandra__schema__permission('boone:alter:forty9ers') read_script = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ALL PERMISSIONS ON KEYSPACE forty9ers\" ' read_script += 'localhost 9042 | grep \' boone | *boone | .* ALTER$\'"' script_command = 'GRANT ALTER ON KEYSPACE forty9ers TO boone' exec_command = "/usr/bin/scl enable testscl \"/usr/bin/cqlsh -e \\\"#{script_command}\\\" localhost 9042\"" - is_expected.to contain_exec(script_command). + expect(subject).to contain_exec(script_command). only_with(command: exec_command, unless: read_script, require: 'Exec[::cassandra::schema connection test]') @@ -315,7 +317,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -334,14 +336,14 @@ end it do - is_expected.to have_resource_count(18) - is_expected.to contain_cassandra__schema__permission('boone:ALL:ravens.plays') + expect(subject).to have_resource_count(18) + expect(subject).to contain_cassandra__schema__permission('boone:ALL:ravens.plays') end expected_values = %w[ALTER AUTHORIZE DROP MODIFY SELECT] expected_values.each do |val| it do - is_expected.to contain_cassandra__schema__permission("boone:ALL:ravens.plays - #{val}").with( + expect(subject).to contain_cassandra__schema__permission("boone:ALL:ravens.plays - #{val}").with( ensure: 'present', user_name: 'boone', keyspace_name: 'ravens', @@ -349,12 +351,13 @@ table_name: 'plays' ) end + read_script = '/usr/bin/cqlsh -e "LIST ALL PERMISSIONS ON TABLE ravens.plays" ' read_script += "localhost 9042 | grep ' boone | *boone | .* #{val}$'" script_command = "GRANT #{val} ON TABLE ravens.plays TO boone" exec_command = "/usr/bin/cqlsh -e \"#{script_command}\" localhost 9042" it do - is_expected.to contain_exec(script_command). + expect(subject).to contain_exec(script_command). only_with(command: exec_command, unless: read_script, require: 'Exec[::cassandra::schema connection test]') @@ -372,7 +375,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -391,14 +394,14 @@ end it do - is_expected.to have_resource_count(18) - is_expected.to contain_cassandra__schema__permission('boone:ALL:ravens.plays') + expect(subject).to have_resource_count(18) + expect(subject).to contain_cassandra__schema__permission('boone:ALL:ravens.plays') end expected_values = %w[ALTER AUTHORIZE DROP MODIFY SELECT] expected_values.each do |val| it do - is_expected.to contain_cassandra__schema__permission("boone:ALL:ravens.plays - #{val}").with( + expect(subject).to contain_cassandra__schema__permission("boone:ALL:ravens.plays - #{val}").with( ensure: 'present', user_name: 'boone', keyspace_name: 'ravens', @@ -406,12 +409,13 @@ table_name: 'plays' ) end + read_script = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ALL PERMISSIONS ON TABLE ravens.plays\" ' read_script += "localhost 9042 | grep ' boone | *boone | .* #{val}$'\"" script_command = "GRANT #{val} ON TABLE ravens.plays TO boone" exec_command = "/usr/bin/scl enable testscl \"/usr/bin/cqlsh -e \\\"#{script_command}\\\" localhost 9042\"" it do - is_expected.to contain_exec(script_command). + expect(subject).to contain_exec(script_command). only_with(command: exec_command, unless: read_script, require: 'Exec[::cassandra::schema connection test]') @@ -429,7 +433,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -449,13 +453,13 @@ end it do - is_expected.to have_resource_count(9) - is_expected.to contain_cassandra__schema__permission('REVOKE boone:SELECT:ravens.plays') + expect(subject).to have_resource_count(9) + expect(subject).to contain_cassandra__schema__permission('REVOKE boone:SELECT:ravens.plays') read_script = '/usr/bin/cqlsh -e "LIST ALL PERMISSIONS ON KEYSPACE forty9ers" ' read_script += "localhost 9042 | grep ' boone | *boone | .* SELECT$'" script_command = 'REVOKE SELECT ON KEYSPACE forty9ers FROM boone' exec_command = "/usr/bin/cqlsh -e \"#{script_command}\" localhost 9042" - is_expected.to contain_exec(script_command). + expect(subject).to contain_exec(script_command). only_with(command: exec_command, onlyif: read_script, require: 'Exec[::cassandra::schema connection test]') @@ -472,7 +476,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -492,13 +496,13 @@ end it do - is_expected.to have_resource_count(9) - is_expected.to contain_cassandra__schema__permission('REVOKE boone:SELECT:ravens.plays') + expect(subject).to have_resource_count(9) + expect(subject).to contain_cassandra__schema__permission('REVOKE boone:SELECT:ravens.plays') read_script = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ALL PERMISSIONS ON KEYSPACE forty9ers\" ' read_script += "localhost 9042 | grep ' boone | *boone | .* SELECT$'\"" script_command = 'REVOKE SELECT ON KEYSPACE forty9ers FROM boone' exec_command = "/usr/bin/scl enable testscl \"/usr/bin/cqlsh -e \\\"#{script_command}\\\" localhost 9042\"" - is_expected.to contain_exec(script_command). + expect(subject).to contain_exec(script_command). only_with(command: exec_command, onlyif: read_script, require: 'Exec[::cassandra::schema connection test]') diff --git a/spec/defines/schema/table_spec.rb b/spec/defines/schema/table_spec.rb index e802cf9f..de75aaed 100644 --- a/spec/defines/schema/table_spec.rb +++ b/spec/defines/schema/table_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra::schema::table' do @@ -10,7 +12,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -44,14 +46,14 @@ end it do - is_expected.to compile - is_expected.to contain_cassandra__schema__table('users') + expect(subject).to compile + expect(subject).to contain_cassandra__schema__table('users') read_command = '/usr/bin/cqlsh -e "DESC TABLE Excelsior.users" localhost 9042' exec_command = '/usr/bin/cqlsh -e "CREATE TABLE IF NOT EXISTS Excelsior.users ' exec_command += '(userid text, username FROZEN, emails set, top_scores list, ' exec_command += 'todo map, tuple, PRIMARY KEY (userid)) ' exec_command += 'WITH COMPACT STORAGE AND ID=\'5a1c395e-b41f-11e5-9f22-ba0be0483c18\'" localhost 9042' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(unless: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -66,7 +68,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -100,14 +102,14 @@ end it do - is_expected.to compile - is_expected.to contain_cassandra__schema__table('users') + expect(subject).to compile + expect(subject).to contain_cassandra__schema__table('users') read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DESC TABLE Excelsior.users\" localhost 9042"' exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE TABLE IF NOT EXISTS Excelsior.users ' exec_command += '(userid text, username FROZEN, emails set, top_scores list, ' exec_command += 'todo map, tuple, PRIMARY KEY (userid)) ' exec_command += 'WITH COMPACT STORAGE AND ID=\'5a1c395e-b41f-11e5-9f22-ba0be0483c18\'\" localhost 9042"' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(unless: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -122,7 +124,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -142,10 +144,10 @@ end it do - is_expected.to compile + expect(subject).to compile read_command = '/usr/bin/cqlsh -e "DESC TABLE Excelsior.users" localhost 9042' exec_command = '/usr/bin/cqlsh -e "DROP TABLE IF EXISTS Excelsior.users" localhost 9042' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(onlyif: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -157,9 +159,9 @@ operatingsystemmajrelease: 7, osfamily: 'RedHat', os: { - 'family' => 'RedHat', + 'family' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -179,10 +181,10 @@ end it do - is_expected.to compile + expect(subject).to compile read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DESC TABLE Excelsior.users\" localhost 9042"' exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DROP TABLE IF EXISTS Excelsior.users\" localhost 9042"' - is_expected.to contain_exec(exec_command). + expect(subject).to contain_exec(exec_command). only_with(onlyif: read_command, require: 'Exec[::cassandra::schema connection test]') end @@ -197,7 +199,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } diff --git a/spec/defines/schema/user_spec.rb b/spec/defines/schema/user_spec.rb index f70c42a5..ecf95633 100644 --- a/spec/defines/schema/user_spec.rb +++ b/spec/defines/schema/user_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandra::schema::user' do @@ -11,7 +13,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -31,11 +33,11 @@ end it do - is_expected.to contain_cassandra__schema__user('akers').with_ensure('present') + expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') read_command = '/usr/bin/cqlsh -e "LIST USERS" localhost 9042 | grep \'\s*akers |\'' exec_command = '/usr/bin/cqlsh -e "CREATE USER IF NOT EXISTS akers' exec_command += ' WITH PASSWORD \'Niner2\' SUPERUSER" localhost 9042' - is_expected.to contain_exec('Create user (akers)'). + expect(subject).to contain_exec('Create user (akers)'). only_with(command: exec_command, unless: read_command, require: 'Exec[::cassandra::schema connection test]') @@ -52,7 +54,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -72,11 +74,11 @@ end it do - is_expected.to contain_cassandra__schema__user('akers').with_ensure('present') + expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST USERS\" localhost 9042 | grep \'\s*akers |\'"' exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE USER IF NOT EXISTS akers' exec_command += ' WITH PASSWORD \'Niner2\' SUPERUSER\" localhost 9042"' - is_expected.to contain_exec('Create user (akers)'). + expect(subject).to contain_exec('Create user (akers)'). only_with(command: exec_command, unless: read_command, require: 'Exec[::cassandra::schema connection test]') @@ -93,7 +95,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -113,11 +115,11 @@ end it do - is_expected.to contain_cassandra__schema__user('akers').with_ensure('present') + expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') read_command = '/usr/bin/cqlsh -e "LIST USERS" localhost 9042 | grep \'\s*akers |\'' exec_command = '/usr/bin/cqlsh -e "CREATE USER IF NOT EXISTS akers' exec_command += ' WITH PASSWORD \'Niner2\' SUPERUSER" localhost 9042' - is_expected.to contain_exec('Create user (akers)'). + expect(subject).to contain_exec('Create user (akers)'). only_with(command: exec_command, unless: read_command, require: 'Exec[::cassandra::schema connection test]') @@ -134,7 +136,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -154,11 +156,11 @@ end it do - is_expected.to contain_cassandra__schema__user('akers').with_ensure('present') + expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST USERS\" localhost 9042 | grep \'\s*akers |\'"' exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE USER IF NOT EXISTS akers' exec_command += ' WITH PASSWORD \'Niner2\' SUPERUSER\" localhost 9042"' - is_expected.to contain_exec('Create user (akers)'). + expect(subject).to contain_exec('Create user (akers)'). only_with(command: exec_command, unless: read_command, require: 'Exec[::cassandra::schema connection test]') @@ -175,7 +177,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -194,11 +196,11 @@ end it do - is_expected.to contain_cassandra__schema__user('akers').with_ensure('present') + expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') read_command = '/usr/bin/cqlsh -e "LIST USERS" localhost 9042 | grep \'\s*akers |\'' exec_command = '/usr/bin/cqlsh -e "CREATE USER IF NOT EXISTS akers' exec_command += ' WITH PASSWORD \'Niner2\' NOSUPERUSER" localhost 9042' - is_expected.to contain_exec('Create user (akers)'). + expect(subject).to contain_exec('Create user (akers)'). only_with(command: exec_command, unless: read_command, require: 'Exec[::cassandra::schema connection test]') @@ -215,7 +217,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -234,11 +236,11 @@ end it do - is_expected.to contain_cassandra__schema__user('akers').with_ensure('present') + expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST USERS\" localhost 9042 | grep \'\s*akers |\'"' exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE USER IF NOT EXISTS akers' exec_command += ' WITH PASSWORD \'Niner2\' NOSUPERUSER\" localhost 9042"' - is_expected.to contain_exec('Create user (akers)'). + expect(subject).to contain_exec('Create user (akers)'). only_with(command: exec_command, unless: read_command, require: 'Exec[::cassandra::schema connection test]') @@ -255,7 +257,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -275,11 +277,11 @@ end it do - is_expected.to contain_cassandra__schema__user('akers').with_ensure('present') + expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') read_command = '/usr/bin/cqlsh -e "LIST ROLES" localhost 9042 | grep \'\s*akers |\'' exec_command = '/usr/bin/cqlsh -e "CREATE ROLE IF NOT EXISTS akers' exec_command += ' WITH PASSWORD = \'Niner2\' AND SUPERUSER = true AND LOGIN = true" localhost 9042' - is_expected.to contain_exec('Create user (akers)'). + expect(subject).to contain_exec('Create user (akers)'). only_with(command: exec_command, unless: read_command, require: 'Exec[::cassandra::schema connection test]') @@ -296,7 +298,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -316,11 +318,11 @@ end it do - is_expected.to contain_cassandra__schema__user('akers').with_ensure('present') + expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ROLES\" localhost 9042 | grep \'\s*akers |\'"' exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE ROLE IF NOT EXISTS akers' exec_command += ' WITH PASSWORD = \'Niner2\' AND SUPERUSER = true AND LOGIN = true\" localhost 9042"' - is_expected.to contain_exec('Create user (akers)'). + expect(subject).to contain_exec('Create user (akers)'). only_with(command: exec_command, unless: read_command, require: 'Exec[::cassandra::schema connection test]') @@ -337,7 +339,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -357,11 +359,11 @@ end it do - is_expected.to contain_cassandra__schema__user('bob').with_ensure('present') + expect(subject).to contain_cassandra__schema__user('bob').with_ensure('present') read_command = '/usr/bin/cqlsh -e "LIST ROLES" localhost 9042 | grep \'\s*bob |\'' exec_command = '/usr/bin/cqlsh -e "CREATE ROLE IF NOT EXISTS bob' exec_command += ' WITH PASSWORD = \'kaZe89a\'" localhost 9042' - is_expected.to contain_exec('Create user (bob)'). + expect(subject).to contain_exec('Create user (bob)'). only_with(command: exec_command, unless: read_command, require: 'Exec[::cassandra::schema connection test]') @@ -378,7 +380,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -398,11 +400,11 @@ end it do - is_expected.to contain_cassandra__schema__user('bob').with_ensure('present') + expect(subject).to contain_cassandra__schema__user('bob').with_ensure('present') read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ROLES\" localhost 9042 | grep \'\s*bob |\'"' exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE ROLE IF NOT EXISTS bob' exec_command += ' WITH PASSWORD = \'kaZe89a\'\" localhost 9042"' - is_expected.to contain_exec('Create user (bob)'). + expect(subject).to contain_exec('Create user (bob)'). only_with(command: exec_command, unless: read_command, require: 'Exec[::cassandra::schema connection test]') @@ -419,7 +421,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -441,7 +443,7 @@ it do read_command = '/usr/bin/cqlsh -e "LIST ROLES" localhost 9042 | grep \'\s*akers |\'' exec_command = '/usr/bin/cqlsh -e "DROP ROLE akers" localhost 9042' - is_expected.to contain_exec('Delete user (akers)'). + expect(subject).to contain_exec('Delete user (akers)'). only_with(command: exec_command, onlyif: read_command, require: 'Exec[::cassandra::schema connection test]') @@ -458,7 +460,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -480,7 +482,7 @@ it do read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ROLES\" localhost 9042 | grep \'\s*akers |\'"' exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DROP ROLE akers\" localhost 9042"' - is_expected.to contain_exec('Delete user (akers)'). + expect(subject).to contain_exec('Delete user (akers)'). only_with(command: exec_command, onlyif: read_command, require: 'Exec[::cassandra::schema connection test]') @@ -497,7 +499,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -519,7 +521,7 @@ it do read_command = '/usr/bin/cqlsh -e "LIST USERS" localhost 9042 | grep \'\s*akers |\'' exec_command = '/usr/bin/cqlsh -e "DROP USER akers" localhost 9042' - is_expected.to contain_exec('Delete user (akers)'). + expect(subject).to contain_exec('Delete user (akers)'). only_with(command: exec_command, onlyif: read_command, require: 'Exec[::cassandra::schema connection test]') @@ -536,7 +538,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } @@ -558,7 +560,7 @@ it do read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST USERS\" localhost 9042 | grep \'\s*akers |\'"' exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DROP USER akers\" localhost 9042"' - is_expected.to contain_exec('Delete user (akers)'). + expect(subject).to contain_exec('Delete user (akers)'). only_with(command: exec_command, onlyif: read_command, require: 'Exec[::cassandra::schema connection test]') @@ -574,7 +576,7 @@ 'family' => 'RedHat', 'name' => 'RedHat', 'release' => { - 'full' => '7.6.1810', + 'full' => '7.6.1810', 'major' => '7', 'minor' => '6' } diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 06a565dc..2ee3dd11 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'beaker-rspec' require 'pry' @@ -7,11 +9,12 @@ def initialize(roles, version, operatingsystemmajrelease) @roles = roles @version = version - if version == 2.1 + case version + when 2.1 init21 - elsif version == 2.2 + when 2.2 init22 - elsif version == 3.0 + when 3.0 init30(operatingsystemmajrelease) end end @@ -251,18 +254,17 @@ def facts_testing_pp end def firewall_pp - pp = if @roles.include? 'firewall' - <<-EOS - class { 'cassandra::firewall_ports': - require => Class['cassandra'], + if @roles.include? 'firewall' + <<-EOS + class { '::cassandra::firewall_ports': + require => Class['::cassandra'], } - EOS - else - <<-EOS + EOS + else + <<-EOS # Firewall test skipped - EOS - end - pp + EOS + end end def permissions_revoke_pp @@ -448,7 +450,7 @@ class { 'cassandra::schema': end def schema_drop_type_pp - pp = <<-EOS + <<-EOS #{cassandra_install_pp} $cql_types = { 'fullname' => { @@ -462,11 +464,10 @@ class { 'cassandra::schema': cqlsh_password => 'Niner2', } EOS - pp end def schema_drop_user_pp - pp = <<-EOS + <<-EOS #{cassandra_install_pp} class { 'cassandra::schema': cqlsh_password => 'Niner2', @@ -479,7 +480,6 @@ class { 'cassandra::schema': }, } EOS - pp end end diff --git a/spec/unit/facter/cassandracmsheapnewsize_spec.rb b/spec/unit/facter/cassandracmsheapnewsize_spec.rb index 36f8b2ab..7b950900 100644 --- a/spec/unit/facter/cassandracmsheapnewsize_spec.rb +++ b/spec/unit/facter/cassandracmsheapnewsize_spec.rb @@ -1,7 +1,10 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandracmsheapnewsize' do before { Facter.clear } + after { Facter.clear } describe 'Heap settings' do diff --git a/spec/unit/facter/cassandracmsmaxheapsize_spec.rb b/spec/unit/facter/cassandracmsmaxheapsize_spec.rb index 489e9f83..bc45e5c1 100644 --- a/spec/unit/facter/cassandracmsmaxheapsize_spec.rb +++ b/spec/unit/facter/cassandracmsmaxheapsize_spec.rb @@ -1,7 +1,10 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandracmsmaxheapsize' do before { Facter.clear } + after { Facter.clear } describe 'Heap settings' do diff --git a/spec/unit/facter/cassandraheapnewsize_spec.rb b/spec/unit/facter/cassandraheapnewsize_spec.rb index 04af0184..a089af68 100644 --- a/spec/unit/facter/cassandraheapnewsize_spec.rb +++ b/spec/unit/facter/cassandraheapnewsize_spec.rb @@ -1,7 +1,10 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandraheapnewsize' do before { Facter.clear } + after { Facter.clear } describe 'Heap settings' do diff --git a/spec/unit/facter/cassandramajorversion_spec.rb b/spec/unit/facter/cassandramajorversion_spec.rb index 151c520f..57aa4e0d 100644 --- a/spec/unit/facter/cassandramajorversion_spec.rb +++ b/spec/unit/facter/cassandramajorversion_spec.rb @@ -1,7 +1,10 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandramajorversion' do before { Facter.clear } + after { Facter.clear } describe 'cassandrarelease DSE' do diff --git a/spec/unit/facter/cassandramaxheapsize_spec.rb b/spec/unit/facter/cassandramaxheapsize_spec.rb index 135afb19..176aae10 100644 --- a/spec/unit/facter/cassandramaxheapsize_spec.rb +++ b/spec/unit/facter/cassandramaxheapsize_spec.rb @@ -1,7 +1,10 @@ +# frozen_string_literal: true + require 'spec_helper' describe ':cassandramaxheapsize' do before { Facter.clear } + after { Facter.clear } describe 'Heap settings' do diff --git a/spec/unit/facter/cassandraminorversion_spec.rb b/spec/unit/facter/cassandraminorversion_spec.rb index 575c184e..37355a91 100644 --- a/spec/unit/facter/cassandraminorversion_spec.rb +++ b/spec/unit/facter/cassandraminorversion_spec.rb @@ -1,7 +1,10 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandraminorversion' do before { Facter.clear } + after { Facter.clear } describe 'cassandrarelease DSE' do diff --git a/spec/unit/facter/cassandrapatchversion_spec.rb b/spec/unit/facter/cassandrapatchversion_spec.rb index c85aaf86..c870e49e 100644 --- a/spec/unit/facter/cassandrapatchversion_spec.rb +++ b/spec/unit/facter/cassandrapatchversion_spec.rb @@ -1,7 +1,10 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandrapatchversion' do before { Facter.clear } + after { Facter.clear } describe 'cassandrarelease DSE' do diff --git a/spec/unit/facter/cassandrarelease_spec.rb b/spec/unit/facter/cassandrarelease_spec.rb index 98b18305..313d5152 100644 --- a/spec/unit/facter/cassandrarelease_spec.rb +++ b/spec/unit/facter/cassandrarelease_spec.rb @@ -1,7 +1,10 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'cassandrarelease' do before { Facter.clear } + after { Facter.clear } describe 'cassandrarelease DSE' do From 02cce7e3be4db53bc4a948c6e7d1feeecb14c431 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 16 Dec 2021 10:15:27 +0100 Subject: [PATCH 05/27] puppet-lint: fix top_scope_facts --- examples/facts.pp | 8 ++++---- manifests/schema/user.pp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/facts.pp b/examples/facts.pp index fb2f5168..18ee222e 100644 --- a/examples/facts.pp +++ b/examples/facts.pp @@ -1,23 +1,23 @@ if $facts['cassandrarelease'] { notify { "Cassandra release: ${facts['cassandrarelease']}": } } else { - warning('cassandrarelease is not set!') + warning('fact cassandrarelease is not set!') } if $facts['cassandramajorversion'] { notify { "Cassandra major version: ${facts['cassandramajorversion']}": } } else { - warning('cassandramajorversion is not set!') + warning('fact cassandramajorversion is not set!') } if $facts['cassandraminorversion'] { notify { "Cassandra minor version: ${facts['cassandraminorversion']}": } } else { - warning('cassandraminorversion is not set!') + warning('fact cassandraminorversion is not set!') } if $facts['cassandrapatchversion'] { notify { "Cassandra patch version: ${facts['cassandrapatchversion']}": } } else { - warning('cassandrapatchversion is not set!') + warning('fact cassandrapatchversion is not set!') } diff --git a/manifests/schema/user.pp b/manifests/schema/user.pp index 12729521..e3b7802a 100644 --- a/manifests/schema/user.pp +++ b/manifests/schema/user.pp @@ -33,7 +33,7 @@ $quote = '"' } - if $facts['cassandrarelease'] != undef { + if $facts['cassandrarelease'] { if versioncmp($facts['cassandrarelease'], '2.2') < 0 { $operate_with_roles = false } else { From 9fda700582ea22867a281361c7f5e994fe8c7a5f Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 16 Dec 2021 10:47:28 +0100 Subject: [PATCH 06/27] Migrate tests to rspec-puppet-facts --- spec/classes/init_spec.rb | 772 +++++++++------------- spec/defines/schema/permission_spec.rb | 693 ++++++++------------ spec/defines/schema/user_spec.rb | 858 +++++++++---------------- 3 files changed, 880 insertions(+), 1443 deletions(-) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 8273bb8b..048c3a8f 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -3,487 +3,325 @@ require 'spec_helper' describe 'cassandra' do - context 'On an unknown OS with defaults for all parameters' do - let :facts do - { - operatingsystemmajrelease: '16', - osfamily: 'Darwin', - os: { - 'family' => 'Darwin', - 'release' => { - 'full' => '16.0.0', - 'major' => '16', - 'minor' => '0' - } - } - } - end - - it { is_expected.to raise_error(Puppet::Error) } + let :node do + 'foo.example.com' end + on_supported_os.each do |os, facts| - context 'Test the default parameters (RedHat)' do let :facts do - { - osfamily: 'RedHat', - operatingsystemmajrelease: '7', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } - } - } + facts end - - it do - expect(subject).to contain_package('cassandra').with( - ensure: 'present', - name: 'cassandra22' - ).that_notifies('Exec[cassandra_reload_systemctl]') - - expect(subject).to contain_exec('cassandra_reload_systemctl').only_with( - command: '/usr/bin/systemctl daemon-reload', - onlyif: 'test -x /usr/bin/systemctl', - path: ['/usr/bin', '/bin'], - refreshonly: true - ) - - expect(subject).to contain_file('/etc/cassandra/default.conf').with( - ensure: 'directory', - group: 'cassandra', - owner: 'cassandra', - mode: '0755' - ).that_requires('Package[cassandra]') - - expect(subject).to contain_file('/etc/cassandra/default.conf/cassandra.yaml'). - with( - ensure: 'file', - owner: 'cassandra', - group: 'cassandra', - mode: '0644' - ). - that_requires('Package[cassandra]') - - expect(subject).to contain_class('cassandra').only_with( - baseline_settings: {}, - cassandra_2356_sleep_seconds: 5, - cassandra_9822: false, # rubocop:disable Naming/VariableNumber - cassandra_yaml_tmpl: 'cassandra/cassandra.yaml.erb', - commitlog_directory_mode: '0750', - manage_config_file: true, - config_file_mode: '0644', - config_path: '/etc/cassandra/default.conf', - data_file_directories_mode: '0750', - dc: 'DC1', - fail_on_non_supported_os: true, - hints_directory_mode: '0750', - package_ensure: 'present', - package_name: 'cassandra22', - rack: 'RAC1', - rackdc_tmpl: 'cassandra/cassandra-rackdc.properties.erb', - saved_caches_directory_mode: '0750', - service_enable: true, - service_name: 'cassandra', - service_provider: nil, - service_refresh: true, - settings: {}, - snitch_properties_file: 'cassandra-rackdc.properties', - systemctl: '/usr/bin/systemctl' - ) - end - end - - context 'On RedHat 7 with data directories specified.' do - let :facts do - { - osfamily: 'RedHat', - operatingsystemmajrelease: '7', - os: { - 'family' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' + context "on #{os}" do + context 'On an unknown OS with defaults for all parameters' do + it { is_expected.to raise_error(Puppet::Error) } + end + + context 'Test the default parameters (RedHat)' do + + it do + expect(subject).to contain_package('cassandra').with( + ensure: 'present', + name: 'cassandra22' + ).that_notifies('Exec[cassandra_reload_systemctl]') + + expect(subject).to contain_exec('cassandra_reload_systemctl').only_with( + command: '/usr/bin/systemctl daemon-reload', + onlyif: 'test -x /usr/bin/systemctl', + path: ['/usr/bin', '/bin'], + refreshonly: true + ) + + expect(subject).to contain_file('/etc/cassandra/default.conf').with( + ensure: 'directory', + group: 'cassandra', + owner: 'cassandra', + mode: '0755' + ).that_requires('Package[cassandra]') + + expect(subject).to contain_file('/etc/cassandra/default.conf/cassandra.yaml'). + with( + ensure: 'file', + owner: 'cassandra', + group: 'cassandra', + mode: '0644' + ). + that_requires('Package[cassandra]') + + expect(subject).to contain_class('cassandra').only_with( + baseline_settings: {}, + cassandra_2356_sleep_seconds: 5, + cassandra_9822: false, # rubocop:disable Naming/VariableNumber + cassandra_yaml_tmpl: 'cassandra/cassandra.yaml.erb', + commitlog_directory_mode: '0750', + manage_config_file: true, + config_file_mode: '0644', + config_path: '/etc/cassandra/default.conf', + data_file_directories_mode: '0750', + dc: 'DC1', + fail_on_non_supported_os: true, + hints_directory_mode: '0750', + package_ensure: 'present', + package_name: 'cassandra22', + rack: 'RAC1', + rackdc_tmpl: 'cassandra/cassandra-rackdc.properties.erb', + saved_caches_directory_mode: '0750', + service_enable: true, + service_name: 'cassandra', + service_provider: nil, + service_refresh: true, + settings: {}, + snitch_properties_file: 'cassandra-rackdc.properties', + systemctl: '/usr/bin/systemctl' + ) + end + end + + context 'On RedHat 7 with data directories specified.' do + + let :params do + { + commitlog_directory: '/var/lib/cassandra/commitlog', + data_file_directories: ['/var/lib/cassandra/data'], + hints_directory: '/var/lib/cassandra/hints', + saved_caches_directory: '/var/lib/cassandra/saved_caches', + settings: { 'cluster_name' => 'MyCassandraCluster' } } - } - } - end - - let :params do - { - commitlog_directory: '/var/lib/cassandra/commitlog', - data_file_directories: ['/var/lib/cassandra/data'], - hints_directory: '/var/lib/cassandra/hints', - saved_caches_directory: '/var/lib/cassandra/saved_caches', - settings: { 'cluster_name' => 'MyCassandraCluster' } - } - end - - it do - expect(subject).to have_resource_count(10) - expect(subject).to contain_file('/var/lib/cassandra/commitlog') - expect(subject).to contain_file('/var/lib/cassandra/data') - expect(subject).to contain_file('/var/lib/cassandra/hints') - expect(subject).to contain_file('/var/lib/cassandra/saved_caches') - end - end - - context 'On RedHat 7 with service provider set to init.' do - let :facts do - { - osfamily: 'RedHat', - operatingsystemmajrelease: '7', - os: { - 'family' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' + end + + it do + expect(subject).to have_resource_count(10) + expect(subject).to contain_file('/var/lib/cassandra/commitlog') + expect(subject).to contain_file('/var/lib/cassandra/data') + expect(subject).to contain_file('/var/lib/cassandra/hints') + expect(subject).to contain_file('/var/lib/cassandra/saved_caches') + end + end + + context 'On RedHat 7 with service provider set to init.' do + + let :params do + { + service_provider: 'init' } - } - } - end - - let :params do - { - service_provider: 'init' - } - end - - it do - expect(subject).to have_resource_count(7) - expect(subject).to contain_exec('/sbin/chkconfig --add cassandra').with( - unless: '/sbin/chkconfig --list cassandra' - ). - that_requires('Package[cassandra]'). - that_comes_before('Service[cassandra]') - end - end - - context 'On a Debian OS with defaults for all parameters' do - let :facts do - { - operatingsystemmajrelease: '8', - osfamily: 'Debian', - os: { - 'family' => 'Debian', - 'release' => { - 'full' => '8.11', - 'major' => '8', - 'minor' => '11' + end + + it do + expect(subject).to have_resource_count(7) + expect(subject).to contain_exec('/sbin/chkconfig --add cassandra').with( + unless: '/sbin/chkconfig --list cassandra' + ). + that_requires('Package[cassandra]'). + that_comes_before('Service[cassandra]') + end + end + + context 'On a Debian OS with defaults for all parameters' do + + it do + expect(subject).to contain_class('cassandra') + expect(subject).to contain_group('cassandra').with_ensure('present') + + expect(subject).to contain_package('cassandra').with( + ensure: 'present', + name: 'cassandra' + ).that_notifies('Exec[cassandra_reload_systemctl]') + + expect(subject).to contain_exec('cassandra_reload_systemctl').only_with( + command: '/bin/systemctl daemon-reload', + onlyif: 'test -x /bin/systemctl', + path: ['/usr/bin', '/bin'], + refreshonly: true + ) + + expect(subject).to contain_service('cassandra').with( + ensure: nil, + name: 'cassandra', + enable: 'true' + ) + + expect(subject).to contain_exec('CASSANDRA-2356 sleep'). + with( + command: '/bin/sleep 5', + refreshonly: true, + user: 'root' + ). + that_subscribes_to('Package[cassandra]'). + that_comes_before('Service[cassandra]') + + expect(subject).to contain_user('cassandra'). + with( + ensure: 'present', + comment: 'Cassandra database,,,', + gid: 'cassandra', + home: '/var/lib/cassandra', + shell: '/bin/false', + managehome: true + ). + that_requires('Group[cassandra]') + + expect(subject).to contain_file('/etc/cassandra').with( + ensure: 'directory', + group: 'cassandra', + owner: 'cassandra', + mode: '0755' + ) + + expect(subject).to contain_file('/etc/cassandra/cassandra.yaml'). + with( + ensure: 'file', + owner: 'cassandra', + group: 'cassandra', + mode: '0644' + ). + that_comes_before('Package[cassandra]'). + that_requires(['User[cassandra]', 'File[/etc/cassandra]']) + + expect(subject).to contain_file('/etc/cassandra/cassandra-rackdc.properties'). + with( + ensure: 'file', + owner: 'cassandra', + group: 'cassandra', + mode: '0644' + ). + that_requires(['File[/etc/cassandra]', 'User[cassandra]']). + that_comes_before('Package[cassandra]') + + expect(subject).to contain_service('cassandra'). + that_subscribes_to( + [ + 'File[/etc/cassandra/cassandra.yaml]', + 'File[/etc/cassandra/cassandra-rackdc.properties]', + 'Package[cassandra]' + ] + ) + end + end + + context 'CASSANDRA-9822 activated on Ubuntu 16.04' do + + let :params do + { + cassandra_9822: true # rubocop:disable Naming/VariableNumber } - } - } - end - - it do - expect(subject).to contain_class('cassandra') - expect(subject).to contain_group('cassandra').with_ensure('present') - - expect(subject).to contain_package('cassandra').with( - ensure: 'present', - name: 'cassandra' - ).that_notifies('Exec[cassandra_reload_systemctl]') - - expect(subject).to contain_exec('cassandra_reload_systemctl').only_with( - command: '/bin/systemctl daemon-reload', - onlyif: 'test -x /bin/systemctl', - path: ['/usr/bin', '/bin'], - refreshonly: true - ) - - expect(subject).to contain_service('cassandra').with( - ensure: nil, - name: 'cassandra', - enable: 'true' - ) - - expect(subject).to contain_exec('CASSANDRA-2356 sleep'). - with( - command: '/bin/sleep 5', - refreshonly: true, - user: 'root' - ). - that_subscribes_to('Package[cassandra]'). - that_comes_before('Service[cassandra]') - - expect(subject).to contain_user('cassandra'). - with( - ensure: 'present', - comment: 'Cassandra database,,,', - gid: 'cassandra', - home: '/var/lib/cassandra', - shell: '/bin/false', - managehome: true - ). - that_requires('Group[cassandra]') - - expect(subject).to contain_file('/etc/cassandra').with( - ensure: 'directory', - group: 'cassandra', - owner: 'cassandra', - mode: '0755' - ) - - expect(subject).to contain_file('/etc/cassandra/cassandra.yaml'). - with( - ensure: 'file', - owner: 'cassandra', - group: 'cassandra', - mode: '0644' - ). - that_comes_before('Package[cassandra]'). - that_requires(['User[cassandra]', 'File[/etc/cassandra]']) - - expect(subject).to contain_file('/etc/cassandra/cassandra-rackdc.properties'). - with( - ensure: 'file', - owner: 'cassandra', - group: 'cassandra', - mode: '0644' - ). - that_requires(['File[/etc/cassandra]', 'User[cassandra]']). - that_comes_before('Package[cassandra]') - - expect(subject).to contain_service('cassandra'). - that_subscribes_to( - [ - 'File[/etc/cassandra/cassandra.yaml]', - 'File[/etc/cassandra/cassandra-rackdc.properties]', - 'Package[cassandra]' - ] - ) - end - end - - context 'CASSANDRA-9822 activated on Ubuntu 16.04' do - let :facts do - { - operatingsystemmajrelease: '16.04', - osfamily: 'Debian', - lsbdistid: 'Ubuntu', - lsbdistrelease: '16.04', - os: { - 'name' => 'Ubuntu', - 'family' => 'Debian', - 'release' => { - 'full' => '16.04', - 'major' => '16.04' + end + + it do + expect(subject).to contain_file('/etc/init.d/cassandra').with( + source: 'puppet:///modules/cassandra/CASSANDRA-9822/cassandra', + mode: '0555' + ).that_comes_before('Package[cassandra]') + end + end + + context 'Install DSE on a Red Hat family OS.' do + + let :params do + { + package_ensure: '4.7.0-1', + package_name: 'dse-full', + config_path: '/etc/dse/cassandra', + service_name: 'dse' } - } - } - end - - let :params do - { - cassandra_9822: true # rubocop:disable Naming/VariableNumber - } - end - - it do - expect(subject).to contain_file('/etc/init.d/cassandra').with( - source: 'puppet:///modules/cassandra/CASSANDRA-9822/cassandra', - mode: '0555' - ).that_comes_before('Package[cassandra]') - end - end - - context 'Install DSE on a Red Hat family OS.' do - let :facts do - { - operatingsystemmajrelease: '7', - osfamily: 'RedHat', - os: { - 'family' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' + end + + it do + expect(subject).to contain_file('/etc/dse/cassandra/cassandra.yaml').that_notifies('Service[cassandra]') + expect(subject).to contain_file('/etc/dse/cassandra') + + expect(subject).to contain_file('/etc/dse/cassandra/cassandra-rackdc.properties'). + with( + ensure: 'file', + owner: 'cassandra', + group: 'cassandra', + mode: '0644' + ). + that_notifies('Service[cassandra]') + + expect(subject).to contain_package('cassandra').with( + ensure: '4.7.0-1', + name: 'dse-full' + ) + expect(subject).to contain_service('cassandra').with_name('dse') + end + end + + context 'On an unsupported OS pleading tolerance' do + let :params do + { + config_file_mode: '0755', + config_path: '/etc/cassandra', + fail_on_non_supported_os: false, + package_name: 'cassandra', + service_provider: 'base', + systemctl: '/bin/true' } - } - } - end + end - let :params do - { - package_ensure: '4.7.0-1', - package_name: 'dse-full', - config_path: '/etc/dse/cassandra', - service_name: 'dse' - } - end + it do + expect(subject).to contain_file('/etc/cassandra/cassandra.yaml').with('mode' => '0755') + expect(subject).to contain_service('cassandra').with(provider: 'base') + expect(subject).to have_resource_count(6) + end + end - it do - expect(subject).to contain_file('/etc/dse/cassandra/cassandra.yaml').that_notifies('Service[cassandra]') - expect(subject).to contain_file('/etc/dse/cassandra') - - expect(subject).to contain_file('/etc/dse/cassandra/cassandra-rackdc.properties'). - with( - ensure: 'file', - owner: 'cassandra', - group: 'cassandra', - mode: '0644' - ). - that_notifies('Service[cassandra]') - - expect(subject).to contain_package('cassandra').with( - ensure: '4.7.0-1', - name: 'dse-full' - ) - expect(subject).to contain_service('cassandra').with_name('dse') - end - end + context 'Ensure cassandra service can be stopped and disabled.' do - context 'On an unsupported OS pleading tolerance' do - let :facts do - { - operatingsystemmajrelease: '16', - osfamily: 'Darwin', - os: { - 'family' => 'Darwin', - 'release' => { - 'full' => '16.0.0', - 'major' => '16', - 'minor' => '0' + let :params do + { + service_ensure: 'stopped', + service_enable: 'false' } - } - } - end - let :params do - { - config_file_mode: '0755', - config_path: '/etc/cassandra', - fail_on_non_supported_os: false, - package_name: 'cassandra', - service_provider: 'base', - systemctl: '/bin/true' - } - end - - it do - expect(subject).to contain_file('/etc/cassandra/cassandra.yaml').with('mode' => '0755') - expect(subject).to contain_service('cassandra').with(provider: 'base') - expect(subject).to have_resource_count(6) - end - end - - context 'Ensure cassandra service can be stopped and disabled.' do - let :facts do - { - operatingsystemmajrelease: '8', - osfamily: 'Debian', - os: { - 'family' => 'Debian', - 'release' => { - 'full' => '8.11', - 'major' => '8', - 'minor' => '11' + end + + it do + expect(subject).to contain_service('cassandra'). + with(ensure: 'stopped', + name: 'cassandra', + enable: 'false') + end + end + + context 'Test the dc and rack properties with defaults (Debian).' do + + it do + expect(subject).to contain_file('/etc/cassandra/cassandra-rackdc.properties'). + with_content(%r{^dc=DC1}). + with_content(%r{^rack=RAC1$}). + with_content(%r{^#dc_suffix=$}). + with_content(%r{^# prefer_local=true$}) + end + end + + context 'Test the dc and rack properties with defaults (RedHat).' do + + it do + expect(subject).to contain_file('/etc/cassandra/default.conf/cassandra-rackdc.properties'). + with_content(%r{^dc=DC1}). + with_content(%r{^rack=RAC1$}). + with_content(%r{^#dc_suffix=$}). + with_content(%r{^# prefer_local=true$}) + end + end + + context 'Test the dc and rack properties.' do + let :params do + { + snitch_properties_file: 'cassandra-topology.properties', + dc: 'NYC', + rack: 'R101', + dc_suffix: '_1_cassandra', + prefer_local: 'true' } - } - } - end - - let :params do - { - service_ensure: 'stopped', - service_enable: 'false' - } - end - - it do - expect(subject).to contain_service('cassandra'). - with(ensure: 'stopped', - name: 'cassandra', - enable: 'false') - end - end - - context 'Test the dc and rack properties with defaults (Debian).' do - let :facts do - { - operatingsystemmajrelease: '8', - osfamily: 'Debian', - os: { - 'family' => 'Debian', - 'release' => { - 'full' => '8.11', - 'major' => '8', - 'minor' => '11' - } - } - } - end - - it do - expect(subject).to contain_file('/etc/cassandra/cassandra-rackdc.properties'). - with_content(%r{^dc=DC1}). - with_content(%r{^rack=RAC1$}). - with_content(%r{^#dc_suffix=$}). - with_content(%r{^# prefer_local=true$}) - end - end - - context 'Test the dc and rack properties with defaults (RedHat).' do - let :facts do - { - operatingsystemmajrelease: '7', - osfamily: 'RedHat', - os: { - 'family' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } - } - } - end - - it do - expect(subject).to contain_file('/etc/cassandra/default.conf/cassandra-rackdc.properties'). - with_content(%r{^dc=DC1}). - with_content(%r{^rack=RAC1$}). - with_content(%r{^#dc_suffix=$}). - with_content(%r{^# prefer_local=true$}) - end - end - - context 'Test the dc and rack properties.' do - let :facts do - { - operatingsystemmajrelease: '7', - osfamily: 'RedHat', - os: { - 'family' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } - } - } - end - - let :params do - { - snitch_properties_file: 'cassandra-topology.properties', - dc: 'NYC', - rack: 'R101', - dc_suffix: '_1_cassandra', - prefer_local: 'true' - } - end - - it do - expect(subject).to contain_file('/etc/cassandra/default.conf/cassandra-topology.properties'). - with_content(%r{^dc=NYC$}). - with_content(%r{^rack=R101$}). - with_content(%r{^dc_suffix=_1_cassandra$}). - with_content(%r{^prefer_local=true$}) + end + + it do + expect(subject).to contain_file('/etc/cassandra/default.conf/cassandra-topology.properties'). + with_content(%r{^dc=NYC$}). + with_content(%r{^rack=R101$}). + with_content(%r{^dc_suffix=_1_cassandra$}). + with_content(%r{^prefer_local=true$}) + end + end end end end diff --git a/spec/defines/schema/permission_spec.rb b/spec/defines/schema/permission_spec.rb index b0c583f0..65a0bdd6 100644 --- a/spec/defines/schema/permission_spec.rb +++ b/spec/defines/schema/permission_spec.rb @@ -3,509 +3,338 @@ require 'spec_helper' describe 'cassandra::schema::permission' do - context 'with user_name' do - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } - } - } - end - - let(:title) { 'foobar' } - let(:params) do - { - user_name: 'foobar' - } - end - - it { is_expected.to raise_error(Puppet::Error) } + let :node do + 'foo.example.com' end + on_supported_os.each do |os, facts| - context 'Set ensure to latest' do let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } - } - } - end - - let(:title) { 'foobar' } - let(:params) do - { - ensure: 'latest' - } + facts end + context 'with user_name' do - it { is_expected.to raise_error(Puppet::Error) } - end - - context 'spillman:SELECT:ALL' do - let(:title) { 'spillman:SELECT:ALL' } - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } + let(:title) { 'foobar' } + let(:params) do + { + user_name: 'foobar' } - } - end + end - let(:params) do - { - user_name: 'spillman', - permission_name: 'SELECT', - use_scl: false, - scl_name: 'nodefault' - } + it { is_expected.to raise_error(Puppet::Error) } end - it do - expect(subject).to have_resource_count(9) - expect(subject).to contain_cassandra__schema__permission('spillman:SELECT:ALL') - read_script = '/usr/bin/cqlsh -e "LIST ALL PERMISSIONS ON ALL KEYSPACES" ' - read_script += 'localhost 9042 | grep \' spillman | *spillman | .* SELECT$\'' - script_command = 'GRANT SELECT ON ALL KEYSPACES TO spillman' - exec_command = "/usr/bin/cqlsh -e \"#{script_command}\" localhost 9042" - expect(subject).to contain_exec(script_command). - only_with(command: exec_command, - unless: read_script, - require: 'Exec[::cassandra::schema connection test]') - end - end + context 'Set ensure to latest' do - context 'spillman:SELECT:ALL with SCL' do - let(:title) { 'spillman:SELECT:ALL' } - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } + let(:title) { 'foobar' } + let(:params) do + { + ensure: 'latest' } - } - end + end - let(:params) do - { - user_name: 'spillman', - permission_name: 'SELECT', - use_scl: true, - scl_name: 'testscl' - } + it { is_expected.to raise_error(Puppet::Error) } end - it do - expect(subject).to have_resource_count(9) - expect(subject).to contain_cassandra__schema__permission('spillman:SELECT:ALL') - read_script = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ALL PERMISSIONS ON ALL KEYSPACES\" ' - read_script += 'localhost 9042 | grep \' spillman | *spillman | .* SELECT$\'"' - script_command = 'GRANT SELECT ON ALL KEYSPACES TO spillman' - exec_command = "/usr/bin/scl enable testscl \"/usr/bin/cqlsh -e \\\"#{script_command}\\\" localhost 9042\"" - expect(subject).to contain_exec(script_command). - only_with(command: exec_command, - unless: read_script, - require: 'Exec[::cassandra::schema connection test]') - end - end + context 'spillman:SELECT:ALL' do + let(:title) { 'spillman:SELECT:ALL' } - context 'akers:modify:field' do - let(:title) { 'akers:modify:field' } - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } + let(:params) do + { + user_name: 'spillman', + permission_name: 'SELECT', + use_scl: false, + scl_name: 'nodefault' } - } - end + end - let(:params) do - { - user_name: 'akers', - keyspace_name: 'field', - permission_name: 'MODIFY', - use_scl: false, - scl_name: 'nodefault' - } + it do + expect(subject).to have_resource_count(9) + expect(subject).to contain_cassandra__schema__permission('spillman:SELECT:ALL') + read_script = '/usr/bin/cqlsh -e "LIST ALL PERMISSIONS ON ALL KEYSPACES" ' + read_script += 'localhost 9042 | grep \' spillman | *spillman | .* SELECT$\'' + script_command = 'GRANT SELECT ON ALL KEYSPACES TO spillman' + exec_command = "/usr/bin/cqlsh -e \"#{script_command}\" localhost 9042" + expect(subject).to contain_exec(script_command). + only_with(command: exec_command, + unless: read_script, + require: 'Exec[::cassandra::schema connection test]') + end end - it do - expect(subject).to have_resource_count(9) - expect(subject).to contain_cassandra__schema__permission('akers:modify:field') - read_script = '/usr/bin/cqlsh -e "LIST ALL PERMISSIONS ON KEYSPACE field" ' - read_script += 'localhost 9042 | grep \' akers | *akers | .* MODIFY$\'' - script_command = 'GRANT MODIFY ON KEYSPACE field TO akers' - exec_command = "/usr/bin/cqlsh -e \"#{script_command}\" localhost 9042" - expect(subject).to contain_exec(script_command). - only_with(command: exec_command, - unless: read_script, - require: 'Exec[::cassandra::schema connection test]') - end - end + context 'spillman:SELECT:ALL with SCL' do + let(:title) { 'spillman:SELECT:ALL' } - context 'akers:modify:field with SCL' do - let(:title) { 'akers:modify:field' } - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } + let(:params) do + { + user_name: 'spillman', + permission_name: 'SELECT', + use_scl: true, + scl_name: 'testscl' } - } - end + end - let(:params) do - { - user_name: 'akers', - keyspace_name: 'field', - permission_name: 'MODIFY', - use_scl: true, - scl_name: 'testscl' - } + it do + expect(subject).to have_resource_count(9) + expect(subject).to contain_cassandra__schema__permission('spillman:SELECT:ALL') + read_script = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ALL PERMISSIONS ON ALL KEYSPACES\" ' + read_script += 'localhost 9042 | grep \' spillman | *spillman | .* SELECT$\'"' + script_command = 'GRANT SELECT ON ALL KEYSPACES TO spillman' + exec_command = "/usr/bin/scl enable testscl \"/usr/bin/cqlsh -e \\\"#{script_command}\\\" localhost 9042\"" + expect(subject).to contain_exec(script_command). + only_with(command: exec_command, + unless: read_script, + require: 'Exec[::cassandra::schema connection test]') + end end - it do - expect(subject).to have_resource_count(9) - expect(subject).to contain_cassandra__schema__permission('akers:modify:field') - read_script = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ALL PERMISSIONS ON KEYSPACE field\" ' - read_script += 'localhost 9042 | grep \' akers | *akers | .* MODIFY$\'"' - script_command = 'GRANT MODIFY ON KEYSPACE field TO akers' - exec_command = "/usr/bin/scl enable testscl \"/usr/bin/cqlsh -e \\\"#{script_command}\\\" localhost 9042\"" - expect(subject).to contain_exec(script_command). - only_with(command: exec_command, - unless: read_script, - require: 'Exec[::cassandra::schema connection test]') - end - end + context 'akers:modify:field' do + let(:title) { 'akers:modify:field' } - context 'boone:alter:forty9ers' do - let(:title) { 'boone:alter:forty9ers' } - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } + let(:params) do + { + user_name: 'akers', + keyspace_name: 'field', + permission_name: 'MODIFY', + use_scl: false, + scl_name: 'nodefault' } - } - end + end - let(:params) do - { - user_name: 'boone', - keyspace_name: 'forty9ers', - permission_name: 'ALTER', - use_scl: false, - scl_name: 'nodefault' - } + it do + expect(subject).to have_resource_count(9) + expect(subject).to contain_cassandra__schema__permission('akers:modify:field') + read_script = '/usr/bin/cqlsh -e "LIST ALL PERMISSIONS ON KEYSPACE field" ' + read_script += 'localhost 9042 | grep \' akers | *akers | .* MODIFY$\'' + script_command = 'GRANT MODIFY ON KEYSPACE field TO akers' + exec_command = "/usr/bin/cqlsh -e \"#{script_command}\" localhost 9042" + expect(subject).to contain_exec(script_command). + only_with(command: exec_command, + unless: read_script, + require: 'Exec[::cassandra::schema connection test]') + end end - it do - expect(subject).to have_resource_count(9) - expect(subject).to contain_cassandra__schema__permission('boone:alter:forty9ers') - read_script = '/usr/bin/cqlsh -e "LIST ALL PERMISSIONS ON KEYSPACE forty9ers" ' - read_script += 'localhost 9042 | grep \' boone | *boone | .* ALTER$\'' - script_command = 'GRANT ALTER ON KEYSPACE forty9ers TO boone' - exec_command = "/usr/bin/cqlsh -e \"#{script_command}\" localhost 9042" - expect(subject).to contain_exec(script_command). - only_with(command: exec_command, - unless: read_script, - require: 'Exec[::cassandra::schema connection test]') - end - end + context 'akers:modify:field with SCL' do + let(:title) { 'akers:modify:field' } - context 'boone:alter:forty9ers with SCL' do - let(:title) { 'boone:alter:forty9ers' } - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } + let(:params) do + { + user_name: 'akers', + keyspace_name: 'field', + permission_name: 'MODIFY', + use_scl: true, + scl_name: 'testscl' } - } - end + end - let(:params) do - { - user_name: 'boone', - keyspace_name: 'forty9ers', - permission_name: 'ALTER', - use_scl: true, - scl_name: 'testscl' - } + it do + expect(subject).to have_resource_count(9) + expect(subject).to contain_cassandra__schema__permission('akers:modify:field') + read_script = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ALL PERMISSIONS ON KEYSPACE field\" ' + read_script += 'localhost 9042 | grep \' akers | *akers | .* MODIFY$\'"' + script_command = 'GRANT MODIFY ON KEYSPACE field TO akers' + exec_command = "/usr/bin/scl enable testscl \"/usr/bin/cqlsh -e \\\"#{script_command}\\\" localhost 9042\"" + expect(subject).to contain_exec(script_command). + only_with(command: exec_command, + unless: read_script, + require: 'Exec[::cassandra::schema connection test]') + end end - it do - expect(subject).to have_resource_count(9) - expect(subject).to contain_cassandra__schema__permission('boone:alter:forty9ers') - read_script = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ALL PERMISSIONS ON KEYSPACE forty9ers\" ' - read_script += 'localhost 9042 | grep \' boone | *boone | .* ALTER$\'"' - script_command = 'GRANT ALTER ON KEYSPACE forty9ers TO boone' - exec_command = "/usr/bin/scl enable testscl \"/usr/bin/cqlsh -e \\\"#{script_command}\\\" localhost 9042\"" - expect(subject).to contain_exec(script_command). - only_with(command: exec_command, - unless: read_script, - require: 'Exec[::cassandra::schema connection test]') - end - end + context 'boone:alter:forty9ers' do + let(:title) { 'boone:alter:forty9ers' } - context 'boone:ALL:ravens.plays' do - let(:title) { 'boone:ALL:ravens.plays' } - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } + let(:params) do + { + user_name: 'boone', + keyspace_name: 'forty9ers', + permission_name: 'ALTER', + use_scl: false, + scl_name: 'nodefault' } - } - end + end - let(:params) do - { - user_name: 'boone', - keyspace_name: 'ravens', - table_name: 'plays', - use_scl: false, - scl_name: 'nodefault' - } + it do + expect(subject).to have_resource_count(9) + expect(subject).to contain_cassandra__schema__permission('boone:alter:forty9ers') + read_script = '/usr/bin/cqlsh -e "LIST ALL PERMISSIONS ON KEYSPACE forty9ers" ' + read_script += 'localhost 9042 | grep \' boone | *boone | .* ALTER$\'' + script_command = 'GRANT ALTER ON KEYSPACE forty9ers TO boone' + exec_command = "/usr/bin/cqlsh -e \"#{script_command}\" localhost 9042" + expect(subject).to contain_exec(script_command). + only_with(command: exec_command, + unless: read_script, + require: 'Exec[::cassandra::schema connection test]') + end end - it do - expect(subject).to have_resource_count(18) - expect(subject).to contain_cassandra__schema__permission('boone:ALL:ravens.plays') - end + context 'boone:alter:forty9ers with SCL' do + let(:title) { 'boone:alter:forty9ers' } - expected_values = %w[ALTER AUTHORIZE DROP MODIFY SELECT] - expected_values.each do |val| - it do - expect(subject).to contain_cassandra__schema__permission("boone:ALL:ravens.plays - #{val}").with( - ensure: 'present', + let(:params) do + { user_name: 'boone', - keyspace_name: 'ravens', - permission_name: val, - table_name: 'plays' - ) + keyspace_name: 'forty9ers', + permission_name: 'ALTER', + use_scl: true, + scl_name: 'testscl' + } end - read_script = '/usr/bin/cqlsh -e "LIST ALL PERMISSIONS ON TABLE ravens.plays" ' - read_script += "localhost 9042 | grep ' boone | *boone | .* #{val}$'" - script_command = "GRANT #{val} ON TABLE ravens.plays TO boone" - exec_command = "/usr/bin/cqlsh -e \"#{script_command}\" localhost 9042" it do + expect(subject).to have_resource_count(9) + expect(subject).to contain_cassandra__schema__permission('boone:alter:forty9ers') + read_script = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ALL PERMISSIONS ON KEYSPACE forty9ers\" ' + read_script += 'localhost 9042 | grep \' boone | *boone | .* ALTER$\'"' + script_command = 'GRANT ALTER ON KEYSPACE forty9ers TO boone' + exec_command = "/usr/bin/scl enable testscl \"/usr/bin/cqlsh -e \\\"#{script_command}\\\" localhost 9042\"" expect(subject).to contain_exec(script_command). only_with(command: exec_command, unless: read_script, require: 'Exec[::cassandra::schema connection test]') end end - end - context 'boone:ALL:ravens.plays with SCL' do - let(:title) { 'boone:ALL:ravens.plays' } - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } + context 'boone:ALL:ravens.plays' do + let(:title) { 'boone:ALL:ravens.plays' } + + let(:params) do + { + user_name: 'boone', + keyspace_name: 'ravens', + table_name: 'plays', + use_scl: false, + scl_name: 'nodefault' } - } - end + end - let(:params) do - { - user_name: 'boone', - keyspace_name: 'ravens', - table_name: 'plays', - use_scl: true, - scl_name: 'testscl' - } - end + it do + expect(subject).to have_resource_count(18) + expect(subject).to contain_cassandra__schema__permission('boone:ALL:ravens.plays') + end - it do - expect(subject).to have_resource_count(18) - expect(subject).to contain_cassandra__schema__permission('boone:ALL:ravens.plays') + expected_values = %w[ALTER AUTHORIZE DROP MODIFY SELECT] + expected_values.each do |val| + it do + expect(subject).to contain_cassandra__schema__permission("boone:ALL:ravens.plays - #{val}").with( + ensure: 'present', + user_name: 'boone', + keyspace_name: 'ravens', + permission_name: val, + table_name: 'plays' + ) + end + + read_script = '/usr/bin/cqlsh -e "LIST ALL PERMISSIONS ON TABLE ravens.plays" ' + read_script += "localhost 9042 | grep ' boone | *boone | .* #{val}$'" + script_command = "GRANT #{val} ON TABLE ravens.plays TO boone" + exec_command = "/usr/bin/cqlsh -e \"#{script_command}\" localhost 9042" + it do + expect(subject).to contain_exec(script_command). + only_with(command: exec_command, + unless: read_script, + require: 'Exec[::cassandra::schema connection test]') + end + end end - expected_values = %w[ALTER AUTHORIZE DROP MODIFY SELECT] - expected_values.each do |val| - it do - expect(subject).to contain_cassandra__schema__permission("boone:ALL:ravens.plays - #{val}").with( - ensure: 'present', + context 'boone:ALL:ravens.plays with SCL' do + let(:title) { 'boone:ALL:ravens.plays' } + + let(:params) do + { user_name: 'boone', keyspace_name: 'ravens', - permission_name: val, - table_name: 'plays' - ) + table_name: 'plays', + use_scl: true, + scl_name: 'testscl' + } end - read_script = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ALL PERMISSIONS ON TABLE ravens.plays\" ' - read_script += "localhost 9042 | grep ' boone | *boone | .* #{val}$'\"" - script_command = "GRANT #{val} ON TABLE ravens.plays TO boone" - exec_command = "/usr/bin/scl enable testscl \"/usr/bin/cqlsh -e \\\"#{script_command}\\\" localhost 9042\"" it do - expect(subject).to contain_exec(script_command). - only_with(command: exec_command, - unless: read_script, - require: 'Exec[::cassandra::schema connection test]') + expect(subject).to have_resource_count(18) + expect(subject).to contain_cassandra__schema__permission('boone:ALL:ravens.plays') + end + + expected_values = %w[ALTER AUTHORIZE DROP MODIFY SELECT] + expected_values.each do |val| + it do + expect(subject).to contain_cassandra__schema__permission("boone:ALL:ravens.plays - #{val}").with( + ensure: 'present', + user_name: 'boone', + keyspace_name: 'ravens', + permission_name: val, + table_name: 'plays' + ) + end + + read_script = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ALL PERMISSIONS ON TABLE ravens.plays\" ' + read_script += "localhost 9042 | grep ' boone | *boone | .* #{val}$'\"" + script_command = "GRANT #{val} ON TABLE ravens.plays TO boone" + exec_command = "/usr/bin/scl enable testscl \"/usr/bin/cqlsh -e \\\"#{script_command}\\\" localhost 9042\"" + it do + expect(subject).to contain_exec(script_command). + only_with(command: exec_command, + unless: read_script, + require: 'Exec[::cassandra::schema connection test]') + end end end - end - context 'REVOKE boone:SELECT:ravens.plays' do - let(:title) { 'REVOKE boone:SELECT:ravens.plays' } - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } + context 'REVOKE boone:SELECT:ravens.plays' do + let(:title) { 'REVOKE boone:SELECT:ravens.plays' } + + let(:params) do + { + ensure: 'absent', + user_name: 'boone', + keyspace_name: 'forty9ers', + permission_name: 'SELECT', + use_scl: false, + scl_name: 'nodefault' } - } - end + end - let(:params) do - { - ensure: 'absent', - user_name: 'boone', - keyspace_name: 'forty9ers', - permission_name: 'SELECT', - use_scl: false, - scl_name: 'nodefault' - } + it do + expect(subject).to have_resource_count(9) + expect(subject).to contain_cassandra__schema__permission('REVOKE boone:SELECT:ravens.plays') + read_script = '/usr/bin/cqlsh -e "LIST ALL PERMISSIONS ON KEYSPACE forty9ers" ' + read_script += "localhost 9042 | grep ' boone | *boone | .* SELECT$'" + script_command = 'REVOKE SELECT ON KEYSPACE forty9ers FROM boone' + exec_command = "/usr/bin/cqlsh -e \"#{script_command}\" localhost 9042" + expect(subject).to contain_exec(script_command). + only_with(command: exec_command, + onlyif: read_script, + require: 'Exec[::cassandra::schema connection test]') + end end - it do - expect(subject).to have_resource_count(9) - expect(subject).to contain_cassandra__schema__permission('REVOKE boone:SELECT:ravens.plays') - read_script = '/usr/bin/cqlsh -e "LIST ALL PERMISSIONS ON KEYSPACE forty9ers" ' - read_script += "localhost 9042 | grep ' boone | *boone | .* SELECT$'" - script_command = 'REVOKE SELECT ON KEYSPACE forty9ers FROM boone' - exec_command = "/usr/bin/cqlsh -e \"#{script_command}\" localhost 9042" - expect(subject).to contain_exec(script_command). - only_with(command: exec_command, - onlyif: read_script, - require: 'Exec[::cassandra::schema connection test]') - end - end + context 'REVOKE boone:SELECT:ravens.plays with SCL' do + let(:title) { 'REVOKE boone:SELECT:ravens.plays' } - context 'REVOKE boone:SELECT:ravens.plays with SCL' do - let(:title) { 'REVOKE boone:SELECT:ravens.plays' } - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } + let(:params) do + { + ensure: 'absent', + user_name: 'boone', + keyspace_name: 'forty9ers', + permission_name: 'SELECT', + use_scl: true, + scl_name: 'testscl' } - } - end - - let(:params) do - { - ensure: 'absent', - user_name: 'boone', - keyspace_name: 'forty9ers', - permission_name: 'SELECT', - use_scl: true, - scl_name: 'testscl' - } - end + end - it do - expect(subject).to have_resource_count(9) - expect(subject).to contain_cassandra__schema__permission('REVOKE boone:SELECT:ravens.plays') - read_script = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ALL PERMISSIONS ON KEYSPACE forty9ers\" ' - read_script += "localhost 9042 | grep ' boone | *boone | .* SELECT$'\"" - script_command = 'REVOKE SELECT ON KEYSPACE forty9ers FROM boone' - exec_command = "/usr/bin/scl enable testscl \"/usr/bin/cqlsh -e \\\"#{script_command}\\\" localhost 9042\"" - expect(subject).to contain_exec(script_command). - only_with(command: exec_command, - onlyif: read_script, - require: 'Exec[::cassandra::schema connection test]') + it do + expect(subject).to have_resource_count(9) + expect(subject).to contain_cassandra__schema__permission('REVOKE boone:SELECT:ravens.plays') + read_script = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ALL PERMISSIONS ON KEYSPACE forty9ers\" ' + read_script += "localhost 9042 | grep ' boone | *boone | .* SELECT$'\"" + script_command = 'REVOKE SELECT ON KEYSPACE forty9ers FROM boone' + exec_command = "/usr/bin/scl enable testscl \"/usr/bin/cqlsh -e \\\"#{script_command}\\\" localhost 9042\"" + expect(subject).to contain_exec(script_command). + only_with(command: exec_command, + onlyif: read_script, + require: 'Exec[::cassandra::schema connection test]') + end end end end diff --git a/spec/defines/schema/user_spec.rb b/spec/defines/schema/user_spec.rb index ecf95633..e5e4da34 100644 --- a/spec/defines/schema/user_spec.rb +++ b/spec/defines/schema/user_spec.rb @@ -3,594 +3,364 @@ require 'spec_helper' describe 'cassandra::schema::user' do - context 'Create a supper user on cassandrarelease undef' do - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - cassandrarelease: nil, - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } - } - } - end - - let(:title) { 'akers' } - - let(:params) do - { - use_scl: false, - scl_name: 'nodefault', - password: 'Niner2', - superuser: true - } - end - - it do - expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') - read_command = '/usr/bin/cqlsh -e "LIST USERS" localhost 9042 | grep \'\s*akers |\'' - exec_command = '/usr/bin/cqlsh -e "CREATE USER IF NOT EXISTS akers' - exec_command += ' WITH PASSWORD \'Niner2\' SUPERUSER" localhost 9042' - expect(subject).to contain_exec('Create user (akers)'). - only_with(command: exec_command, - unless: read_command, - require: 'Exec[::cassandra::schema connection test]') - end + let :node do + 'foo.example.com' end + on_supported_os.each do |os, facts| - context 'Create a supper user on cassandrarelease undef with SCL' do let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - cassandrarelease: nil, - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } - } - } + facts end + context 'Create a supper user on cassandrarelease undef' do - let(:title) { 'akers' } - - let(:params) do - { - use_scl: true, - scl_name: 'testscl', - password: 'Niner2', - superuser: true - } - end - - it do - expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') - read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST USERS\" localhost 9042 | grep \'\s*akers |\'"' - exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE USER IF NOT EXISTS akers' - exec_command += ' WITH PASSWORD \'Niner2\' SUPERUSER\" localhost 9042"' - expect(subject).to contain_exec('Create user (akers)'). - only_with(command: exec_command, - unless: read_command, - require: 'Exec[::cassandra::schema connection test]') - end - end + let(:title) { 'akers' } - context 'Create a supper user in cassandrarelease < 2.2' do - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - cassandrarelease: '2.0.1', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } + let(:params) do + { + use_scl: false, + scl_name: 'nodefault', + password: 'Niner2', + superuser: true } - } - end - - let(:title) { 'akers' } - - let(:params) do - { - use_scl: false, - scl_name: 'nodefault', - password: 'Niner2', - superuser: true - } - end - - it do - expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') - read_command = '/usr/bin/cqlsh -e "LIST USERS" localhost 9042 | grep \'\s*akers |\'' - exec_command = '/usr/bin/cqlsh -e "CREATE USER IF NOT EXISTS akers' - exec_command += ' WITH PASSWORD \'Niner2\' SUPERUSER" localhost 9042' - expect(subject).to contain_exec('Create user (akers)'). - only_with(command: exec_command, - unless: read_command, - require: 'Exec[::cassandra::schema connection test]') - end - end - - context 'Create a supper user in cassandrarelease < 2.2 with SCL' do - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - cassandrarelease: '2.0.1', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } + end + + it do + expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') + read_command = '/usr/bin/cqlsh -e "LIST USERS" localhost 9042 | grep \'\s*akers |\'' + exec_command = '/usr/bin/cqlsh -e "CREATE USER IF NOT EXISTS akers' + exec_command += ' WITH PASSWORD \'Niner2\' SUPERUSER" localhost 9042' + expect(subject).to contain_exec('Create user (akers)'). + only_with(command: exec_command, + unless: read_command, + require: 'Exec[::cassandra::schema connection test]') + end + end + + context 'Create a supper user on cassandrarelease undef with SCL' do + + let(:title) { 'akers' } + + let(:params) do + { + use_scl: true, + scl_name: 'testscl', + password: 'Niner2', + superuser: true } - } - end - - let(:title) { 'akers' } - - let(:params) do - { - use_scl: true, - scl_name: 'testscl', - password: 'Niner2', - superuser: true - } - end - - it do - expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') - read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST USERS\" localhost 9042 | grep \'\s*akers |\'"' - exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE USER IF NOT EXISTS akers' - exec_command += ' WITH PASSWORD \'Niner2\' SUPERUSER\" localhost 9042"' - expect(subject).to contain_exec('Create user (akers)'). - only_with(command: exec_command, - unless: read_command, - require: 'Exec[::cassandra::schema connection test]') - end - end - - context 'Create a user in cassandrarelease < 2.2' do - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - cassandrarelease: '2.0.1', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } + end + + it do + expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') + read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST USERS\" localhost 9042 | grep \'\s*akers |\'"' + exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE USER IF NOT EXISTS akers' + exec_command += ' WITH PASSWORD \'Niner2\' SUPERUSER\" localhost 9042"' + expect(subject).to contain_exec('Create user (akers)'). + only_with(command: exec_command, + unless: read_command, + require: 'Exec[::cassandra::schema connection test]') + end + end + + context 'Create a supper user in cassandrarelease < 2.2' do + + let(:title) { 'akers' } + + let(:params) do + { + use_scl: false, + scl_name: 'nodefault', + password: 'Niner2', + superuser: true } - } - end - - let(:title) { 'akers' } - - let(:params) do - { - use_scl: false, - scl_name: 'nodefault', - password: 'Niner2' - } - end - - it do - expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') - read_command = '/usr/bin/cqlsh -e "LIST USERS" localhost 9042 | grep \'\s*akers |\'' - exec_command = '/usr/bin/cqlsh -e "CREATE USER IF NOT EXISTS akers' - exec_command += ' WITH PASSWORD \'Niner2\' NOSUPERUSER" localhost 9042' - expect(subject).to contain_exec('Create user (akers)'). - only_with(command: exec_command, - unless: read_command, - require: 'Exec[::cassandra::schema connection test]') - end - end - - context 'Create a user in cassandrarelease < 2.2 with SCL' do - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - cassandrarelease: '2.0.1', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } + end + + it do + expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') + read_command = '/usr/bin/cqlsh -e "LIST USERS" localhost 9042 | grep \'\s*akers |\'' + exec_command = '/usr/bin/cqlsh -e "CREATE USER IF NOT EXISTS akers' + exec_command += ' WITH PASSWORD \'Niner2\' SUPERUSER" localhost 9042' + expect(subject).to contain_exec('Create user (akers)'). + only_with(command: exec_command, + unless: read_command, + require: 'Exec[::cassandra::schema connection test]') + end + end + + context 'Create a supper user in cassandrarelease < 2.2 with SCL' do + + let(:title) { 'akers' } + + let(:params) do + { + use_scl: true, + scl_name: 'testscl', + password: 'Niner2', + superuser: true } - } - end + end - let(:title) { 'akers' } - - let(:params) do - { - use_scl: true, - scl_name: 'testscl', - password: 'Niner2' - } + it do + expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') + read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST USERS\" localhost 9042 | grep \'\s*akers |\'"' + exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE USER IF NOT EXISTS akers' + exec_command += ' WITH PASSWORD \'Niner2\' SUPERUSER\" localhost 9042"' + expect(subject).to contain_exec('Create user (akers)'). + only_with(command: exec_command, + unless: read_command, + require: 'Exec[::cassandra::schema connection test]') + end end - it do - expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') - read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST USERS\" localhost 9042 | grep \'\s*akers |\'"' - exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE USER IF NOT EXISTS akers' - exec_command += ' WITH PASSWORD \'Niner2\' NOSUPERUSER\" localhost 9042"' - expect(subject).to contain_exec('Create user (akers)'). - only_with(command: exec_command, - unless: read_command, - require: 'Exec[::cassandra::schema connection test]') - end - end + context 'Create a user in cassandrarelease < 2.2' do - context 'Create a supper user with login in cassandrarelease > 2.2' do - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - cassandrarelease: '3.0.9', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } - } - } - end - - let(:title) { 'akers' } - - let(:params) do - { - use_scl: false, - scl_name: 'nodefault', - password: 'Niner2', - superuser: true - } - end - - it do - expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') - read_command = '/usr/bin/cqlsh -e "LIST ROLES" localhost 9042 | grep \'\s*akers |\'' - exec_command = '/usr/bin/cqlsh -e "CREATE ROLE IF NOT EXISTS akers' - exec_command += ' WITH PASSWORD = \'Niner2\' AND SUPERUSER = true AND LOGIN = true" localhost 9042' - expect(subject).to contain_exec('Create user (akers)'). - only_with(command: exec_command, - unless: read_command, - require: 'Exec[::cassandra::schema connection test]') - end - end + let(:title) { 'akers' } - context 'Create a supper user with login in cassandrarelease > 2.2 with SCL' do - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - cassandrarelease: '3.0.9', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } + let(:params) do + { + use_scl: false, + scl_name: 'nodefault', + password: 'Niner2' } - } - end - - let(:title) { 'akers' } - - let(:params) do - { - use_scl: true, - scl_name: 'testscl', - password: 'Niner2', - superuser: true - } - end - - it do - expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') - read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ROLES\" localhost 9042 | grep \'\s*akers |\'"' - exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE ROLE IF NOT EXISTS akers' - exec_command += ' WITH PASSWORD = \'Niner2\' AND SUPERUSER = true AND LOGIN = true\" localhost 9042"' - expect(subject).to contain_exec('Create user (akers)'). - only_with(command: exec_command, - unless: read_command, - require: 'Exec[::cassandra::schema connection test]') - end - end + end - context 'Create a user without login in cassandrarelease > 2.2' do - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - cassandrarelease: '3.0.9', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } - } - } + it do + expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') + read_command = '/usr/bin/cqlsh -e "LIST USERS" localhost 9042 | grep \'\s*akers |\'' + exec_command = '/usr/bin/cqlsh -e "CREATE USER IF NOT EXISTS akers' + exec_command += ' WITH PASSWORD \'Niner2\' NOSUPERUSER" localhost 9042' + expect(subject).to contain_exec('Create user (akers)'). + only_with(command: exec_command, + unless: read_command, + require: 'Exec[::cassandra::schema connection test]') + end end - let(:title) { 'bob' } + context 'Create a user in cassandrarelease < 2.2 with SCL' do - let(:params) do - { - use_scl: false, - scl_name: 'nodefault', - password: 'kaZe89a', - login: false - } - end + let(:title) { 'akers' } - it do - expect(subject).to contain_cassandra__schema__user('bob').with_ensure('present') - read_command = '/usr/bin/cqlsh -e "LIST ROLES" localhost 9042 | grep \'\s*bob |\'' - exec_command = '/usr/bin/cqlsh -e "CREATE ROLE IF NOT EXISTS bob' - exec_command += ' WITH PASSWORD = \'kaZe89a\'" localhost 9042' - expect(subject).to contain_exec('Create user (bob)'). - only_with(command: exec_command, - unless: read_command, - require: 'Exec[::cassandra::schema connection test]') - end - end - - context 'Create a user without login in cassandrarelease > 2.2 with SCL' do - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - cassandrarelease: '3.0.9', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } + let(:params) do + { + use_scl: true, + scl_name: 'testscl', + password: 'Niner2' } - } - end - - let(:title) { 'bob' } - - let(:params) do - { - use_scl: true, - scl_name: 'testscl', - password: 'kaZe89a', - login: false - } - end - - it do - expect(subject).to contain_cassandra__schema__user('bob').with_ensure('present') - read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ROLES\" localhost 9042 | grep \'\s*bob |\'"' - exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE ROLE IF NOT EXISTS bob' - exec_command += ' WITH PASSWORD = \'kaZe89a\'\" localhost 9042"' - expect(subject).to contain_exec('Create user (bob)'). - only_with(command: exec_command, - unless: read_command, - require: 'Exec[::cassandra::schema connection test]') - end - end - - context 'Drop a user in cassandrarelease > 2.2' do - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - cassandrarelease: '3.0.9', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } + end + + it do + expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') + read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST USERS\" localhost 9042 | grep \'\s*akers |\'"' + exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE USER IF NOT EXISTS akers' + exec_command += ' WITH PASSWORD \'Niner2\' NOSUPERUSER\" localhost 9042"' + expect(subject).to contain_exec('Create user (akers)'). + only_with(command: exec_command, + unless: read_command, + require: 'Exec[::cassandra::schema connection test]') + end + end + + context 'Create a supper user with login in cassandrarelease > 2.2' do + + let(:title) { 'akers' } + + let(:params) do + { + use_scl: false, + scl_name: 'nodefault', + password: 'Niner2', + superuser: true } - } - end - - let(:title) { 'akers' } + end + + it do + expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') + read_command = '/usr/bin/cqlsh -e "LIST ROLES" localhost 9042 | grep \'\s*akers |\'' + exec_command = '/usr/bin/cqlsh -e "CREATE ROLE IF NOT EXISTS akers' + exec_command += ' WITH PASSWORD = \'Niner2\' AND SUPERUSER = true AND LOGIN = true" localhost 9042' + expect(subject).to contain_exec('Create user (akers)'). + only_with(command: exec_command, + unless: read_command, + require: 'Exec[::cassandra::schema connection test]') + end + end + + context 'Create a supper user with login in cassandrarelease > 2.2 with SCL' do + + let(:title) { 'akers' } + + let(:params) do + { + use_scl: true, + scl_name: 'testscl', + password: 'Niner2', + superuser: true + } + end + + it do + expect(subject).to contain_cassandra__schema__user('akers').with_ensure('present') + read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ROLES\" localhost 9042 | grep \'\s*akers |\'"' + exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE ROLE IF NOT EXISTS akers' + exec_command += ' WITH PASSWORD = \'Niner2\' AND SUPERUSER = true AND LOGIN = true\" localhost 9042"' + expect(subject).to contain_exec('Create user (akers)'). + only_with(command: exec_command, + unless: read_command, + require: 'Exec[::cassandra::schema connection test]') + end + end + + context 'Create a user without login in cassandrarelease > 2.2' do + + let(:title) { 'bob' } + + let(:params) do + { + use_scl: false, + scl_name: 'nodefault', + password: 'kaZe89a', + login: false + } + end + + it do + expect(subject).to contain_cassandra__schema__user('bob').with_ensure('present') + read_command = '/usr/bin/cqlsh -e "LIST ROLES" localhost 9042 | grep \'\s*bob |\'' + exec_command = '/usr/bin/cqlsh -e "CREATE ROLE IF NOT EXISTS bob' + exec_command += ' WITH PASSWORD = \'kaZe89a\'" localhost 9042' + expect(subject).to contain_exec('Create user (bob)'). + only_with(command: exec_command, + unless: read_command, + require: 'Exec[::cassandra::schema connection test]') + end + end + + context 'Create a user without login in cassandrarelease > 2.2 with SCL' do + + let(:title) { 'bob' } + + let(:params) do + { + use_scl: true, + scl_name: 'testscl', + password: 'kaZe89a', + login: false + } + end + + it do + expect(subject).to contain_cassandra__schema__user('bob').with_ensure('present') + read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ROLES\" localhost 9042 | grep \'\s*bob |\'"' + exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"CREATE ROLE IF NOT EXISTS bob' + exec_command += ' WITH PASSWORD = \'kaZe89a\'\" localhost 9042"' + expect(subject).to contain_exec('Create user (bob)'). + only_with(command: exec_command, + unless: read_command, + require: 'Exec[::cassandra::schema connection test]') + end + end + + context 'Drop a user in cassandrarelease > 2.2' do + + let(:title) { 'akers' } + + let(:params) do + { + use_scl: false, + scl_name: 'nodefault', + password: 'Niner2', + ensure: 'absent' + } + end - let(:params) do - { - use_scl: false, - scl_name: 'nodefault', - password: 'Niner2', - ensure: 'absent' - } + it do + read_command = '/usr/bin/cqlsh -e "LIST ROLES" localhost 9042 | grep \'\s*akers |\'' + exec_command = '/usr/bin/cqlsh -e "DROP ROLE akers" localhost 9042' + expect(subject).to contain_exec('Delete user (akers)'). + only_with(command: exec_command, + onlyif: read_command, + require: 'Exec[::cassandra::schema connection test]') + end end - it do - read_command = '/usr/bin/cqlsh -e "LIST ROLES" localhost 9042 | grep \'\s*akers |\'' - exec_command = '/usr/bin/cqlsh -e "DROP ROLE akers" localhost 9042' - expect(subject).to contain_exec('Delete user (akers)'). - only_with(command: exec_command, - onlyif: read_command, - require: 'Exec[::cassandra::schema connection test]') - end - end + context 'Drop a user in cassandrarelease > 2.2 with SCL' do - context 'Drop a user in cassandrarelease > 2.2 with SCL' do - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - cassandrarelease: '3.0.9', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } - } - } - end + let(:title) { 'akers' } - let(:title) { 'akers' } + let(:params) do + { + use_scl: true, + scl_name: 'testscl', + password: 'Niner2', + ensure: 'absent' + } + end - let(:params) do - { - use_scl: true, - scl_name: 'testscl', - password: 'Niner2', - ensure: 'absent' - } + it do + read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ROLES\" localhost 9042 | grep \'\s*akers |\'"' + exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DROP ROLE akers\" localhost 9042"' + expect(subject).to contain_exec('Delete user (akers)'). + only_with(command: exec_command, + onlyif: read_command, + require: 'Exec[::cassandra::schema connection test]') + end end - it do - read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST ROLES\" localhost 9042 | grep \'\s*akers |\'"' - exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DROP ROLE akers\" localhost 9042"' - expect(subject).to contain_exec('Delete user (akers)'). - only_with(command: exec_command, - onlyif: read_command, - require: 'Exec[::cassandra::schema connection test]') - end - end + context 'Drop a user in cassandrarelease < 2.2' do - context 'Drop a user in cassandrarelease < 2.2' do - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - cassandrarelease: '2.0.2', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } - } - } - end + let(:title) { 'akers' } - let(:title) { 'akers' } + let(:params) do + { + use_scl: false, + scl_name: 'nodefault', + password: 'Niner2', + ensure: 'absent' + } + end - let(:params) do - { - use_scl: false, - scl_name: 'nodefault', - password: 'Niner2', - ensure: 'absent' - } + it do + read_command = '/usr/bin/cqlsh -e "LIST USERS" localhost 9042 | grep \'\s*akers |\'' + exec_command = '/usr/bin/cqlsh -e "DROP USER akers" localhost 9042' + expect(subject).to contain_exec('Delete user (akers)'). + only_with(command: exec_command, + onlyif: read_command, + require: 'Exec[::cassandra::schema connection test]') + end end - it do - read_command = '/usr/bin/cqlsh -e "LIST USERS" localhost 9042 | grep \'\s*akers |\'' - exec_command = '/usr/bin/cqlsh -e "DROP USER akers" localhost 9042' - expect(subject).to contain_exec('Delete user (akers)'). - only_with(command: exec_command, - onlyif: read_command, - require: 'Exec[::cassandra::schema connection test]') - end - end + context 'Drop a user in cassandrarelease < 2.2 with SCL' do - context 'Drop a user in cassandrarelease < 2.2 with SCL' do - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - cassandrarelease: '2.0.2', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } - } - } - end + let(:title) { 'akers' } - let(:title) { 'akers' } + let(:params) do + { + use_scl: true, + scl_name: 'testscl', + password: 'Niner2', + ensure: 'absent' + } + end - let(:params) do - { - use_scl: true, - scl_name: 'testscl', - password: 'Niner2', - ensure: 'absent' - } + it do + read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST USERS\" localhost 9042 | grep \'\s*akers |\'"' + exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DROP USER akers\" localhost 9042"' + expect(subject).to contain_exec('Delete user (akers)'). + only_with(command: exec_command, + onlyif: read_command, + require: 'Exec[::cassandra::schema connection test]') + end end - it do - read_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"LIST USERS\" localhost 9042 | grep \'\s*akers |\'"' - exec_command = '/usr/bin/scl enable testscl "/usr/bin/cqlsh -e \"DROP USER akers\" localhost 9042"' - expect(subject).to contain_exec('Delete user (akers)'). - only_with(command: exec_command, - onlyif: read_command, - require: 'Exec[::cassandra::schema connection test]') - end - end + context 'Set ensure to latest' do - context 'Set ensure to latest' do - let :facts do - { - operatingsystemmajrelease: 7, - osfamily: 'RedHat', - os: { - 'family' => 'RedHat', - 'name' => 'RedHat', - 'release' => { - 'full' => '7.6.1810', - 'major' => '7', - 'minor' => '6' - } + let(:title) { 'foobar' } + let(:params) do + { + ensure: 'latest' } - } - end + end - let(:title) { 'foobar' } - let(:params) do - { - ensure: 'latest' - } + it { is_expected.to raise_error(Puppet::Error) } end - - it { is_expected.to raise_error(Puppet::Error) } end end From 8c3547014f3cc1456bc0285e62331f106cb812dd Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 16 Dec 2021 10:48:35 +0100 Subject: [PATCH 07/27] Ubuntu: Drop EoL 12.04/16.04 support --- manifests/params.pp | 5 ----- .../production/data/osfamily/Debian/12.04.yaml | 13 ------------- .../production/data/osfamily/Debian/16.04.yaml | 15 --------------- spec/spec_helper_acceptance.rb | 15 +-------------- 4 files changed, 1 insertion(+), 47 deletions(-) delete mode 100644 spec/acceptance/hieradata/environments/production/data/osfamily/Debian/12.04.yaml delete mode 100644 spec/acceptance/hieradata/environments/production/data/osfamily/Debian/16.04.yaml diff --git a/manifests/params.pp b/manifests/params.pp index 504af85b..ef4b28c7 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -4,11 +4,6 @@ case $facts['os']['family'] { 'Debian': { case $facts['os']['release']['major'] { - '12.04': { - $net_ipv4_tcp_rmem = '4096 87380 16777216' - $net_ipv4_tcp_wmem = '4096 65536 16777216' - $java_package = 'openjdk-7-jre-headless' - } '18.04': { $net_ipv4_tcp_rmem = '4096 87380 16777216' $net_ipv4_tcp_wmem = '4096 65536 16777216' diff --git a/spec/acceptance/hieradata/environments/production/data/osfamily/Debian/12.04.yaml b/spec/acceptance/hieradata/environments/production/data/osfamily/Debian/12.04.yaml deleted file mode 100644 index 70bf92f6..00000000 --- a/spec/acceptance/hieradata/environments/production/data/osfamily/Debian/12.04.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -cassandra::java::aptkey: - OpenJDK: - id: 'DA1A4A13543B466853BAF164EB9B1D8886F44E2A' - server: 'keyserver.ubuntu.com' - -cassandra::java::aptsource: - OpenJDK: - comment: 'OpenJDK builds (all archs)' - location: 'http://ppa.launchpad.net/openjdk-r/ppa/ubuntu' - release: 'precise' - -cassandra::java::package_name: 'openjdk-8-jdk' diff --git a/spec/acceptance/hieradata/environments/production/data/osfamily/Debian/16.04.yaml b/spec/acceptance/hieradata/environments/production/data/osfamily/Debian/16.04.yaml deleted file mode 100644 index 62ce0009..00000000 --- a/spec/acceptance/hieradata/environments/production/data/osfamily/Debian/16.04.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -cassandra::hints_directory_mode: '0770' - -cassandra::java::aptkey: - OpenJDK: - id: 'DA1A4A13543B466853BAF164EB9B1D8886F44E2A' - server: 'keyserver.ubuntu.com' - -cassandra::java::aptsource: - OpenJDK: - comment: 'OpenJDK builds (all archs)' - location: 'http://ppa.launchpad.net/openjdk-r/ppa/ubuntu' - release: 'xenial' - -cassandra::java::package_name: 'openjdk-8-jdk' diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 2ee3dd11..260c24ce 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -103,14 +103,6 @@ def bootstrap_pp ensure => absent, } } - 'ubuntu-12.04': { - package {['python-software-properties', 'iptables', 'sudo']:} -> - exec {'/usr/bin/apt-add-repository ppa:brightbox/ruby-ng':} -> - exec {'/usr/bin/apt-get update': } -> - package {'ruby2.0': } -> - exec { '/bin/rm /usr/bin/ruby': } -> - exec { '/usr/sbin/update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby2.0 1000': } - } 'ubuntu-16.04': { package { ['locales-all', 'net-tools', 'sudo', 'ufw']: } -> file { '/usr/sbin/policy-rc.d': @@ -484,12 +476,7 @@ class { 'cassandra::schema': end hosts.each do |host| - case host.name - when 'ubuntu1604' - host.install_package('puppet') - else - install_puppet_on(host) - end + install_puppet_on(host) end RSpec.configure do |c| From 50285eaf283d82cc487a303d0fe816faf4df5177 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 16 Dec 2021 10:51:50 +0100 Subject: [PATCH 08/27] Debian: Drop EoL 7 support --- .../production/data/osfamily/Debian/7.yaml | 17 ----------------- spec/spec_helper_acceptance.rb | 3 --- 2 files changed, 20 deletions(-) delete mode 100644 spec/acceptance/hieradata/environments/production/data/osfamily/Debian/7.yaml diff --git a/spec/acceptance/hieradata/environments/production/data/osfamily/Debian/7.yaml b/spec/acceptance/hieradata/environments/production/data/osfamily/Debian/7.yaml deleted file mode 100644 index 94149c6c..00000000 --- a/spec/acceptance/hieradata/environments/production/data/osfamily/Debian/7.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -cassandra::java::aptkey: - ZuluJDK: - id: '27BC0C8CB3D81623F59BDADCB1998361219BD9C9' - server: 'keyserver.ubuntu.com' - -cassandra::java::aptsource: - ZuluJDK: - location: 'http://repos.azulsystems.com/debian' - comment: 'Zulu OpenJDK 8 for Debian' - release: 'stable' - repos: 'main' - -cassandra::java::package_name: 'zulu-8' - -cassandra::system::swapoff::device: '/dev/mapper/localhost--vg-swap_1' -cassandra::system::swapoff::mount: 'none' diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 260c24ce..41fa3abe 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -94,9 +94,6 @@ def bootstrap_pp 'centos-7': { package { ['gcc', 'tar', 'initscripts']: } } - 'debian-7': { - package { ['sudo', 'ufw', 'wget']: } - } 'debian-8': { package { ['locales-all', 'net-tools', 'sudo', 'ufw']: } -> file { '/usr/sbin/policy-rc.d': From 0facc0c87dbd9821449e2bd2fe8492ff559646f9 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 16 Dec 2021 10:53:14 +0100 Subject: [PATCH 09/27] CentOS: Drop EoL 6 support --- manifests/params.pp | 17 +++-------------- spec/spec_helper_acceptance.rb | 15 --------------- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index ef4b28c7..62b83465 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -27,20 +27,9 @@ $scl_name = 'nodefault' } 'RedHat': { - case $facts['os']['release']['major'] { - '6': { - $net_ipv4_tcp_rmem = '4096 87380 16777216' - $net_ipv4_tcp_wmem = '4096 65536 16777216' - $sysctl_file = '/etc/sysctl.conf' - } - '7': { - $net_ipv4_tcp_rmem = '4096, 87380, 16777216' - $net_ipv4_tcp_wmem = '4096, 65536, 16777216' - $sysctl_file = '/etc/sysctl.d/10-cassandra.conf' - } - default: {} - } - + $net_ipv4_tcp_rmem = '4096, 87380, 16777216' + $net_ipv4_tcp_wmem = '4096, 65536, 16777216' + $sysctl_file = '/etc/sysctl.d/10-cassandra.conf' $cassandra_pkg = 'cassandra22' $config_path = '/etc/cassandra/default.conf' $java_package = 'java-1.8.0-openjdk-headless' diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 41fa3abe..2a6b144a 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -76,21 +76,6 @@ def bootstrap_pp } case downcase("${::operatingsystem}-${::operatingsystemmajrelease}") { - 'centos-6': { - package { ['gcc', 'tar', 'yum-utils', 'centos-release-scl']: } -> - exec { 'yum-config-manager --enable rhel-server-rhscl-7-rpms': } -> - package { 'ruby200': } -> - package { 'python27-python': - ensure => '2.7.8-18.el6', - } -> - exec { 'cp /opt/rh/python27/enable /etc/profile.d/python.sh': } -> - exec { 'echo "\n" >> /etc/profile.d/python.sh': } -> - exec { 'echo "export PYTHONPATH=/usr/lib/python2.7/site-packages" >> /etc/profile.d/python.sh': } -> - exec { '/bin/cp /opt/rh/ruby200/enable /etc/profile.d/ruby.sh': } -> - exec { '/bin/rm /usr/bin/ruby /usr/bin/gem': } -> - exec { '/usr/sbin/alternatives --install /usr/bin/ruby ruby /opt/rh/ruby200/root/usr/bin/ruby 1000': } -> - exec { '/usr/sbin/alternatives --install /usr/bin/gem gem /opt/rh/ruby200/root/usr/bin/gem 1000': } - } 'centos-7': { package { ['gcc', 'tar', 'initscripts']: } } From f06e41c61babcdc836e11235f6d64d9f5f644cd2 Mon Sep 17 00:00:00 2001 From: Trevor Vaughan Date: Sun, 14 Aug 2022 18:29:42 -0400 Subject: [PATCH 10/27] Update from voxpupuli modulesync_config --- .github/CONTRIBUTING.md | 7 ++- .github/workflows/ci.yml | 84 +++-------------------------------- .github/workflows/release.yml | 32 +++++-------- .msync.yml | 2 +- Dockerfile | 2 +- Gemfile | 6 +-- spec/spec_helper.rb | 2 + 7 files changed, 26 insertions(+), 109 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 048d2b55..8b466cfb 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 d08d05e8..8a077911 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 664ba694..15f17213 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 a83abd9b..02353859 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 e3cf307f..8dd82d63 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 b6dcf456..07209b79 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/spec/spec_helper.rb b/spec/spec_helper.rb index 78e8b77e..a489d4f8 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 b806d29f653ce675ca7543839cac4730b986f4d4 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 2 Oct 2022 14:47:42 +0200 Subject: [PATCH 11/27] modulesync 5.3.0 --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index f92f0516..60729955 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-cassandra' end # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 From f60fb319f1d1208aa8faf7e90a384e4a66cadba9 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 20 Dec 2022 14:50:51 +0100 Subject: [PATCH 12/27] 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 02353859..f3156d15 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 07209b79..b3827ba7 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 6ac1ed5597306f3ee38afdee4a469b955b5554ca Mon Sep 17 00:00:00 2001 From: Massimiliano Adamo Date: Sat, 15 Apr 2023 09:52:26 +0200 Subject: [PATCH 13/27] 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 cacadf22..00000000 --- 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 9b95224c..84fd904c 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 f3156d15..a4b00691 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 65f50514..58a04088 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 b3827ba7..15313c38 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 60729955..78b983e5 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-cassandra' 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-cassandra' - 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 19e55e84bb78e74927a09ac8a5cdab1cef0e5a9a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 12 May 2023 11:07:50 +0200 Subject: [PATCH 14/27] 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 a4b00691..b929160c 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 15313c38..98a04cfb 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 9d89d4bc5fe02cc489ef6e3eed9f5215b29c4d2b Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 17 Aug 2023 14:43:08 +0200 Subject: [PATCH 15/27] 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 8b466cfb..6aaa603f 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 b929160c..dd3e9572 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 98a04cfb..db21d3b5 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 a489d4f8..3b8712f9 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 538a2251ae48b2653345e413371da584e6b25ee8 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 18 Aug 2023 00:02:32 +0200 Subject: [PATCH 16/27] rubocop: autofix --- .rubocop.yml | 2 ++ .rubocop_todo.yml | 12 ++++++++++++ spec/acceptance/bootstrap_spec.rb | 2 +- spec/classes/init_spec.rb | 11 +---------- spec/defines/schema/permission_spec.rb | 4 +--- spec/defines/schema/user_spec.rb | 17 +---------------- spec/unit/facter/cassandramajorversion_spec.rb | 2 +- spec/unit/facter/cassandraminorversion_spec.rb | 2 +- spec/unit/facter/cassandrapatchversion_spec.rb | 2 +- spec/unit/facter/cassandrarelease_spec.rb | 2 +- 10 files changed, 22 insertions(+), 34 deletions(-) create mode 100644 .rubocop_todo.yml diff --git a/.rubocop.yml b/.rubocop.yml index 53ac1898..ea22bff8 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 00000000..e151e76f --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,12 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2023-08-17 21:30:43 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: 4 +RSpec/RepeatedExampleGroupBody: + Exclude: + - 'spec/defines/schema/user_spec.rb' diff --git a/spec/acceptance/bootstrap_spec.rb b/spec/acceptance/bootstrap_spec.rb index 18c6e595..f0593bd3 100644 --- a/spec/acceptance/bootstrap_spec.rb +++ b/spec/acceptance/bootstrap_spec.rb @@ -5,7 +5,7 @@ osfamily = fact('osfamily') roles = hosts[0]['roles'] t = TestManifests.new(roles, 0, 0) -bootstrap_pp = t.bootstrap_pp() +bootstrap_pp = t.bootstrap_pp describe 'Test Entry Criteria' do it "works with no errors (#{osfamily})" do diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 048c3a8f..fc0b1ef8 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -6,8 +6,8 @@ let :node do 'foo.example.com' end - on_supported_os.each do |os, facts| + on_supported_os.each do |os, facts| let :facts do facts end @@ -17,7 +17,6 @@ end context 'Test the default parameters (RedHat)' do - it do expect(subject).to contain_package('cassandra').with( ensure: 'present', @@ -77,7 +76,6 @@ end context 'On RedHat 7 with data directories specified.' do - let :params do { commitlog_directory: '/var/lib/cassandra/commitlog', @@ -98,7 +96,6 @@ end context 'On RedHat 7 with service provider set to init.' do - let :params do { service_provider: 'init' @@ -116,7 +113,6 @@ end context 'On a Debian OS with defaults for all parameters' do - it do expect(subject).to contain_class('cassandra') expect(subject).to contain_group('cassandra').with_ensure('present') @@ -198,7 +194,6 @@ end context 'CASSANDRA-9822 activated on Ubuntu 16.04' do - let :params do { cassandra_9822: true # rubocop:disable Naming/VariableNumber @@ -214,7 +209,6 @@ end context 'Install DSE on a Red Hat family OS.' do - let :params do { package_ensure: '4.7.0-1', @@ -265,7 +259,6 @@ end context 'Ensure cassandra service can be stopped and disabled.' do - let :params do { service_ensure: 'stopped', @@ -282,7 +275,6 @@ end context 'Test the dc and rack properties with defaults (Debian).' do - it do expect(subject).to contain_file('/etc/cassandra/cassandra-rackdc.properties'). with_content(%r{^dc=DC1}). @@ -293,7 +285,6 @@ end context 'Test the dc and rack properties with defaults (RedHat).' do - it do expect(subject).to contain_file('/etc/cassandra/default.conf/cassandra-rackdc.properties'). with_content(%r{^dc=DC1}). diff --git a/spec/defines/schema/permission_spec.rb b/spec/defines/schema/permission_spec.rb index 65a0bdd6..e0f36f32 100644 --- a/spec/defines/schema/permission_spec.rb +++ b/spec/defines/schema/permission_spec.rb @@ -6,13 +6,12 @@ let :node do 'foo.example.com' end - on_supported_os.each do |os, facts| + on_supported_os.each do |_os, facts| let :facts do facts end context 'with user_name' do - let(:title) { 'foobar' } let(:params) do { @@ -24,7 +23,6 @@ end context 'Set ensure to latest' do - let(:title) { 'foobar' } let(:params) do { diff --git a/spec/defines/schema/user_spec.rb b/spec/defines/schema/user_spec.rb index e5e4da34..cb72fdeb 100644 --- a/spec/defines/schema/user_spec.rb +++ b/spec/defines/schema/user_spec.rb @@ -6,13 +6,12 @@ let :node do 'foo.example.com' end - on_supported_os.each do |os, facts| + on_supported_os.each do |_os, facts| let :facts do facts end context 'Create a supper user on cassandrarelease undef' do - let(:title) { 'akers' } let(:params) do @@ -37,7 +36,6 @@ end context 'Create a supper user on cassandrarelease undef with SCL' do - let(:title) { 'akers' } let(:params) do @@ -62,7 +60,6 @@ end context 'Create a supper user in cassandrarelease < 2.2' do - let(:title) { 'akers' } let(:params) do @@ -87,7 +84,6 @@ end context 'Create a supper user in cassandrarelease < 2.2 with SCL' do - let(:title) { 'akers' } let(:params) do @@ -112,7 +108,6 @@ end context 'Create a user in cassandrarelease < 2.2' do - let(:title) { 'akers' } let(:params) do @@ -136,7 +131,6 @@ end context 'Create a user in cassandrarelease < 2.2 with SCL' do - let(:title) { 'akers' } let(:params) do @@ -160,7 +154,6 @@ end context 'Create a supper user with login in cassandrarelease > 2.2' do - let(:title) { 'akers' } let(:params) do @@ -185,7 +178,6 @@ end context 'Create a supper user with login in cassandrarelease > 2.2 with SCL' do - let(:title) { 'akers' } let(:params) do @@ -210,7 +202,6 @@ end context 'Create a user without login in cassandrarelease > 2.2' do - let(:title) { 'bob' } let(:params) do @@ -235,7 +226,6 @@ end context 'Create a user without login in cassandrarelease > 2.2 with SCL' do - let(:title) { 'bob' } let(:params) do @@ -260,7 +250,6 @@ end context 'Drop a user in cassandrarelease > 2.2' do - let(:title) { 'akers' } let(:params) do @@ -283,7 +272,6 @@ end context 'Drop a user in cassandrarelease > 2.2 with SCL' do - let(:title) { 'akers' } let(:params) do @@ -306,7 +294,6 @@ end context 'Drop a user in cassandrarelease < 2.2' do - let(:title) { 'akers' } let(:params) do @@ -329,7 +316,6 @@ end context 'Drop a user in cassandrarelease < 2.2 with SCL' do - let(:title) { 'akers' } let(:params) do @@ -352,7 +338,6 @@ end context 'Set ensure to latest' do - let(:title) { 'foobar' } let(:params) do { diff --git a/spec/unit/facter/cassandramajorversion_spec.rb b/spec/unit/facter/cassandramajorversion_spec.rb index 57aa4e0d..33cba6cc 100644 --- a/spec/unit/facter/cassandramajorversion_spec.rb +++ b/spec/unit/facter/cassandramajorversion_spec.rb @@ -24,7 +24,7 @@ describe 'Cassandra not installed or not running' do it do Facter::Util::Resolution.stubs(:exec).with('nodetool version').returns('') - expect(Facter.fact(:cassandramajorversion).value).to be(nil) + expect(Facter.fact(:cassandramajorversion).value).to be_nil end end end diff --git a/spec/unit/facter/cassandraminorversion_spec.rb b/spec/unit/facter/cassandraminorversion_spec.rb index 37355a91..fedfa6e0 100644 --- a/spec/unit/facter/cassandraminorversion_spec.rb +++ b/spec/unit/facter/cassandraminorversion_spec.rb @@ -24,7 +24,7 @@ describe 'Cassandra not installed or not running' do it do Facter::Util::Resolution.stubs(:exec).with('nodetool version').returns('') - expect(Facter.fact(:cassandraminorversion).value).to be(nil) + expect(Facter.fact(:cassandraminorversion).value).to be_nil end end end diff --git a/spec/unit/facter/cassandrapatchversion_spec.rb b/spec/unit/facter/cassandrapatchversion_spec.rb index c870e49e..43bdeeb1 100644 --- a/spec/unit/facter/cassandrapatchversion_spec.rb +++ b/spec/unit/facter/cassandrapatchversion_spec.rb @@ -24,7 +24,7 @@ describe 'Cassandra not installed or not running' do it do Facter::Util::Resolution.stubs(:exec).with('nodetool version').returns('') - expect(Facter.fact(:cassandrapatchversion).value).to be(nil) + expect(Facter.fact(:cassandrapatchversion).value).to be_nil end end end diff --git a/spec/unit/facter/cassandrarelease_spec.rb b/spec/unit/facter/cassandrarelease_spec.rb index 313d5152..2be68c04 100644 --- a/spec/unit/facter/cassandrarelease_spec.rb +++ b/spec/unit/facter/cassandrarelease_spec.rb @@ -24,7 +24,7 @@ describe 'Cassandra not installed or not running' do it do Facter::Util::Resolution.stubs(:exec).with('nodetool version').returns('') - expect(Facter.fact(:cassandrarelease).value).to be(nil) + expect(Facter.fact(:cassandrarelease).value).to be_nil end end end From 5c2f5757a2ad63aa9fcd4586308a4838d8510c38 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 15 Dec 2023 12:27:21 +0100 Subject: [PATCH 17/27] 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 8a077911..b66d8ca7 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 15f17213..55324aa6 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 dd3e9572..f8183449 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 58a04088..10b98306 100644 --- a/.pmtignore +++ b/.pmtignore @@ -35,3 +35,4 @@ /.yardoc/ /.yardopts /Dockerfile +/HISTORY.md diff --git a/.rubocop.yml b/.rubocop.yml index ea22bff8..fded90cf 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 db21d3b5..a4a3b204 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 4b30068e423c5b85369a6b4492df1401fc334469 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 6 Feb 2024 12:27:58 +0100 Subject: [PATCH 18/27] 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 b66d8ca7..7216724f 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 f8183449..f46ee025 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 d96f891154985225ebfd1a0765334dc195c554c1 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Fri, 9 Feb 2024 11:49:08 +0100 Subject: [PATCH 19/27] regenerate reference --- REFERENCE.md | 845 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 510 insertions(+), 335 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 79b86d78..30f92de4 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -1,47 +1,80 @@ # Reference + ## Table of Contents -**Classes** +### Classes * [`cassandra`](#cassandra): A class for installing the Cassandra package and manipulate settings in the configuration file. -* [`cassandra::apache_repo`](#cassandraapache_repo): An optional class that will allow a suitable repository to be configured from which packages for Apache Cassandra can be downloaded. -* [`cassandra::datastax_agent`](#cassandradatastax_agent): A class for installing the DataStax Agent and to point it at an OpsCenter instance. -* [`cassandra::datastax_repo`](#cassandradatastax_repo): An optional class that will allow a suitable repository to be configured from which packages for DataStax Community can be downloaded. Chang -* [`cassandra::dse`](#cassandradse): A class for configuring DataStax Enterprise (DSE) specific settings. -* [`cassandra::firewall_ports`](#cassandrafirewall_ports): An optional class to configure incoming network ports on the host that are relevant to the Cassandra installation. If firewalls are being ma -* [`cassandra::java`](#cassandrajava): A class to install Java and JNA packages. -* [`cassandra::optutils`](#cassandraoptutils): A class to install the optional Cassandra tools package. -* [`cassandra::params`](#cassandraparams): This class is meant to be called from the locp-cassandra module. It sets variables according to platform. -* [`cassandra::schema`](#cassandraschema): A class to maintain the database schema. Please note that cqlsh expects Python 2.7 to be installed. This may be a problem of older distributions (CentOS 6 for example). -* [`cassandra::system::swapoff`](#cassandrasystemswapoff): Disable swap on the node as suggested at http://docs.datastax.com/en/landing_page/doc/landing_page/recommendedSettingsLinux.html -* [`cassandra::system::sysctl`](#cassandrasystemsysctl): Set Sysctl (kernel runtime parameters) as suggested in http://docs.datastax.com/en/landing_page/doc/landing_page/recommendedSettingsLinux.htm -* [`cassandra::system::transparent_hugepage`](#cassandrasystemtransparent_hugepage): Disable Transparant Huge Pages as suggested in http://docs.datastax.com/en/landing_page/doc/landing_page/recommendedSettingsLinux.html. - -**Defined types** - -* [`cassandra::file`](#cassandrafile): A defined type for altering files relative to the configuration directory. -* [`cassandra::private::firewall_ports::rule`](#cassandraprivatefirewall_portsrule): A defined type to be used as a macro for setting host based firewall rules. This is not intended to be used by a user (who should use the AP -* [`cassandra::schema::cql_type`](#cassandraschemacql_type): Create or drop user defined data types within the schema. -* [`cassandra::schema::index`](#cassandraschemaindex): Create or drop indexes within the schema. -* [`cassandra::schema::keyspace`](#cassandraschemakeyspace): Create or drop keyspaces within the schema. -* [`cassandra::schema::permission`](#cassandraschemapermission): Grant or revoke permissions. To use this class, a suitable `authenticator` (e.g. PasswordAuthenticator) and `authorizer` (e.g. CassandraAutho -* [`cassandra::schema::table`](#cassandraschematable): Create or drop tables within the schema. -* [`cassandra::schema::user`](#cassandraschemauser): Create or drop users. To use this class, a suitable `authenticator` (e.g. PasswordAuthenticator) must be set in the Cassandra class. +* [`cassandra::apache_repo`](#cassandra--apache_repo): An optional class that will allow a suitable repository to be configured from which packages for Apache Cassandra can be downloaded. +* [`cassandra::datastax_agent`](#cassandra--datastax_agent): A class for installing the DataStax Agent and to point it at an OpsCenter instance. +* [`cassandra::datastax_repo`](#cassandra--datastax_repo): An optional class that will allow a suitable repository to be configured from which packages for DataStax Community can be downloaded. Chang +* [`cassandra::dse`](#cassandra--dse): A class for configuring DataStax Enterprise (DSE) specific settings. +* [`cassandra::firewall_ports`](#cassandra--firewall_ports): An optional class to configure incoming network ports on the host that are relevant to the Cassandra installation. If firewalls are being ma +* [`cassandra::java`](#cassandra--java): A class to install Java and JNA packages. +* [`cassandra::optutils`](#cassandra--optutils): A class to install the optional Cassandra tools package. +* [`cassandra::params`](#cassandra--params): This class is meant to be called from the locp-cassandra module. It sets variables according to platform. +* [`cassandra::schema`](#cassandra--schema): A class to maintain the database schema. Please note that cqlsh expects Python 2.7 to be installed. This may be a problem of older distributions (CentOS 6 for example). +* [`cassandra::system::swapoff`](#cassandra--system--swapoff): Disable swap on the node as suggested at http://docs.datastax.com/en/landing_page/doc/landing_page/recommendedSettingsLinux.html +* [`cassandra::system::sysctl`](#cassandra--system--sysctl): Set Sysctl (kernel runtime parameters) as suggested in http://docs.datastax.com/en/landing_page/doc/landing_page/recommendedSettingsLinux.htm +* [`cassandra::system::transparent_hugepage`](#cassandra--system--transparent_hugepage): Disable Transparant Huge Pages as suggested in http://docs.datastax.com/en/landing_page/doc/landing_page/recommendedSettingsLinux.html. + +### Defined types + +* [`cassandra::file`](#cassandra--file): A defined type for altering files relative to the configuration directory. +* [`cassandra::private::firewall_ports::rule`](#cassandra--private--firewall_ports--rule): A defined type to be used as a macro for setting host based firewall rules. This is not intended to be used by a user (who should use the AP +* [`cassandra::schema::cql_type`](#cassandra--schema--cql_type): Create or drop user defined data types within the schema. +* [`cassandra::schema::index`](#cassandra--schema--index): Create or drop indexes within the schema. +* [`cassandra::schema::keyspace`](#cassandra--schema--keyspace): Create or drop keyspaces within the schema. +* [`cassandra::schema::permission`](#cassandra--schema--permission): Grant or revoke permissions. To use this class, a suitable `authenticator` (e.g. PasswordAuthenticator) and `authorizer` (e.g. CassandraAutho +* [`cassandra::schema::table`](#cassandra--schema--table): Create or drop tables within the schema. +* [`cassandra::schema::user`](#cassandra--schema--user): Create or drop users. To use this class, a suitable `authenticator` (e.g. PasswordAuthenticator) must be set in the Cassandra class. ## Classes -### cassandra +### `cassandra` A class for installing the Cassandra package and manipulate settings in the configuration file. #### Parameters -The following parameters are available in the `cassandra` class. - -##### `baseline_settings` +The following parameters are available in the `cassandra` class: + +* [`baseline_settings`](#-cassandra--baseline_settings) +* [`cassandra_2356_sleep_seconds`](#-cassandra--cassandra_2356_sleep_seconds) +* [`cassandra_9822`](#-cassandra--cassandra_9822) +* [`cassandra_yaml_tmpl`](#-cassandra--cassandra_yaml_tmpl) +* [`commitlog_directory`](#-cassandra--commitlog_directory) +* [`commitlog_directory_mode`](#-cassandra--commitlog_directory_mode) +* [`manage_config_file`](#-cassandra--manage_config_file) +* [`config_file_mode`](#-cassandra--config_file_mode) +* [`config_path`](#-cassandra--config_path) +* [`data_file_directories`](#-cassandra--data_file_directories) +* [`data_file_directories_mode`](#-cassandra--data_file_directories_mode) +* [`dc`](#-cassandra--dc) +* [`dc_suffix`](#-cassandra--dc_suffix) +* [`fail_on_non_supported_os`](#-cassandra--fail_on_non_supported_os) +* [`hints_directory`](#-cassandra--hints_directory) +* [`hints_directory_mode`](#-cassandra--hints_directory_mode) +* [`package_ensure`](#-cassandra--package_ensure) +* [`package_name`](#-cassandra--package_name) +* [`prefer_local`](#-cassandra--prefer_local) +* [`rack`](#-cassandra--rack) +* [`rackdc_tmpl`](#-cassandra--rackdc_tmpl) +* [`saved_caches_directory`](#-cassandra--saved_caches_directory) +* [`saved_caches_directory_mode`](#-cassandra--saved_caches_directory_mode) +* [`service_enable`](#-cassandra--service_enable) +* [`service_ensure`](#-cassandra--service_ensure) +* [`service_name`](#-cassandra--service_name) +* [`service_provider`](#-cassandra--service_provider) +* [`service_refresh`](#-cassandra--service_refresh) +* [`settings`](#-cassandra--settings) +* [`snitch_properties_file`](#-cassandra--snitch_properties_file) +* [`systemctl`](#-cassandra--systemctl) + +##### `baseline_settings` Data type: `hash` @@ -50,9 +83,9 @@ are merged with the `settings` hash. The values of the `settings` hash overriding the values in this hash. This is most useful when used with hiera. -Default value: {} +Default value: `{}` -##### `cassandra_2356_sleep_seconds` +##### `cassandra_2356_sleep_seconds` Data type: `boolean` @@ -62,9 +95,9 @@ sleeping for the specifed number of seconds after an event involving the Cassandra package. This option is silently ignored on the Red Hat family of operating systems as this bug only affects Debian systems. -Default value: 5 +Default value: `5` -##### `cassandra_9822` +##### `cassandra_9822` Data type: `boolean` @@ -75,7 +108,7 @@ This this bug only affects Debian systems. Default value: `false` -##### `cassandra_yaml_tmpl` +##### `cassandra_yaml_tmpl` Data type: `string` @@ -83,9 +116,9 @@ The path to the Puppet template for the Cassandra configuration file. This allows the user to supply their own customized template.` -Default value: 'cassandra/cassandra.yaml.erb' +Default value: `'cassandra/cassandra.yaml.erb'` -##### `commitlog_directory` +##### `commitlog_directory` Data type: `string` @@ -96,7 +129,7 @@ exclusive. Default value: `undef` -##### `commitlog_directory_mode` +##### `commitlog_directory_mode` Data type: `string` @@ -104,9 +137,9 @@ The mode for the `commitlog_directory` is ignored unless `commitlog_directory` is specified. -Default value: '0750' +Default value: `'0750'` -##### `manage_config_file` +##### `manage_config_file` Data type: `Boolean` @@ -115,24 +148,24 @@ file. Default value: `true` -##### `config_file_mode` +##### `config_file_mode` Data type: `string` The permissions mode of the cassandra configuration file. -Default value: '0644' +Default value: `'0644'` -##### `config_path` +##### `config_path` Data type: `string` The path to the cassandra configuration file. -Default value: $cassandra::params::config_path +Default value: `$cassandra::params::config_path` -##### `data_file_directories` +##### `data_file_directories` Data type: `array` @@ -144,7 +177,7 @@ exclusive. Default value: `undef` -##### `data_file_directories_mode` +##### `data_file_directories_mode` Data type: `string` @@ -152,9 +185,9 @@ The mode for the `data_file_directories` is ignored unless `data_file_directories` is specified. -Default value: '0750' +Default value: `'0750'` -##### `dc` +##### `dc` Data type: `string` @@ -162,9 +195,9 @@ Sets the value for dc in *config_path*/*snitch_properties_file* http://docs.datastax.com/en/cassandra/2.1/cassandra/architecture/architectureSnitchesAbout_c.html for more details. -Default value: 'DC1' +Default value: `'DC1'` -##### `dc_suffix` +##### `dc_suffix` Data type: `string` @@ -176,7 +209,7 @@ the snitch properties file for this setting. Default value: `undef` -##### `fail_on_non_supported_os` +##### `fail_on_non_supported_os` Data type: `boolean` @@ -186,7 +219,7 @@ you must also at least set the `config_path` attribute as well. Default value: `true` -##### `hints_directory` +##### `hints_directory` Data type: `string` @@ -197,7 +230,7 @@ exclusive. Do not set this option in Cassandra versions before 3.0.0. Default value: `undef` -##### `hints_directory_mode` +##### `hints_directory_mode` Data type: `string` @@ -205,9 +238,9 @@ The mode for the `hints_directory` is ignored unless `hints_directory` is specified. -Default value: '0750' +Default value: `'0750'` -##### `package_ensure` +##### `package_ensure` Data type: `present|latest|string` @@ -215,18 +248,18 @@ The status of the package specified in **package_name**. Can be *present*, *latest* or a specific version number. -Default value: 'present' +Default value: `'present'` -##### `package_name` +##### `package_name` Data type: `string` The name of the Cassandra package which must be available from a repository. -Default value: $cassandra::params::cassandra_pkg +Default value: `$cassandra::params::cassandra_pkg` -##### `prefer_local` +##### `prefer_local` Data type: `boolean` @@ -239,7 +272,7 @@ this setting. Default value: `undef` -##### `rack` +##### `rack` Data type: `string` @@ -248,17 +281,17 @@ Sets the value for rack in http://docs.datastax.com/en/cassandra/2.1/cassandra/architecture/architectureSnitchesAbout_c.html for more details. -Default value: 'RAC1' +Default value: `'RAC1'` -##### `rackdc_tmpl` +##### `rackdc_tmpl` Data type: `string` The template for creating the snitch properties file. -Default value: 'cassandra/cassandra-rackdc.properties.erb' +Default value: `'cassandra/cassandra-rackdc.properties.erb'` -##### `saved_caches_directory` +##### `saved_caches_directory` Data type: `string` @@ -269,7 +302,7 @@ exclusive. Default value: `undef` -##### `saved_caches_directory_mode` +##### `saved_caches_directory_mode` Data type: `string` @@ -277,9 +310,9 @@ The mode for the `saved_caches_directory` is ignored unless `saved_caches_directory` is specified. -Default value: '0750' +Default value: `'0750'` -##### `service_enable` +##### `service_enable` Data type: `boolean` @@ -287,7 +320,7 @@ enable the Cassandra service to start at boot time. Default value: `true` -##### `service_ensure` +##### `service_ensure` Data type: `string` @@ -296,15 +329,15 @@ are running or stopped. Default value: `undef` -##### `service_name` +##### `service_name` Data type: `string` The name of the service that runs the Cassandra software. -Default value: 'cassandra' +Default value: `'cassandra'` -##### `service_provider` +##### `service_provider` Data type: `string` @@ -314,7 +347,7 @@ be used, otherwise the specified value will be used instead. Default value: `undef` -##### `service_refresh` +##### `service_refresh` Data type: `boolean` @@ -326,7 +359,7 @@ to control when the service is restarted. Default value: `true` -##### `settings` +##### `settings` Data type: `hash` @@ -362,18 +395,18 @@ Cassandra 2.X are as follows: For Cassandra 3.X you will also need to specify the `hints_directory` attribute. -Default value: {} +Default value: `{}` -##### `snitch_properties_file` +##### `snitch_properties_file` Data type: `string` The name of the snitch properties file. The full path name would be *config_path*/*snitch_properties_file*. -Default value: 'cassandra-rackdc.properties' +Default value: `'cassandra-rackdc.properties'` -##### `systemctl` +##### `systemctl` Data type: `string` @@ -381,18 +414,24 @@ The full path to the systemctl command. Only needed when the package is installed. Will silently continue if the executable does not exist. -Default value: $cassandra::params::systemctl +Default value: `$cassandra::params::systemctl` -### cassandra::apache_repo +### `cassandra::apache_repo` An optional class that will allow a suitable repository to be configured from which packages for Apache Cassandra can be downloaded. #### Parameters -The following parameters are available in the `cassandra::apache_repo` class. +The following parameters are available in the `cassandra::apache_repo` class: + +* [`descr`](#-cassandra--apache_repo--descr) +* [`key_id`](#-cassandra--apache_repo--key_id) +* [`key_url`](#-cassandra--apache_repo--key_url) +* [`pkg_url`](#-cassandra--apache_repo--pkg_url) +* [`release`](#-cassandra--apache_repo--release) -##### `descr` +##### `descr` Data type: `string` @@ -400,9 +439,9 @@ On the Red Hat family, this is passed as the `descr` attribute to a `yumrepo` resource. On the Debian family, it is passed as the `comment` attribute to an `apt::source` resource. -Default value: 'Repo for Apache Cassandra' +Default value: `'Repo for Apache Cassandra'` -##### `key_id` +##### `key_id` Data type: `string` @@ -410,9 +449,9 @@ On the Debian family, this is passed as the `id` attribute to an `apt::key` resource. On the Red Hat family, it is ignored. -Default value: 'A26E528B271F19B9E5D8E19EA278B781FE4B2BDA' +Default value: `'A26E528B271F19B9E5D8E19EA278B781FE4B2BDA'` -##### `key_url` +##### `key_url` Data type: `string` @@ -420,9 +459,9 @@ On the Debian family, this is passed as the `source` attribute to an `apt::key` resource. On the Red Hat family, it is set to the `gpgkey` attribute on the `yumrepo` resource. -Default value: 'https://www.apache.org/dist/cassandra/KEYS' +Default value: `'https://www.apache.org/dist/cassandra/KEYS'` -##### `pkg_url` +##### `pkg_url` Data type: `string` @@ -436,7 +475,7 @@ will set the `location` attribute on an `apt::source` to Default value: `undef` -##### `release` +##### `release` Data type: `string` @@ -445,9 +484,9 @@ attribute to an `apt::source` resource. On the Red Hat family, it is the major version number of Cassandra, without dot, and with an appended 'x' (e.g. '311x') -Default value: 'main' +Default value: `'main'` -### cassandra::datastax_agent +### `cassandra::datastax_agent` A class for installing the DataStax Agent and to point it at an OpsCenter instance. @@ -476,25 +515,36 @@ class { 'cassandra::datastax_agent': #### Parameters -The following parameters are available in the `cassandra::datastax_agent` class. +The following parameters are available in the `cassandra::datastax_agent` class: -##### `address_config_file` +* [`address_config_file`](#-cassandra--datastax_agent--address_config_file) +* [`defaults_file`](#-cassandra--datastax_agent--defaults_file) +* [`java_home`](#-cassandra--datastax_agent--java_home) +* [`package_ensure`](#-cassandra--datastax_agent--package_ensure) +* [`package_name`](#-cassandra--datastax_agent--package_name) +* [`service_ensure`](#-cassandra--datastax_agent--service_ensure) +* [`service_enable`](#-cassandra--datastax_agent--service_enable) +* [`service_name`](#-cassandra--datastax_agent--service_name) +* [`service_provider`](#-cassandra--datastax_agent--service_provider) +* [`settings`](#-cassandra--datastax_agent--settings) + +##### `address_config_file` Data type: `Any` The full path to the address config file. -Default value: '/var/lib/datastax-agent/conf/address.yaml' +Default value: `'/var/lib/datastax-agent/conf/address.yaml'` -##### `defaults_file` +##### `defaults_file` Data type: `Any` The full path name to the file where `java_home` is set. -Default value: '/etc/default/datastax-agent' +Default value: `'/etc/default/datastax-agent'` -##### `java_home` +##### `java_home` Data type: `Any` @@ -504,32 +554,32 @@ action is taken. Otherwise the value is set as JAVA_HOME in Default value: `undef` -##### `package_ensure` +##### `package_ensure` Data type: `Any` Is passed to the package reference. Valid values are **present** or a version number. -Default value: 'present' +Default value: `'present'` -##### `package_name` +##### `package_name` Data type: `Any` Is passed to the package reference. -Default value: 'datastax-agent' +Default value: `'datastax-agent'` -##### `service_ensure` +##### `service_ensure` Data type: `Any` Is passed to the service reference. -Default value: 'running' +Default value: `'running'` -##### `service_enable` +##### `service_enable` Data type: `Any` @@ -537,15 +587,15 @@ Is passed to the service reference. Default value: `true` -##### `service_name` +##### `service_name` Data type: `Any` Is passed to the service reference. -Default value: 'datastax-agent' +Default value: `'datastax-agent'` -##### `service_provider` +##### `service_provider` Data type: `Any` @@ -555,7 +605,7 @@ otherwise the specified value will be used instead. Default value: `undef` -##### `settings` +##### `settings` Data type: `Any` @@ -573,9 +623,9 @@ with the following additional defaults: } ``` -Default value: {} +Default value: `{}` -### cassandra::datastax_repo +### `cassandra::datastax_repo` An optional class that will allow a suitable repository to be configured from which packages for DataStax Community can be downloaded. Changing @@ -584,9 +634,15 @@ configured. #### Parameters -The following parameters are available in the `cassandra::datastax_repo` class. +The following parameters are available in the `cassandra::datastax_repo` class: + +* [`descr`](#-cassandra--datastax_repo--descr) +* [`key_id`](#-cassandra--datastax_repo--key_id) +* [`key_url`](#-cassandra--datastax_repo--key_url) +* [`pkg_url`](#-cassandra--datastax_repo--pkg_url) +* [`release`](#-cassandra--datastax_repo--release) -##### `descr` +##### `descr` Data type: `string` @@ -594,9 +650,9 @@ On the Red Hat family, this is passed as the `descr` attribute to a `yumrepo` resource. On the Debian family, it is passed as the `comment` attribute to an `apt::source` resource. -Default value: 'DataStax Repo for Apache Cassandra' +Default value: `'DataStax Repo for Apache Cassandra'` -##### `key_id` +##### `key_id` Data type: `string` @@ -604,9 +660,9 @@ On the Debian family, this is passed as the `id` attribute to an `apt::key` resource. On the Red Hat family, it is ignored. -Default value: '7E41C00F85BFC1706C4FFFB3350200F2B999A372' +Default value: `'7E41C00F85BFC1706C4FFFB3350200F2B999A372'` -##### `key_url` +##### `key_url` Data type: `string` @@ -614,9 +670,9 @@ On the Debian family, this is passed as the `source` attribute to an `apt::key` resource. On the Red Hat family, it is ignored. -Default value: 'http://debian.datastax.com/debian/repo_key' +Default value: `'http://debian.datastax.com/debian/repo_key'` -##### `pkg_url` +##### `pkg_url` Data type: `string` @@ -628,7 +684,7 @@ will set the `location` attribute on an `apt::source` to Default value: `undef` -##### `release` +##### `release` Data type: `string` @@ -636,9 +692,9 @@ On the Debian family, this is passed as the `release` attribute to an `apt::source` resource. On the Red Hat family, it is ignored. -Default value: 'stable' +Default value: `'stable'` -### cassandra::dse +### `cassandra::dse` A class for configuring DataStax Enterprise (DSE) specific settings. @@ -685,33 +741,40 @@ class { 'cassandra::dse': #### Parameters -The following parameters are available in the `cassandra::dse` class. +The following parameters are available in the `cassandra::dse` class: + +* [`config_file`](#-cassandra--dse--config_file) +* [`config_file_mode`](#-cassandra--dse--config_file_mode) +* [`dse_yaml_tmpl`](#-cassandra--dse--dse_yaml_tmpl) +* [`file_lines`](#-cassandra--dse--file_lines) +* [`service_refresh`](#-cassandra--dse--service_refresh) +* [`settings`](#-cassandra--dse--settings) -##### `config_file` +##### `config_file` Data type: `string` The full path to the DSE configuration file. -Default value: '/etc/dse/dse.yaml' +Default value: `'/etc/dse/dse.yaml'` -##### `config_file_mode` +##### `config_file_mode` Data type: `string` The mode for the DSE configuration file. -Default value: '0644' +Default value: `'0644'` -##### `dse_yaml_tmpl` +##### `dse_yaml_tmpl` Data type: `string` A path to a template for the `dse.yaml` file. -Default value: 'cassandra/dse.yaml.erb' +Default value: `'cassandra/dse.yaml.erb'` -##### `file_lines` +##### `file_lines` Data type: `hash` @@ -720,7 +783,7 @@ A hash of values that are passed to Default value: `undef` -##### `service_refresh` +##### `service_refresh` Data type: `boolean` @@ -729,7 +792,7 @@ should be refreshed if the DSE configuration files are changed. Default value: `true` -##### `settings` +##### `settings` Data type: `hash` @@ -739,7 +802,7 @@ unchanged. Default value: `undef` -### cassandra::firewall_ports +### `cassandra::firewall_ports` An optional class to configure incoming network ports on the host that are relevant to the Cassandra installation. If firewalls are being managed @@ -751,9 +814,19 @@ it must be the final cassandra class included in the manifest. #### Parameters -The following parameters are available in the `cassandra::firewall_ports` class. +The following parameters are available in the `cassandra::firewall_ports` class: -##### `client_ports` +* [`client_ports`](#-cassandra--firewall_ports--client_ports) +* [`client_subnets`](#-cassandra--firewall_ports--client_subnets) +* [`inter_node_ports`](#-cassandra--firewall_ports--inter_node_ports) +* [`inter_node_subnets`](#-cassandra--firewall_ports--inter_node_subnets) +* [`public_ports`](#-cassandra--firewall_ports--public_ports) +* [`public_subnets`](#-cassandra--firewall_ports--public_subnets) +* [`ssh_port`](#-cassandra--firewall_ports--ssh_port) +* [`opscenter_ports`](#-cassandra--firewall_ports--opscenter_ports) +* [`opscenter_subnets`](#-cassandra--firewall_ports--opscenter_subnets) + +##### `client_ports` Data type: `array` @@ -761,9 +834,9 @@ Only has any effect if the `cassandra` class is defined on the node. Allow these TCP ports to be opened for traffic coming from the client subnets. -Default value: [9042, 9160] +Default value: `[9042, 9160]` -##### `client_subnets` +##### `client_subnets` Data type: `array` @@ -771,18 +844,18 @@ Only has any effect if the `cassandra` class is defined on the node. An array of the list of subnets that are to allowed connection to cassandra::native_transport_port and cassandra::rpc_port. -Default value: ['0.0.0.0/0'] +Default value: `['0.0.0.0/0']` -##### `inter_node_ports` +##### `inter_node_ports` Data type: `array` Only has any effect if the `cassandra` class is defined on the node. Allow these TCP ports to be opened for traffic between the Cassandra nodes. -Default value: [7000, 7001, 7199] +Default value: `[7000, 7001, 7199]` -##### `inter_node_subnets` +##### `inter_node_subnets` Data type: `array` @@ -791,9 +864,9 @@ An array of the list of subnets that are to allowed connection to `cassandra::storage_port`, `cassandra::ssl_storage_port` and port 7199 for cassandra JMX monitoring. -Default value: ['0.0.0.0/0'] +Default value: `['0.0.0.0/0']` -##### `public_ports` +##### `public_ports` Data type: `array` @@ -801,26 +874,26 @@ Allow these TCP ports to be opened for traffic coming from public subnets the port specified in `$ssh_port` will be appended to this list. -Default value: [8888] +Default value: `[8888]` -##### `public_subnets` +##### `public_subnets` Data type: `array` An array of the list of subnets that are to allowed connection to cassandra::firewall_ports::ssh_port. -Default value: ['0.0.0.0/0'] +Default value: `['0.0.0.0/0']` -##### `ssh_port` +##### `ssh_port` Data type: `integer` Which port does SSH operate on. -Default value: 22 +Default value: `22` -##### `opscenter_ports` +##### `opscenter_ports` Data type: `array` @@ -828,26 +901,34 @@ Only has any effect if the `cassandra::datastax_agent` is defined. Allow these TCP ports to be opened for traffic coming to or from OpsCenter appended to this list. -Default value: [9042, 9160, 61620, 61621] +Default value: `[9042, 9160, 61620, 61621]` -##### `opscenter_subnets` +##### `opscenter_subnets` Data type: `array` A list of subnets that are to be allowed connection to port 61621 for nodes built with cassandra::datastax_agent. -Default value: ['0.0.0.0/0'] +Default value: `['0.0.0.0/0']` -### cassandra::java +### `cassandra::java` A class to install Java and JNA packages. #### Parameters -The following parameters are available in the `cassandra::java` class. +The following parameters are available in the `cassandra::java` class: + +* [`aptkey`](#-cassandra--java--aptkey) +* [`aptsource`](#-cassandra--java--aptsource) +* [`jna_ensure`](#-cassandra--java--jna_ensure) +* [`jna_package_name`](#-cassandra--java--jna_package_name) +* [`package_ensure`](#-cassandra--java--package_ensure) +* [`package_name`](#-cassandra--java--package_name) +* [`yumrepo`](#-cassandra--java--yumrepo) -##### `aptkey` +##### `aptkey` Data type: `hash` @@ -857,7 +938,7 @@ This is ignored on non-Debian systems. Default value: `undef` -##### `aptsource` +##### `aptsource` Data type: `hash` @@ -867,41 +948,41 @@ function. This is ignored on non-Red Hat` Default value: `undef` -##### `jna_ensure` +##### `jna_ensure` Data type: `string` Is passed to the package reference for the JNA package. Valid values are `present` or a version number. -Default value: present +Default value: `present` -##### `jna_package_name` +##### `jna_package_name` Data type: `string` The name of the JNA package. -Default value: $cassandra::params::jna_package_name +Default value: `$cassandra::params::jna_package_name` -##### `package_ensure` +##### `package_ensure` Data type: `string` Is passed to the package reference for the JRE/JDK package. Valid values are `present` or a version number. -Default value: present +Default value: `present` -##### `package_name` +##### `package_name` Data type: `string` The name of the Java package to be installed. -Default value: $cassandra::params::java_package +Default value: `$cassandra::params::java_package` -##### `yumrepo` +##### `yumrepo` Data type: `hash` @@ -911,81 +992,103 @@ This is ignored on non-Red Hat systems. Default value: `undef` -### cassandra::optutils +### `cassandra::optutils` A class to install the optional Cassandra tools package. #### Parameters -The following parameters are available in the `cassandra::optutils` class. +The following parameters are available in the `cassandra::optutils` class: + +* [`package_ensure`](#-cassandra--optutils--package_ensure) +* [`package_name`](#-cassandra--optutils--package_name) -##### `package_ensure` +##### `package_ensure` Data type: `string` Can be `present`, `latest` or a specific version number. -Default value: 'present' +Default value: `'present'` -##### `package_name` +##### `package_name` Data type: `string` The name of the optional utilities package to be installed. -Default value: $cassandra::params::optutils_package_name +Default value: `$cassandra::params::optutils_package_name` -### cassandra::params +### `cassandra::params` This class is meant to be called from the locp-cassandra module. It sets variables according to platform. -### cassandra::schema +### `cassandra::schema` A class to maintain the database schema. Please note that cqlsh expects Python 2.7 to be installed. This may be a problem of older distributions (CentOS 6 for example). #### Parameters -The following parameters are available in the `cassandra::schema` class. - -##### `connection_tries` +The following parameters are available in the `cassandra::schema` class: + +* [`connection_tries`](#-cassandra--schema--connection_tries) +* [`connection_try_sleep`](#-cassandra--schema--connection_try_sleep) +* [`cql_types`](#-cassandra--schema--cql_types) +* [`cqlsh_additional_options`](#-cassandra--schema--cqlsh_additional_options) +* [`cqlsh_client_config`](#-cassandra--schema--cqlsh_client_config) +* [`cqlsh_client_tmpl`](#-cassandra--schema--cqlsh_client_tmpl) +* [`cqlsh_command`](#-cassandra--schema--cqlsh_command) +* [`cqlsh_host`](#-cassandra--schema--cqlsh_host) +* [`cqlsh_password`](#-cassandra--schema--cqlsh_password) +* [`cqlsh_port`](#-cassandra--schema--cqlsh_port) +* [`cqlsh_user`](#-cassandra--schema--cqlsh_user) +* [`indexes`](#-cassandra--schema--indexes) +* [`keyspaces`](#-cassandra--schema--keyspaces) +* [`permissions`](#-cassandra--schema--permissions) +* [`tables`](#-cassandra--schema--tables) +* [`users`](#-cassandra--schema--users) +* [`use_scl`](#-cassandra--schema--use_scl) +* [`scl_name`](#-cassandra--schema--scl_name) + +##### `connection_tries` Data type: `integer` How many times do try to connect to Cassandra. See also `connection_try_sleep`. -Default value: 6 +Default value: `6` -##### `connection_try_sleep` +##### `connection_try_sleep` Data type: `integer` How much time to allow between the number of tries specified in `connection_tries`. -Default value: 30 +Default value: `30` -##### `cql_types` +##### `cql_types` Data type: `hash` Creates new `cassandra::schema::cql_type` resources. -Default value: {} +Default value: `{}` -##### `cqlsh_additional_options` +##### `cqlsh_additional_options` Data type: `string` Any additional options to be passed to the `cqlsh` command. -Default value: '' +Default value: `''` -##### `cqlsh_client_config` +##### `cqlsh_client_config` Data type: `string` @@ -997,7 +1100,7 @@ is only available in Cassandra >= 2.1. Default value: `undef` -##### `cqlsh_client_tmpl` +##### `cqlsh_client_tmpl` Data type: `string` @@ -1005,26 +1108,26 @@ The location of the template for configuring the credentials for the cqlsh client. This is ignored unless `cqlsh_client_config` is set. -Default value: 'cassandra/cqlshrc.erb' +Default value: `'cassandra/cqlshrc.erb'` -##### `cqlsh_command` +##### `cqlsh_command` Data type: `string` The full path to the `cqlsh` command. -Default value: '/usr/bin/cqlsh' +Default value: `'/usr/bin/cqlsh'` -##### `cqlsh_host` +##### `cqlsh_host` Data type: `string` The host for the `cqlsh` command to connect to. See also `cqlsh_port`. -Default value: 'localhost' +Default value: `'localhost'` -##### `cqlsh_password` +##### `cqlsh_password` Data type: `string` @@ -1033,16 +1136,16 @@ specify the password here. See also `cqlsh_user`, `cqlsh_client_config`. Default value: `undef` -##### `cqlsh_port` +##### `cqlsh_port` Data type: `integer` The host for the `cqlsh` command to connect to. See also `cqlsh_host`. -Default value: 9042 +Default value: `9042` -##### `cqlsh_user` +##### `cqlsh_user` Data type: `string` @@ -1050,78 +1153,82 @@ If credentials are required for connecting, specify the password here. See also `cqlsh_password`, `cqlsh_client_config` -Default value: 'cassandra' +Default value: `'cassandra'` -##### `indexes` +##### `indexes` Data type: `hash` Creates new `cassandra::schema::index` resources. -Default value: {} +Default value: `{}` -##### `keyspaces` +##### `keyspaces` Data type: `hash` Creates new `cassandra::schema::keyspace` resources. -Default value: {} +Default value: `{}` -##### `permissions` +##### `permissions` Data type: `hash` Creates new `cassandra::schema::permission` resources. -Default value: {} +Default value: `{}` -##### `tables` +##### `tables` Data type: `hash` Creates new `cassandra::schema::table` resources. -Default value: {} +Default value: `{}` -##### `users` +##### `users` Data type: `hash` Creates new `cassandra::schema::user` resources. -Default value: {} +Default value: `{}` -##### `use_scl` +##### `use_scl` Data type: `Boolean` -Default value: $cassandra::params::use_scl +Default value: `$cassandra::params::use_scl` -##### `scl_name` +##### `scl_name` Data type: `String[1]` -Default value: $cassandra::params::scl_name +Default value: `$cassandra::params::scl_name` -### cassandra::system::swapoff +### `cassandra::system::swapoff` Disable swap on the node as suggested at http://docs.datastax.com/en/landing_page/doc/landing_page/recommendedSettingsLinux.html * **See also** -cassandra::params + * cassandra::params #### Parameters -The following parameters are available in the `cassandra::system::swapoff` class. +The following parameters are available in the `cassandra::system::swapoff` class: + +* [`device`](#-cassandra--system--swapoff--device) +* [`mount`](#-cassandra--system--swapoff--mount) +* [`path`](#-cassandra--system--swapoff--path) -##### `device` +##### `device` Data type: `string` @@ -1130,24 +1237,24 @@ ensure that the device is absent from /etc/fstab to permanently disable swap. Default value: `undef` -##### `mount` +##### `mount` Data type: `string` The name of the swap mount point. Ignored unless `device` has been set. -Default value: 'swap' +Default value: `'swap'` -##### `path` +##### `path` Data type: `string` The full path to the file to check if swap is enabled. -Default value: '/proc/swaps' +Default value: `'/proc/swaps'` -### cassandra::system::sysctl +### `cassandra::system::sysctl` Set Sysctl (kernel runtime parameters) as suggested in http://docs.datastax.com/en/landing_page/doc/landing_page/recommendedSettingsLinux.html @@ -1156,7 +1263,7 @@ If any of the values is set into the target file, the sysctl command will be called with the provided file name as an argument. * **See also** -cassandra::params + * cassandra::params #### Examples @@ -1168,115 +1275,128 @@ require cassandra::system::sysctl #### Parameters -The following parameters are available in the `cassandra::system::sysctl` class. +The following parameters are available in the `cassandra::system::sysctl` class: -##### `sysctl_args` +* [`sysctl_args`](#-cassandra--system--sysctl--sysctl_args) +* [`sysctl_file`](#-cassandra--system--sysctl--sysctl_file) +* [`net_core_optmem_max`](#-cassandra--system--sysctl--net_core_optmem_max) +* [`net_core_rmem_default`](#-cassandra--system--sysctl--net_core_rmem_default) +* [`net_core_rmem_max`](#-cassandra--system--sysctl--net_core_rmem_max) +* [`net_core_wmem_default`](#-cassandra--system--sysctl--net_core_wmem_default) +* [`net_core_wmem_max`](#-cassandra--system--sysctl--net_core_wmem_max) +* [`net_ipv4_tcp_rmem`](#-cassandra--system--sysctl--net_ipv4_tcp_rmem) +* [`net_ipv4_tcp_wmem`](#-cassandra--system--sysctl--net_ipv4_tcp_wmem) +* [`vm_max_map_count`](#-cassandra--system--sysctl--vm_max_map_count) + +##### `sysctl_args` Data type: `string` Passed to the `sysctl` command -Default value: '-p' +Default value: `'-p'` -##### `sysctl_file` +##### `sysctl_file` Data type: `string` Path to the file to insert the settings into. -Default value: $cassandra::params::sysctl_file +Default value: `$cassandra::params::sysctl_file` -##### `net_core_optmem_max` +##### `net_core_optmem_max` Data type: `integer` The value to set for net.core.optmem_max -Default value: 40960 +Default value: `40960` -##### `net_core_rmem_default` +##### `net_core_rmem_default` Data type: `integer` The value to set for net.core.rmem_default. -Default value: 16777216 +Default value: `16777216` -##### `net_core_rmem_max` +##### `net_core_rmem_max` Data type: `integer` The value to set for net_core_rmem_max. -Default value: 16777216 +Default value: `16777216` -##### `net_core_wmem_default` +##### `net_core_wmem_default` Data type: `integer` The value to set for net.core.wmem_default. -Default value: 16777216 +Default value: `16777216` -##### `net_core_wmem_max` +##### `net_core_wmem_max` Data type: `integer` The value to set for net.core.wmem_max. -Default value: 16777216 +Default value: `16777216` -##### `net_ipv4_tcp_rmem` +##### `net_ipv4_tcp_rmem` Data type: `string` The value to set for net.ipv4.tcp_rmem. -Default value: $cassandra::params::net_ipv4_tcp_rmem +Default value: `$cassandra::params::net_ipv4_tcp_rmem` -##### `net_ipv4_tcp_wmem` +##### `net_ipv4_tcp_wmem` Data type: `string` The value to set for net.ipv4.tcp_wmem. -Default value: $cassandra::params::net_ipv4_tcp_wmem +Default value: `$cassandra::params::net_ipv4_tcp_wmem` -##### `vm_max_map_count` +##### `vm_max_map_count` Data type: `integer` The value to set for vm.max_map_count. -Default value: 1048575 +Default value: `1048575` -### cassandra::system::transparent_hugepage +### `cassandra::system::transparent_hugepage` Disable Transparant Huge Pages as suggested in http://docs.datastax.com/en/landing_page/doc/landing_page/recommendedSettingsLinux.html. * **See also** -cassandra::params + * cassandra::params #### Parameters -The following parameters are available in the `cassandra::system::transparent_hugepage` class. +The following parameters are available in the `cassandra::system::transparent_hugepage` class: + +* [`path`](#-cassandra--system--transparent_hugepage--path) -##### `path` +##### `path` Data type: `string` The full path to the file for checking/setting if Transparent Hugepages is enabled. -Default value: '/sys/kernel/mm/transparent_hugepage/defrag' +Default value: `'/sys/kernel/mm/transparent_hugepage/defrag'` ## Defined types -### cassandra::file +### `cassandra::file` A defined type for altering files relative to the configuration directory. @@ -1335,25 +1455,30 @@ cassandra::file { 'Set java.io.tmpdir': #### Parameters -The following parameters are available in the `cassandra::file` defined type. +The following parameters are available in the `cassandra::file` defined type: + +* [`file`](#-cassandra--file--file) +* [`config_path`](#-cassandra--file--config_path) +* [`file_lines`](#-cassandra--file--file_lines) +* [`service_refresh`](#-cassandra--file--service_refresh) -##### `file` +##### `file` Data type: `string` The name of the file relative to the `config_path`. -Default value: $title +Default value: `$title` -##### `config_path` +##### `config_path` Data type: `string` The path to the configuration directory. -Default value: $cassandra::config_path +Default value: `$cassandra::config_path` -##### `file_lines` +##### `file_lines` Data type: `string` @@ -1364,7 +1489,7 @@ will be used to create an array of [file_line] Default value: `undef` -##### `service_refresh` +##### `service_refresh` Data type: `boolean` @@ -1373,7 +1498,7 @@ if the environment file is changed. Default value: `true` -### cassandra::private::firewall_ports::rule +### `cassandra::private::firewall_ports::rule` A defined type to be used as a macro for setting host based firewall rules. This is not intended to be used by a user (who should use the @@ -1382,15 +1507,17 @@ here for completeness. #### Parameters -The following parameters are available in the `cassandra::private::firewall_ports::rule` defined type. +The following parameters are available in the `cassandra::private::firewall_ports::rule` defined type: -##### `ports` +* [`ports`](#-cassandra--private--firewall_ports--rule--ports) + +##### `ports` Data type: `integer` The number(s) of the port(s) to be opened. -### cassandra::schema::cql_type +### `cassandra::schema::cql_type` Create or drop user defined data types within the schema. @@ -1410,71 +1537,88 @@ cassandra::schema::cql_type { 'fullname': #### Parameters -The following parameters are available in the `cassandra::schema::cql_type` defined type. +The following parameters are available in the `cassandra::schema::cql_type` defined type: + +* [`keyspace`](#-cassandra--schema--cql_type--keyspace) +* [`ensure`](#-cassandra--schema--cql_type--ensure) +* [`fields`](#-cassandra--schema--cql_type--fields) +* [`cql_type_name`](#-cassandra--schema--cql_type--cql_type_name) +* [`use_scl`](#-cassandra--schema--cql_type--use_scl) +* [`scl_name`](#-cassandra--schema--cql_type--scl_name) -##### `keyspace` +##### `keyspace` Data type: `string` The name of the keyspace that the data type is to be associated with. -##### `ensure` +##### `ensure` Data type: `present|absent` ensure the data type is created, or is dropped. -Default value: present +Default value: `present` -##### `fields` +##### `fields` Data type: `hash` A hash of the fields that will be components for the data type. -Default value: {} +Default value: `{}` -##### `cql_type_name` +##### `cql_type_name` Data type: `string` The name of the CQL type to be created. -Default value: $title +Default value: `$title` -##### `use_scl` +##### `use_scl` Data type: `Boolean` -Default value: $cassandra::params::use_scl +Default value: `$cassandra::params::use_scl` -##### `scl_name` +##### `scl_name` Data type: `String[1]` -Default value: $cassandra::params::scl_name +Default value: `$cassandra::params::scl_name` -### cassandra::schema::index +### `cassandra::schema::index` Create or drop indexes within the schema. #### Parameters -The following parameters are available in the `cassandra::schema::index` defined type. +The following parameters are available in the `cassandra::schema::index` defined type: -##### `ensure` +* [`ensure`](#-cassandra--schema--index--ensure) +* [`class_name`](#-cassandra--schema--index--class_name) +* [`index`](#-cassandra--schema--index--index) +* [`keys`](#-cassandra--schema--index--keys) +* [`keyspace`](#-cassandra--schema--index--keyspace) +* [`options`](#-cassandra--schema--index--options) +* [`table`](#-cassandra--schema--index--table) +* [`use_scl`](#-cassandra--schema--index--use_scl) +* [`scl_name`](#-cassandra--schema--index--scl_name) + +##### `ensure` Data type: `present|absent` Create or dro[ the index. -Default value: present +Default value: `present` -##### `class_name` +##### `class_name` Data type: `string` @@ -1483,16 +1627,16 @@ index when creating a custom index. Default value: `undef` -##### `index` +##### `index` Data type: `string` The name of the index. Defaults to the name of the resource. -Default value: $title +Default value: `$title` -##### `keys` +##### `keys` Data type: `string` @@ -1500,14 +1644,14 @@ The columns that the index is being created on. Default value: `undef` -##### `keyspace` +##### `keyspace` Data type: `string` The name the keyspace that the index is to be associated with. -##### `options` +##### `options` Data type: `string` @@ -1515,29 +1659,29 @@ Any options to be added to the index. Default value: `undef` -##### `table` +##### `table` Data type: `string` The name of the table that the index is to be associated with. -##### `use_scl` +##### `use_scl` Data type: `Boolean` -Default value: $cassandra::params::use_scl +Default value: `$cassandra::params::use_scl` -##### `scl_name` +##### `scl_name` Data type: `String[1]` -Default value: $cassandra::params::scl_name +Default value: `$cassandra::params::scl_name` -### cassandra::schema::keyspace +### `cassandra::schema::keyspace` Create or drop keyspaces within the schema. @@ -1567,17 +1711,24 @@ cassandra::schema::keyspace { 'mykeyspace': #### Parameters -The following parameters are available in the `cassandra::schema::keyspace` defined type. +The following parameters are available in the `cassandra::schema::keyspace` defined type: + +* [`ensure`](#-cassandra--schema--keyspace--ensure) +* [`durable_writes`](#-cassandra--schema--keyspace--durable_writes) +* [`keyspace_name`](#-cassandra--schema--keyspace--keyspace_name) +* [`replication_map`](#-cassandra--schema--keyspace--replication_map) +* [`use_scl`](#-cassandra--schema--keyspace--use_scl) +* [`scl_name`](#-cassandra--schema--keyspace--scl_name) -##### `ensure` +##### `ensure` Data type: `present|absent` Create or drop the keyspace. -Default value: present +Default value: `present` -##### `durable_writes` +##### `durable_writes` Data type: `boolean` @@ -1588,40 +1739,40 @@ using the SimpleStrategy. Default value: `true` -##### `keyspace_name` +##### `keyspace_name` Data type: `string` The name of the keyspace to be created. -Default value: $title +Default value: `$title` -##### `replication_map` +##### `replication_map` Data type: `hash` Needed if the keyspace is to be present. Optional if it is to be absent. -Default value: {} +Default value: `{}` -##### `use_scl` +##### `use_scl` Data type: `Boolean` -Default value: $cassandra::params::use_scl +Default value: `$cassandra::params::use_scl` -##### `scl_name` +##### `scl_name` Data type: `String[1]` -Default value: $cassandra::params::scl_name +Default value: `$cassandra::params::scl_name` -### cassandra::schema::permission +### `cassandra::schema::permission` Grant or revoke permissions. To use this class, a suitable `authenticator` (e.g. PasswordAuthenticator) @@ -1633,25 +1784,33 @@ time is not currently supported by this module. #### Parameters -The following parameters are available in the `cassandra::schema::permission` defined type. +The following parameters are available in the `cassandra::schema::permission` defined type: + +* [`user_name`](#-cassandra--schema--permission--user_name) +* [`ensure`](#-cassandra--schema--permission--ensure) +* [`keyspace_name`](#-cassandra--schema--permission--keyspace_name) +* [`permission_name`](#-cassandra--schema--permission--permission_name) +* [`table_name`](#-cassandra--schema--permission--table_name) +* [`use_scl`](#-cassandra--schema--permission--use_scl) +* [`scl_name`](#-cassandra--schema--permission--scl_name) -##### `user_name` +##### `user_name` Data type: `string` The name of the user who is to be granted or revoked. -##### `ensure` +##### `ensure` Data type: `present | absent` Set to present to grant a permission or absent to revoke it. -Default value: present +Default value: `present` -##### `keyspace_name` +##### `keyspace_name` Data type: `string` @@ -1659,9 +1818,9 @@ The name of the keyspace to grant/revoke the permissions on. If set to 'ALL' then the permission will be applied to all of the keyspaces. -Default value: 'ALL' +Default value: `'ALL'` -##### `permission_name` +##### `permission_name` Data type: `string` @@ -1677,9 +1836,9 @@ Can be one of the following: If the permission_name is set to 'ALL', this will set all of the specific permissions listed. -Default value: 'ALL' +Default value: `'ALL'` -##### `table_name` +##### `table_name` Data type: `string` @@ -1689,23 +1848,23 @@ tables within the keyspace. Default value: `undef` -##### `use_scl` +##### `use_scl` Data type: `Boolean` -Default value: $cassandra::params::use_scl +Default value: `$cassandra::params::use_scl` -##### `scl_name` +##### `scl_name` Data type: `String[1]` -Default value: $cassandra::params::scl_name +Default value: `$cassandra::params::scl_name` -### cassandra::schema::table +### `cassandra::schema::table` Create or drop tables within the schema. @@ -1727,65 +1886,73 @@ cassandra::schema::table { 'users': #### Parameters -The following parameters are available in the `cassandra::schema::table` defined type. +The following parameters are available in the `cassandra::schema::table` defined type: -##### `keyspace` +* [`keyspace`](#-cassandra--schema--table--keyspace) +* [`columns`](#-cassandra--schema--table--columns) +* [`ensure`](#-cassandra--schema--table--ensure) +* [`options`](#-cassandra--schema--table--options) +* [`table`](#-cassandra--schema--table--table) +* [`use_scl`](#-cassandra--schema--table--use_scl) +* [`scl_name`](#-cassandra--schema--table--scl_name) + +##### `keyspace` Data type: `string` The name of the keyspace. -##### `columns` +##### `columns` Data type: `hash` A hash of the columns to be placed in the table. Optional if the table is to be absent. -Default value: {} +Default value: `{}` -##### `ensure` +##### `ensure` Data type: `present|absent` Ensure a keyspace is created or dropped. -Default value: present +Default value: `present` -##### `options` +##### `options` Data type: `array` Options to be added to the table creation. -Default value: [] +Default value: `[]` -##### `table` +##### `table` Data type: `string` The name of the table. Defaults to the name of the resource. -Default value: $title +Default value: `$title` -##### `use_scl` +##### `use_scl` Data type: `Boolean` -Default value: $cassandra::params::use_scl +Default value: `$cassandra::params::use_scl` -##### `scl_name` +##### `scl_name` Data type: `String[1]` -Default value: $cassandra::params::scl_name +Default value: `$cassandra::params::scl_name` -### cassandra::schema::user +### `cassandra::schema::user` Create or drop users. To use this class, a suitable `authenticator` (e.g. PasswordAuthenticator) @@ -1808,18 +1975,26 @@ cassandra::schema::user { 'lucan': #### Parameters -The following parameters are available in the `cassandra::schema::user` defined type. +The following parameters are available in the `cassandra::schema::user` defined type: + +* [`ensure`](#-cassandra--schema--user--ensure) +* [`password`](#-cassandra--schema--user--password) +* [`superuser`](#-cassandra--schema--user--superuser) +* [`login`](#-cassandra--schema--user--login) +* [`user_name`](#-cassandra--schema--user--user_name) +* [`use_scl`](#-cassandra--schema--user--use_scl) +* [`scl_name`](#-cassandra--schema--user--scl_name) -##### `ensure` +##### `ensure` Data type: `present | absent` Valid values can be **present** to ensure a user is created, or **absent** to remove the user if it exists. -Default value: present +Default value: `present` -##### `password` +##### `password` Data type: `string` @@ -1827,7 +2002,7 @@ A password for the user. Default value: `undef` -##### `superuser` +##### `superuser` Data type: `boolean` @@ -1835,7 +2010,7 @@ If the user is to be a super-user on the system. Default value: `false` -##### `login` +##### `login` Data type: `boolean` @@ -1843,27 +2018,27 @@ Allows the role to log in. Default value: `true` -##### `user_name` +##### `user_name` Data type: `string` The name of the user. -Default value: $title +Default value: `$title` -##### `use_scl` +##### `use_scl` Data type: `Boolean` -Default value: $cassandra::params::use_scl +Default value: `$cassandra::params::use_scl` -##### `scl_name` +##### `scl_name` Data type: `String[1]` -Default value: $cassandra::params::scl_name +Default value: `$cassandra::params::scl_name` From 8e1907b01629fc3029c0ce5e52d371663134e037 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Fri, 9 Feb 2024 12:11:29 +0100 Subject: [PATCH 20/27] namespace create_ini_settings --- manifests/datastax_agent.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/datastax_agent.pp b/manifests/datastax_agent.pp index cdfa3833..c01be46c 100644 --- a/manifests/datastax_agent.pp +++ b/manifests/datastax_agent.pp @@ -115,6 +115,6 @@ $full_settings = { '' => $settings, } - create_ini_settings($full_settings, $defaults) + inifile::create_ini_settings($full_settings, $defaults) } } From c72408f0a4e4f8daaaa93834c0e6f91c4f572401 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 12 Apr 2024 13:10:37 +0200 Subject: [PATCH 21/27] modulesync 7.4.0 --- .github/CONTRIBUTING.md | 16 +++++++++++++--- .gitignore | 2 ++ .msync.yml | 2 +- Dockerfile | 24 ------------------------ 4 files changed, 16 insertions(+), 28 deletions(-) delete mode 100644 Dockerfile diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 6aaa603f..88093274 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -131,19 +131,29 @@ 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)" +bundle config set --local path '.vendor/' +bundle config set --local without 'development system_tests release' +bundle install --jobs "$(nproc)" ``` If you also want to run acceptance tests: ```sh -bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)" +bundle config set --local path '.vendor/' +bundle config set --local without 'development release' +bundle config set --local with 'system_tests' +bundle install --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 +bundle config set --local path '.vendor/' +bundle config set --local without 'development release' +bundle config set --local with 'system_tests' +bundle install --jobs "$(nproc)" +bundle update +bundle clean ``` As an alternative to the `--jobs "$(nproc)` parameter, you can set an diff --git a/.gitignore b/.gitignore index 84fd904c..adea1b01 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,5 @@ .*.sw? /.yardoc/ /Guardfile +bolt-debug.log +.rerun.json diff --git a/.msync.yml b/.msync.yml index f46ee025..28b61dcf 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.3.0' +modulesync_config_version: '7.4.0' diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 8dd82d63..00000000 --- a/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -# 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_GEM_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 From 27b369927b9de5640a1a40e6bbaa218fa75b762e Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 25 Apr 2024 17:10:11 +0200 Subject: [PATCH 22/27] modulesync 7.5.0 --- .msync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.msync.yml b/.msync.yml index 28b61dcf..ade23f9e 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.4.0' +modulesync_config_version: '7.5.0' From c6a60a64155392f6d445246fa9283bb406e6d6fc Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 3 Jun 2024 18:32:17 +0200 Subject: [PATCH 23/27] modulesync 8.0.1 --- .github/workflows/ci.yml | 2 -- .msync.yml | 2 +- .overcommit.yml | 8 +++++--- .rspec | 5 ----- .rspec_parallel | 4 ---- Gemfile | 4 ++-- 6 files changed, 8 insertions(+), 17 deletions(-) delete mode 100644 .rspec delete mode 100644 .rspec_parallel diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7216724f..1f82c4c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,5 +19,3 @@ jobs: puppet: name: Puppet uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2 - with: - pidfile_workaround: 'false' diff --git a/.msync.yml b/.msync.yml index ade23f9e..876cb3b0 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.5.0' +modulesync_config_version: '8.0.1' diff --git a/.overcommit.yml b/.overcommit.yml index d367adae..4ed994cc 100644 --- a/.overcommit.yml +++ b/.overcommit.yml @@ -43,10 +43,12 @@ PreCommit: enabled: true description: 'Runs rubocop on modified files only' command: ['bundle', 'exec', 'rubocop'] - PuppetLint: + RakeTarget: enabled: true - description: 'Runs puppet-lint on modified files only' - command: ['bundle', 'exec', 'puppet-lint'] + description: 'Runs lint on modified files only' + targets: + - 'lint' + command: ['bundle', 'exec', 'rake'] YamlSyntax: enabled: true JsonSyntax: diff --git a/.rspec b/.rspec deleted file mode 100644 index f634583d..00000000 --- a/.rspec +++ /dev/null @@ -1,5 +0,0 @@ -# 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 deleted file mode 100644 index a9a84f85..00000000 --- a/.rspec_parallel +++ /dev/null @@ -1,4 +0,0 @@ -# Managed by modulesync - DO NOT EDIT -# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ - ---format progress diff --git a/Gemfile b/Gemfile index a4a3b204..ec7b4cd3 100644 --- a/Gemfile +++ b/Gemfile @@ -4,10 +4,10 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 7.0', :require => false + gem 'voxpupuli-test', '~> 7.2', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 3.5', :require => false + gem 'puppet_metadata', '~> 4.0', :require => false end group :development do From 22ea4c832493cfef5a057ecf675f3d0b99c49e43 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 12 Jun 2024 11:12:03 +0200 Subject: [PATCH 24/27] modulesync 9.0.0 --- .github/labeler.yml | 3 +++ .msync.yml | 2 +- Gemfile | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .github/labeler.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000..7899de84 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,3 @@ +--- +skip-changelog: + - head-branch: ['^release-*', 'release'] diff --git a/.msync.yml b/.msync.yml index 876cb3b0..36071685 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: '8.0.1' +modulesync_config_version: '9.0.0' diff --git a/Gemfile b/Gemfile index ec7b4cd3..27cdc0de 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 7.2', :require => false + gem 'voxpupuli-test', '~> 8.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 4.0', :require => false From 38cfb12410807084f8fdfbf3ac93c3c5a10db689 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 9 Jul 2024 14:48:58 +0200 Subject: [PATCH 25/27] modulesync 9.1.0 --- .github/CONTRIBUTING.md | 12 ++++++++-- .github/labeler.yml | 3 +++ .github/release.yml | 42 +++++++++++++++++++++++++++++++++++ .github/workflows/labeler.yml | 17 ++++++++++++++ .github/workflows/release.yml | 7 ++++++ .msync.yml | 2 +- .puppet-lint.rc | 3 +++ .sync.yml | 2 -- Gemfile | 2 +- spec/spec_helper.rb | 9 ++++---- 10 files changed, 89 insertions(+), 10 deletions(-) create mode 100644 .github/release.yml create mode 100644 .github/workflows/labeler.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 88093274..daceb642 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -245,15 +245,23 @@ with: BEAKER_PUPPET_COLLECTION=puppet7 BEAKER_setfile=debian11-64 bundle exec rake beaker ``` +or + +```sh +BEAKER_PUPPET_COLLECTION=none BEAKER_setfile=archlinux-64 bundle exec rake beaker +``` + +This latter example will use the distribution's own version of Puppet. + You can replace the string `debian11` with any common operating system. The following strings are known to work: * ubuntu2004 * ubuntu2204 * debian11 -* centos7 -* centos8 +* debian12 * centos9 +* archlinux * almalinux8 * almalinux9 * fedora36 diff --git a/.github/labeler.yml b/.github/labeler.yml index 7899de84..f2d08d6b 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,3 +1,6 @@ --- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + skip-changelog: - head-branch: ['^release-*', 'release'] diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 00000000..f5b5d7a9 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,42 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes + +changelog: + exclude: + labels: + - duplicate + - invalid + - modulesync + - question + - skip-changelog + - wont-fix + - wontfix + + categories: + - title: Breaking Changes 🛠 + labels: + - backwards-incompatible + + - title: New Features 🎉 + labels: + - enhancement + + - title: Bug Fixes 🐛 + labels: + - bug + + - title: Documentation Updates 📚 + labels: + - documentation + - docs + + - title: Dependency Updates ⬆️ + labels: + - dependencies + + - title: Other Changes + labels: + - "*" diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 00000000..66127cd0 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,17 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: "Pull Request Labeler" + +on: + pull_request_target: {} + +jobs: + labeler: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 55324aa6..93b33c2b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,3 +20,10 @@ jobs: # https://docs.github.com/en/actions/security-guides/encrypted-secrets username: ${{ secrets.PUPPET_FORGE_USERNAME }} api_key: ${{ secrets.PUPPET_FORGE_API_KEY }} + + create-github-release: + name: Create GitHub Release + runs-on: ubuntu-latest + steps: + - name: Create GitHub release + uses: voxpupuli/gha-create-a-github-release@v1 diff --git a/.msync.yml b/.msync.yml index 36071685..95e8c977 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: '9.0.0' +modulesync_config_version: '9.1.0' diff --git a/.puppet-lint.rc b/.puppet-lint.rc index dd8272c7..05d28a26 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1,3 +1,6 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + --fail-on-warnings --no-parameter_documentation-check --no-parameter_types-check diff --git a/.sync.yml b/.sync.yml index fb6de51b..58037a1a 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,5 +1,3 @@ --- -.travis.yml: - secure: "I/IK9bG88UOVll0hpuxluGp6IY5gicLaDHug/jGwfuWlN4R3coPAqWO/sGOyaEMbc9V5/Fw0H0ThQdYY3eI3rW5M4a1r9TSg/Z9d46JximPat/XvcpLvUc0G+QxCVhTRmYqD7u0wuX5VSric0PQU6KSjH84ZbKgAA8l04NGObgUI6ugjaNBhkaoIP3glYcHY1fgn5vwER2T/iiXZ5q3qDtYboR2GWLUODLWSpXWZRy7oYvp/RGTSe1fKjDwkbtrZiFvRoyzQvDhEAr+0MFDxJiOLdoKJFeBs6BrF2lyUJ6udlOmEYV94DfKoxEhhlZbxkPCh4SedT79i3c3xkKlf9wfAsEyGSTfc9OtyYBfoHcE9GMRZIvLf2Jn2mpHMO2694Fil4d7JdhLYQ/9Gv9VgFrYosQdVlDh+RxE2CXzrO39LhA1GeOY/n1r+DdvuCJs1fZfBZ1ORb7eQNp1BknurJ8FoYCKlEgihS223IJEnGueDdYkchMSRjS6C3a/HIzBz0RvEDGXD3WgrY5edRIaGziSoSr5eXzumK7N1FFBlpfY/7j38zI1ibWN4PRakmZppeeWOb1xiuVS5JkngCLoYerxLJEEjt8+klXhwnqqJukFuObaVsyprSWp+aAu/UHD/4w/6/lC6Elv+VzccLpITOR5b7VdAuCttQ5PGse6fits=" spec/spec_helper.rb: mock_with: ':mocha' diff --git a/Gemfile b/Gemfile index 27cdc0de..7123c663 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 8.0', :require => false + gem 'voxpupuli-test', '~> 9.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 4.0', :require => false diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3b8712f9..3226b22d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -3,16 +3,17 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -RSpec.configure do |c| - c.mock_with :mocha -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__)) require 'voxpupuli/test/spec_helper' +RSpec.configure do |c| + c.facterdb_string_keys = false + c.mock_with :mocha +end + add_mocked_facts! if File.exist?(File.join(__dir__, 'default_module_facts.yml')) From 1aade9eaa43b42cdc1762dbaff53b48ccb9db53f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 13 Sep 2024 13:54:55 +0200 Subject: [PATCH 26/27] modulesync 9.2.0 --- .github/workflows/ci.yml | 3 ++- .github/workflows/labeler.yml | 1 + .github/workflows/release.yml | 1 + .msync.yml | 2 +- .pmtignore | 1 + Gemfile | 2 +- 6 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f82c4c9..8c32acf9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,7 @@ name: CI +# yamllint disable-line rule:truthy on: pull_request: {} push: @@ -18,4 +19,4 @@ concurrency: jobs: puppet: name: Puppet - uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2 + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v3 diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 66127cd0..73be88dc 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -4,6 +4,7 @@ name: "Pull Request Labeler" +# yamllint disable-line rule:truthy on: pull_request_target: {} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 93b33c2b..1b147750 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,7 @@ name: Release +# yamllint disable-line rule:truthy on: push: tags: diff --git a/.msync.yml b/.msync.yml index 95e8c977..8606f6ec 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: '9.1.0' +modulesync_config_version: '9.2.0' diff --git a/.pmtignore b/.pmtignore index 10b98306..a9d37aa0 100644 --- a/.pmtignore +++ b/.pmtignore @@ -20,6 +20,7 @@ /.github/ /.librarian/ /Puppetfile.lock +/Puppetfile *.iml /.editorconfig /.fixtures.yml diff --git a/Gemfile b/Gemfile index 7123c663..2ac98f89 100644 --- a/Gemfile +++ b/Gemfile @@ -26,7 +26,7 @@ end gem 'rake', :require => false gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_GEM_VERSION'] || '~> 7.24' +puppetversion = ENV['PUPPET_GEM_VERSION'] || [">= 7.24", "< 9"] gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby From 29d95224e479082de666204273e19920b733bba9 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 16 Sep 2024 20:18:44 +0200 Subject: [PATCH 27/27] modulesync 9.3.0 --- .github/workflows/release.yml | 2 +- .msync.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1b147750..4adf65cd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ on: jobs: release: name: Release - uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v2 + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v3 with: allowed_owner: 'voxpupuli' secrets: diff --git a/.msync.yml b/.msync.yml index 8606f6ec..ac84b45d 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: '9.2.0' +modulesync_config_version: '9.3.0'