From 4e7f05be9e73d30a338365e3e826e582eef610b5 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 15 Dec 2021 19:59:34 +0100 Subject: [PATCH 01/39] modulesync 5.1.0 --- .github/CONTRIBUTING.md | 7 ++- .github/workflows/ci.yml | 84 +++-------------------------------- .github/workflows/release.yml | 32 +++++-------- .msync.yml | 2 +- .puppet-lint.rc | 3 ++ .rubocop.yml | 1 + Dockerfile | 2 +- Gemfile | 8 ++-- Rakefile | 4 +- spec/spec_helper.rb | 12 ++--- 10 files changed, 38 insertions(+), 117 deletions(-) create mode 100644 .puppet-lint.rc 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 43966c2f..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: '4.2.0' +modulesync_config_version: '5.3.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/.rubocop.yml b/.rubocop.yml index 53ac1898..fded90cf 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,5 +2,6 @@ # 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/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 a39114ce..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', '~> 2.5', :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 @@ -21,14 +21,14 @@ 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 gem 'rake', :require => false gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_VERSION'] || '>= 6.0' +puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby diff --git a/Rakefile b/Rakefile index 80b799d6..962ad7e8 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' @@ -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-corosync' 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 50265422..d7b05f8f 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,16 +9,16 @@ # 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' +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'))) - 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 c9adeadc27cabddea35fd84e7d31b92113077f9b Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 17 Jan 2022 10:17:25 +0100 Subject: [PATCH 02/39] rubocop: safe autofix --- lib/puppet/provider/cs_clone/crm.rb | 45 +++++----- lib/puppet/provider/cs_clone/pcs.rb | 39 ++++----- lib/puppet/provider/cs_colocation/crm.rb | 21 ++--- lib/puppet/provider/cs_colocation/pcs.rb | 39 +++++---- lib/puppet/provider/cs_commit/crm.rb | 1 + lib/puppet/provider/cs_commit/pcs.rb | 1 + lib/puppet/provider/cs_group/crm.rb | 11 +-- lib/puppet/provider/cs_group/pcs.rb | 17 ++-- lib/puppet/provider/cs_location/crm.rb | 41 ++++------ lib/puppet/provider/cs_location/pcs.rb | 29 +++---- lib/puppet/provider/cs_order/crm.rb | 35 ++++---- lib/puppet/provider/cs_order/pcs.rb | 35 ++++---- lib/puppet/provider/cs_primitive/crm.rb | 37 ++++----- lib/puppet/provider/cs_primitive/pcs.rb | 55 ++++++------- lib/puppet/provider/cs_property/crm.rb | 13 +-- lib/puppet/provider/cs_property/pcs.rb | 15 ++-- lib/puppet/provider/cs_rsc_defaults/crm.rb | 11 +-- lib/puppet/provider/cs_rsc_defaults/pcs.rb | 14 ++-- lib/puppet/provider/cs_shadow/crm.rb | 1 + lib/puppet/provider/cs_shadow/pcs.rb | 1 + lib/puppet/type/cs_clone.rb | 3 +- lib/puppet/type/cs_colocation.rb | 7 +- lib/puppet/type/cs_location.rb | 6 +- lib/puppet/type/cs_order.rb | 3 +- lib/puppet/type/cs_primitive.rb | 1 + lib/puppet/type/cs_shadow.rb | 1 + .../voxpupuli/corosync/provider/cib_helper.rb | 18 ++-- .../voxpupuli/corosync/provider/crmsh.rb | 6 +- .../voxpupuli/corosync/provider/pcs.rb | 6 +- spec/acceptance/cs_clone_spec.rb | 18 ++-- spec/acceptance/cs_colocation_spec.rb | 8 +- spec/acceptance/cs_commit_spec.rb | 8 +- spec/acceptance/cs_group_spec.rb | 8 +- spec/acceptance/cs_location_spec.rb | 8 +- spec/acceptance/cs_order_spec.rb | 8 +- spec/acceptance/cs_primitive_spec.rb | 8 +- spec/acceptance/cs_shadow_spec.rb | 10 +-- spec/classes/corosync_spec.rb | 46 ++++++----- spec/spec_helper_acceptance.rb | 4 +- .../unit/puppet/provider/cs_clone_crm_spec.rb | 14 ++-- .../unit/puppet/provider/cs_clone_pcs_spec.rb | 32 ++++---- .../puppet/provider/cs_colocation_crm_spec.rb | 22 ++--- .../unit/puppet/provider/cs_group_crm_spec.rb | 2 +- .../unit/puppet/provider/cs_group_pcs_spec.rb | 2 +- .../puppet/provider/cs_location_pcs_spec.rb | 2 +- .../unit/puppet/provider/cs_order_crm_spec.rb | 3 +- .../unit/puppet/provider/cs_order_pcs_spec.rb | 3 +- .../puppet/provider/cs_primitive_crm_spec.rb | 8 +- .../puppet/provider/cs_primitive_pcs_spec.rb | 82 +++++++++---------- spec/unit/puppet/type/cs_clone_spec.rb | 24 +++--- spec/unit/puppet/type/cs_group_spec.rb | 11 +-- spec/unit/puppet/type/cs_location_spec.rb | 15 ++-- spec/unit/puppet/type/cs_primitive_spec.rb | 24 +++--- spec/unit/puppet/type/cs_property_spec.rb | 8 +- 54 files changed, 442 insertions(+), 448 deletions(-) diff --git a/lib/puppet/provider/cs_clone/crm.rb b/lib/puppet/provider/cs_clone/crm.rb index 253f6a05..0d0df456 100644 --- a/lib/puppet/provider/cs_clone/crm.rb +++ b/lib/puppet/provider/cs_clone/crm.rb @@ -4,6 +4,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/crmsh' end @@ -30,24 +31,20 @@ def self.instances items = nvpairs_to_hash(e.elements['meta_attributes']) clone_instance = { - name: e.attributes['id'], - ensure: :present, - clone_max: items['clone-max'], - clone_node_max: items['clone-node-max'], - notify_clones: items['notify'], - globally_unique: items['globally-unique'], - ordered: items['ordered'], - interleave: items['interleave'], + name: e.attributes['id'], + ensure: :present, + clone_max: items['clone-max'], + clone_node_max: items['clone-node-max'], + notify_clones: items['notify'], + globally_unique: items['globally-unique'], + ordered: items['ordered'], + interleave: items['interleave'], existing_resource: :true } - if e.elements['primitive'] - clone_instance[:primitive] = e.elements['primitive'].attributes['id'] - end + clone_instance[:primitive] = e.elements['primitive'].attributes['id'] if e.elements['primitive'] - if e.elements['group'] - clone_instance[:group] = e.elements['group'].attributes['id'] - end + clone_instance[:group] = e.elements['group'].attributes['id'] if e.elements['group'] instances << new(clone_instance) end instances @@ -57,16 +54,16 @@ def self.instances # of actually doing the work. def create @property_hash = { - name: @resource[:name], - ensure: :present, - primitive: @resource[:primitive], - clone_max: @resource[:clone_max], - clone_node_max: @resource[:clone_node_max], - notify_clones: @resource[:notify_clones], - globally_unique: @resource[:globally_unique], - ordered: @resource[:ordered], - interleave: @resource[:interleave], - cib: @resource[:cib], + name: @resource[:name], + ensure: :present, + primitive: @resource[:primitive], + clone_max: @resource[:clone_max], + clone_node_max: @resource[:clone_node_max], + notify_clones: @resource[:notify_clones], + globally_unique: @resource[:globally_unique], + ordered: @resource[:ordered], + interleave: @resource[:interleave], + cib: @resource[:cib], existing_resource: :false } end diff --git a/lib/puppet/provider/cs_clone/pcs.rb b/lib/puppet/provider/cs_clone/pcs.rb index d1a94b75..a0175859 100644 --- a/lib/puppet/provider/cs_clone/pcs.rb +++ b/lib/puppet/provider/cs_clone/pcs.rb @@ -4,6 +4,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/pcs' end @@ -15,7 +16,7 @@ mk_resource_methods - defaultfor operatingsystem: [:fedora, :centos, :redhat] + defaultfor operatingsystem: %i[fedora centos redhat] def change_clone_id(type, primitive, id, cib) xpath = "/cib/configuration/resources/clone[descendant::#{type}[@id='#{primitive}']]" @@ -42,14 +43,14 @@ def self.instances items = nvpairs_to_hash(e.elements['meta_attributes']) clone_instance = { - name: e.attributes['id'], - ensure: :present, - clone_max: items['clone-max'], - clone_node_max: items['clone-node-max'], - notify_clones: items['notify'], - globally_unique: items['globally-unique'], - ordered: items['ordered'], - interleave: items['interleave'] + name: e.attributes['id'], + ensure: :present, + clone_max: items['clone-max'], + clone_node_max: items['clone-node-max'], + notify_clones: items['notify'], + globally_unique: items['globally-unique'], + ordered: items['ordered'], + interleave: items['interleave'] } if e.elements['primitive'] @@ -73,16 +74,16 @@ def self.instances # of actually doing the work. def create @property_hash = { - name: @resource[:name], - ensure: :present, - primitive: @resource[:primitive], - group: @resource[:group], - clone_max: @resource[:clone_max], - clone_node_max: @resource[:clone_node_max], - notify_clones: @resource[:notify_clones], - globally_unique: @resource[:globally_unique], - ordered: @resource[:ordered], - interleave: @resource[:interleave] + name: @resource[:name], + ensure: :present, + primitive: @resource[:primitive], + group: @resource[:group], + clone_max: @resource[:clone_max], + clone_node_max: @resource[:clone_node_max], + notify_clones: @resource[:notify_clones], + globally_unique: @resource[:globally_unique], + ordered: @resource[:ordered], + interleave: @resource[:interleave] } end diff --git a/lib/puppet/provider/cs_colocation/crm.rb b/lib/puppet/provider/cs_colocation/crm.rb index d347e0b4..2b4c8b4a 100644 --- a/lib/puppet/provider/cs_colocation/crm.rb +++ b/lib/puppet/provider/cs_colocation/crm.rb @@ -4,6 +4,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/crmsh' end @@ -39,7 +40,7 @@ def self.instances items['rsc'] end - with_rsc = if items ['with-rsc-role'] + with_rsc = if items['with-rsc-role'] "#{items['with-rsc']}:#{items['with-rsc-role']}" else items['with-rsc'] @@ -58,7 +59,7 @@ def self.instances rsetitems = rset.attributes # If the resource set has a role, it will apply to all referenced resources. - rsetrole = (rsetitems['role'] if rsetitems['role']) + rsetrole = (rsetitems['role']) # Add all referenced resources to the primitives array. rset.each_element('resource_ref') do |rref| @@ -77,11 +78,11 @@ def self.instances end colocation_instance = { - name: items['id'], - ensure: :present, + name: items['id'], + ensure: :present, primitives: primitives, - score: items['score'], - provider: name + score: items['score'], + provider: name } instances << new(colocation_instance) end @@ -92,11 +93,11 @@ def self.instances # of actually doing the work. def create @property_hash = { - name: @resource[:name], - ensure: :present, + name: @resource[:name], + ensure: :present, primitives: @resource[:primitives], - score: @resource[:score], - cib: @resource[:cib] + score: @resource[:score], + cib: @resource[:cib] } end diff --git a/lib/puppet/provider/cs_colocation/pcs.rb b/lib/puppet/provider/cs_colocation/pcs.rb index 34fff76f..3ba8c64f 100644 --- a/lib/puppet/provider/cs_colocation/pcs.rb +++ b/lib/puppet/provider/cs_colocation/pcs.rb @@ -4,6 +4,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/pcs' end @@ -13,7 +14,7 @@ of current primitive colocations on the system; add, delete, or adjust various aspects.' - defaultfor operatingsystem: [:fedora, :centos, :redhat] + defaultfor operatingsystem: %i[fedora centos redhat] commands pcs: 'pcs' @@ -25,7 +26,7 @@ def self.instances cmd = [command(:pcs), 'cluster', 'cib'] raw, = run_command_in_cib(cmd) doc = REXML::Document.new(raw) - resource_set_options = ['sequential', 'require-all', 'action', 'role'] + resource_set_options = %w[sequential require-all action role] constraints = doc.root.elements['configuration'].elements['constraints'] unless constraints.nil? @@ -50,12 +51,12 @@ def self.instances resource_sets << resource_set end colocation_instance = { - name: items['id'], - ensure: :present, + name: items['id'], + ensure: :present, primitives: resource_sets, - score: items['score'], - provider: name, - new: false + score: items['score'], + provider: name, + new: false } else rsc = if items['rsc-role'] && items['rsc-role'] != 'Started' @@ -64,20 +65,20 @@ def self.instances items['rsc'] end - with_rsc = if items ['with-rsc-role'] && items['with-rsc-role'] != 'Started' + with_rsc = if items['with-rsc-role'] && items['with-rsc-role'] != 'Started' "#{items['with-rsc']}:#{items['with-rsc-role']}" else items['with-rsc'] end colocation_instance = { - name: items['id'], - ensure: :present, + name: items['id'], + ensure: :present, # Put primitives in chronological order, first 'with-rsc', then 'rsc'. primitives: [with_rsc, rsc], - score: items['score'], - provider: name, - new: false + score: items['score'], + provider: name, + new: false } end instances << new(colocation_instance) @@ -90,11 +91,11 @@ def self.instances # of actually doing the work. def create @property_hash = { - name: @resource[:name], - ensure: :present, + name: @resource[:name], + ensure: :present, primitives: @resource[:primitives], - score: @resource[:score], - new: true + score: @resource[:score], + new: true } end @@ -160,9 +161,7 @@ def flush if first_item.is_a?(Array) cmd << 'set' cmd << format_resource_set(first_item) - until @property_hash[:primitives].empty? - cmd += format_resource_set(@property_hash[:primitives].shift) - end + cmd += format_resource_set(@property_hash[:primitives].shift) until @property_hash[:primitives].empty? cmd << 'setoptions' cmd << "id=#{@property_hash[:name]}" cmd << "score=#{@property_hash[:score]}" diff --git a/lib/puppet/provider/cs_commit/crm.rb b/lib/puppet/provider/cs_commit/crm.rb index da423248..892bca63 100644 --- a/lib/puppet/provider/cs_commit/crm.rb +++ b/lib/puppet/provider/cs_commit/crm.rb @@ -4,6 +4,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/crmsh' end diff --git a/lib/puppet/provider/cs_commit/pcs.rb b/lib/puppet/provider/cs_commit/pcs.rb index 03a7251c..9ac8a66d 100644 --- a/lib/puppet/provider/cs_commit/pcs.rb +++ b/lib/puppet/provider/cs_commit/pcs.rb @@ -4,6 +4,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/pcs' end diff --git a/lib/puppet/provider/cs_group/crm.rb b/lib/puppet/provider/cs_group/crm.rb index 6d8eede2..22484cd6 100644 --- a/lib/puppet/provider/cs_group/crm.rb +++ b/lib/puppet/provider/cs_group/crm.rb @@ -4,6 +4,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/crmsh' end @@ -32,10 +33,10 @@ def self.instances end group_instance = { - name: e.attributes['id'], - ensure: :present, + name: e.attributes['id'], + ensure: :present, primitives: primitives, - provider: name + provider: name } instances << new(group_instance) end @@ -46,8 +47,8 @@ def self.instances # of actually doing the work. def create @property_hash = { - name: @resource[:name], - ensure: :present, + name: @resource[:name], + ensure: :present, primitives: Array(@resource[:primitives]) } @property_hash[:cib] = @resource[:cib] unless @resource[:cib].nil? diff --git a/lib/puppet/provider/cs_group/pcs.rb b/lib/puppet/provider/cs_group/pcs.rb index ef67c4a6..0046db03 100644 --- a/lib/puppet/provider/cs_group/pcs.rb +++ b/lib/puppet/provider/cs_group/pcs.rb @@ -4,13 +4,14 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/pcs' end Puppet::Type.type(:cs_group).provide(:pcs, parent: PuppetX::Voxpupuli::Corosync::Provider::Pcs) do desc 'Provider to add, delete, manipulate primitive groups.' - defaultfor operatingsystem: [:fedora, :centos, :redhat] + defaultfor operatingsystem: %i[fedora centos redhat] # Path to the pcs binary for interacting with the cluster configuration. commands pcs: '/usr/sbin/pcs' @@ -34,11 +35,11 @@ def self.instances end group_instance = { - name: e.attributes['id'], - ensure: :present, + name: e.attributes['id'], + ensure: :present, primitives: primitives, - provider: name, - new: false + provider: name, + new: false } instances << new(group_instance) end @@ -49,10 +50,10 @@ def self.instances # of actually doing the work. def create @property_hash = { - name: @resource[:name], - ensure: :present, + name: @resource[:name], + ensure: :present, primitives: Array(@resource[:primitives]), - new: true + new: true } @property_hash[:cib] = @resource[:cib] unless @resource[:cib].nil? end diff --git a/lib/puppet/provider/cs_location/crm.rb b/lib/puppet/provider/cs_location/crm.rb index 3ac34966..ce524981 100644 --- a/lib/puppet/provider/cs_location/crm.rb +++ b/lib/puppet/provider/cs_location/crm.rb @@ -4,6 +4,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/crmsh' end @@ -29,11 +30,7 @@ pacemakerd_version_string = pacemakerd('--version') if pacemakerd_version_string pacemakerd_version = pacemakerd_version_string.scan(%r{\d+\.\d+\.\d+}).first - if pacemakerd_version - if Puppet::Util::Package.versioncmp(pacemakerd_version, '1.1.13') >= 0 - has_feature :discovery - end - end + has_feature :discovery if pacemakerd_version && (Puppet::Util::Package.versioncmp(pacemakerd_version, '1.1.13') >= 0) end rescue Puppet::MissingCommand # on fresh systems pacemaker is not yet installed when pacemakerd command is executed, so we do just nothing, when the executable is missing @@ -57,14 +54,14 @@ def self.instances id, items = node2hash(e, ['expression']).first location_instance = { - name: id, - ensure: :present, - primitive: items['rsc'], - node_name: items['node'], - score: items['score'] || 'INFINITY', - rules: items['rule'], + name: id, + ensure: :present, + primitive: items['rsc'], + node_name: items['node'], + score: items['score'] || 'INFINITY', + rules: items['rule'], resource_discovery: items['resource-discovery'], - provider: name + provider: name } instances << new(location_instance) end @@ -75,12 +72,12 @@ def self.instances # care of actually doing the work. def create @property_hash = { - name: @resource[:name], - ensure: :present, - primitive: @resource[:primitive], - node_name: @resource[:node_name], - score: @resource[:score], - rules: @resource[:rules], + name: @resource[:name], + ensure: :present, + primitive: @resource[:primitive], + node_name: @resource[:node_name], + score: @resource[:score], + rules: @resource[:rules], resource_discovery: @resource[:resource_discovery] } end @@ -101,13 +98,9 @@ def flush updated = "location #{@property_hash[:name]} #{@property_hash[:primitive]}" - if feature?(:discovery) - updated << " resource-discovery=#{@property_hash[:resource_discovery]}" unless @property_hash[:resource_discovery].nil? - end + updated << " resource-discovery=#{@property_hash[:resource_discovery]}" if feature?(:discovery) && !@property_hash[:resource_discovery].nil? - unless @property_hash[:node_name].nil? - updated << " #{@property_hash[:score]}: #{@property_hash[:node_name]}" - end + updated << " #{@property_hash[:score]}: #{@property_hash[:node_name]}" unless @property_hash[:node_name].nil? unless @property_hash[:rules].nil? @property_hash[:rules].each do |rule_item| diff --git a/lib/puppet/provider/cs_location/pcs.rb b/lib/puppet/provider/cs_location/pcs.rb index 05db0380..0211cee6 100644 --- a/lib/puppet/provider/cs_location/pcs.rb +++ b/lib/puppet/provider/cs_location/pcs.rb @@ -4,6 +4,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/pcs' end @@ -13,7 +14,7 @@ of current primitive locations on the system; add, delete, or adjust various aspects.' - defaultfor operatingsystem: [:fedora, :centos, :redhat] + defaultfor operatingsystem: %i[fedora centos redhat] has_feature :discovery commands pcs: 'pcs' @@ -39,14 +40,14 @@ def self.instances id, items = node2hash(e, ['expression']).first location_instance = { - name: id, - ensure: :present, - primitive: items['rsc'], - node_name: items['node'], - score: items['score'] || 'INFINITY', - rules: items['rule'], + name: id, + ensure: :present, + primitive: items['rsc'], + node_name: items['node'], + score: items['score'] || 'INFINITY', + rules: items['rule'], resource_discovery: items['resource-discovery'], - provider: name + provider: name } instances << new(location_instance) end @@ -58,12 +59,12 @@ def self.instances # of actually doing the work. def create @property_hash = { - name: @resource[:name], - ensure: :present, - primitive: @resource[:primitive], - node_name: @resource[:node_name], - score: @resource[:score], - rules: @resource[:rules], + name: @resource[:name], + ensure: :present, + primitive: @resource[:primitive], + node_name: @resource[:node_name], + score: @resource[:score], + rules: @resource[:rules], resource_discovery: @resource[:resource_discovery] } end diff --git a/lib/puppet/provider/cs_order/crm.rb b/lib/puppet/provider/cs_order/crm.rb index f2679117..2f40171c 100644 --- a/lib/puppet/provider/cs_order/crm.rb +++ b/lib/puppet/provider/cs_order/crm.rb @@ -4,6 +4,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/crmsh' end @@ -42,11 +43,7 @@ def self.instances items['then'] end - kind = if items['kind'] - items['kind'] - else - 'Mandatory' - end + kind = items['kind'] || 'Mandatory' symmetrical = if items['symmetrical'] (items['symmetrical'] == 'true') @@ -56,14 +53,14 @@ def self.instances end order_instance = { - name: items['id'], - ensure: :present, - first: first, - second: second, - score: items['score'], - kind: kind, + name: items['id'], + ensure: :present, + first: first, + second: second, + score: items['score'], + kind: kind, symmetrical: symmetrical, - provider: name + provider: name } instances << new(order_instance) end @@ -74,14 +71,14 @@ def self.instances # of actually doing the work. def create @property_hash = { - name: @resource[:name], - ensure: :present, - first: @resource[:first], - second: @resource[:second], - score: @resource[:score], + name: @resource[:name], + ensure: :present, + first: @resource[:first], + second: @resource[:second], + score: @resource[:score], symmetrical: @resource[:symmetrical], - kind: @resource[:kind], - cib: @resource[:cib] + kind: @resource[:kind], + cib: @resource[:cib] } end diff --git a/lib/puppet/provider/cs_order/pcs.rb b/lib/puppet/provider/cs_order/pcs.rb index c26225a2..003ed495 100644 --- a/lib/puppet/provider/cs_order/pcs.rb +++ b/lib/puppet/provider/cs_order/pcs.rb @@ -4,6 +4,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/pcs' end @@ -13,7 +14,7 @@ of current primitive start orders on the system; add, delete, or adjust various aspects.' - defaultfor operatingsystem: [:fedora, :centos, :redhat] + defaultfor operatingsystem: %i[fedora centos redhat] has_feature :kindness @@ -47,11 +48,7 @@ def self.instances else items['then'] end - kind = if items['kind'] - items['kind'] - else - 'Mandatory' - end + kind = items['kind'] || 'Mandatory' symmetrical = if items['symmetrical'] (items['symmetrical'] == 'true') @@ -61,14 +58,14 @@ def self.instances end order_instance = { - name: items['id'], - ensure: :present, - first: first, - second: second, - kind: kind, + name: items['id'], + ensure: :present, + first: first, + second: second, + kind: kind, symmetrical: symmetrical, - provider: name, - new: false + provider: name, + new: false } instances << new(order_instance) end @@ -80,13 +77,13 @@ def self.instances # of actually doing the work. def create @property_hash = { - name: @resource[:name], - ensure: :present, - first: @resource[:first], - second: @resource[:second], - kind: @resource[:kind], + name: @resource[:name], + ensure: :present, + first: @resource[:first], + second: @resource[:second], + kind: @resource[:kind], symmetrical: @resource[:symmetrical], - new: true + new: true } end diff --git a/lib/puppet/provider/cs_primitive/crm.rb b/lib/puppet/provider/cs_primitive/crm.rb index 911cb32c..5ba63221 100644 --- a/lib/puppet/provider/cs_primitive/crm.rb +++ b/lib/puppet/provider/cs_primitive/crm.rb @@ -4,6 +4,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/crmsh' end @@ -23,18 +24,18 @@ # for creating a new provider instance. def self.element_to_hash(e) hash = { - primitive_class: e.attributes['class'], - primitive_type: e.attributes['type'], - provided_by: e.attributes['provider'], - name: e.attributes['id'].to_sym, - ensure: :present, - provider: name, - parameters: nvpairs_to_hash(e.elements['instance_attributes']), - operations: [], - utilization: nvpairs_to_hash(e.elements['utilization']), - metadata: nvpairs_to_hash(e.elements['meta_attributes']), + primitive_class: e.attributes['class'], + primitive_type: e.attributes['type'], + provided_by: e.attributes['provider'], + name: e.attributes['id'].to_sym, + ensure: :present, + provider: name, + parameters: nvpairs_to_hash(e.elements['instance_attributes']), + operations: [], + utilization: nvpairs_to_hash(e.elements['utilization']), + metadata: nvpairs_to_hash(e.elements['meta_attributes']), existing_metadata: nvpairs_to_hash(e.elements['meta_attributes']), - ms_metadata: {}, + ms_metadata: {}, } operations = e.elements['operations'] @@ -78,11 +79,11 @@ def self.instances # of actually doing the work. def create @property_hash = { - name: @resource[:name], - ensure: :present, + name: @resource[:name], + ensure: :present, primitive_class: @resource[:primitive_class], - provided_by: @resource[:provided_by], - primitive_type: @resource[:primitive_type], + provided_by: @resource[:provided_by], + primitive_type: @resource[:primitive_type], } @property_hash[:parameters] = @resource[:parameters] unless @resource[:parameters].nil? @property_hash[:operations] = @resource[:operations] unless @resource[:operations].nil? @@ -160,11 +161,9 @@ def flush end end end - if @resource && @resource.class.name == :cs_primitive && @resource[:unmanaged_metadata] + if @resource && @resource.instance_of?(:cs_primitive) && @resource[:unmanaged_metadata] @resource[:unmanaged_metadata].each do |parameter_name| - if @property_hash[:existing_metadata] && @property_hash[:existing_metadata][parameter_name] - @property_hash[:metadata][parameter_name] = @property_hash[:existing_metadata]['target-role'] - end + @property_hash[:metadata][parameter_name] = @property_hash[:existing_metadata]['target-role'] if @property_hash[:existing_metadata] && @property_hash[:existing_metadata][parameter_name] end end unless @property_hash[:parameters].empty? diff --git a/lib/puppet/provider/cs_primitive/pcs.rb b/lib/puppet/provider/cs_primitive/pcs.rb index cd40d552..f2f6df8b 100644 --- a/lib/puppet/provider/cs_primitive/pcs.rb +++ b/lib/puppet/provider/cs_primitive/pcs.rb @@ -4,6 +4,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/pcs' end @@ -20,28 +21,28 @@ mk_resource_methods - defaultfor operatingsystem: [:fedora, :centos, :redhat] + defaultfor operatingsystem: %i[fedora centos redhat] # given an XML element (a from cibadmin), produce a hash suitible # for creating a new provider instance. def self.element_to_hash(e) hash = { - primitive_class: e.attributes['class'], - primitive_type: e.attributes['type'], - provided_by: e.attributes['provider'], - name: e.attributes['id'].to_sym, - ensure: :present, - provider: name, - parameters: nvpairs_to_hash(e.elements['instance_attributes']), - operations: [], - utilization: nvpairs_to_hash(e.elements['utilization']), - metadata: nvpairs_to_hash(e.elements['meta_attributes']), - existing_resource: :true, + primitive_class: e.attributes['class'], + primitive_type: e.attributes['type'], + provided_by: e.attributes['provider'], + name: e.attributes['id'].to_sym, + ensure: :present, + provider: name, + parameters: nvpairs_to_hash(e.elements['instance_attributes']), + operations: [], + utilization: nvpairs_to_hash(e.elements['utilization']), + metadata: nvpairs_to_hash(e.elements['meta_attributes']), + existing_resource: :true, existing_primitive_class: e.attributes['class'], - existing_primitive_type: e.attributes['type'], - existing_provided_by: e.attributes['provider'], - existing_metadata: nvpairs_to_hash(e.elements['meta_attributes']), - existing_operations: [] + existing_primitive_type: e.attributes['type'], + existing_provided_by: e.attributes['provider'], + existing_metadata: nvpairs_to_hash(e.elements['meta_attributes']), + existing_operations: [] } operations = e.elements['operations'] @@ -98,11 +99,11 @@ def self._determine_primitive_subcommand(primitive_class) # updates or create a resource, so we flag the resources with that parameter def create @property_hash = { - name: @resource[:name], - ensure: :present, - primitive_class: @resource[:primitive_class], - provided_by: @resource[:provided_by], - primitive_type: @resource[:primitive_type], + name: @resource[:name], + ensure: :present, + primitive_class: @resource[:primitive_class], + provided_by: @resource[:provided_by], + primitive_type: @resource[:primitive_type], existing_resource: :false } @property_hash[:parameters] = @resource[:parameters] unless @resource[:parameters].nil? @@ -183,9 +184,7 @@ def _flush_resource(operations, parameters, utilization, metadatas) # provider or type has changed. Since stonith resources have a special # command they do not include a provider or class in their type name resource_type = "#{@property_hash[:primitive_class]}:" - if @property_hash[:provided_by] - resource_type << "#{@property_hash[:provided_by]}:" - end + resource_type << "#{@property_hash[:provided_by]}:" if @property_hash[:provided_by] resource_type << (@property_hash[:primitive_type]).to_s # We destroy the resource if it's type, class or provider has changed @@ -269,7 +268,7 @@ def flush end # Clear all metadata structures when specified - if @resource && @resource.class.name == :cs_primitive && @resource[:unmanaged_metadata] + if @resource && @resource.instance_of?(:cs_primitive) && @resource[:unmanaged_metadata] @resource[:unmanaged_metadata].each do |parameter_name| @property_hash[:metadata].delete(parameter_name) @property_hash[:existing_metadata].delete(parameter_name) if @property_hash[:existing_metadata] @@ -291,11 +290,7 @@ def flush # Establish whether this is a regular resource or a special stonith resource # The destinction exists only because pcs uses a different subcommand to # interact with stonith resources - is_stonith = if (@property_hash[:primitive_class]).to_s == 'stonith' - true - else - false - end + is_stonith = (@property_hash[:primitive_class]).to_s == 'stonith' # Call the appropriate helper function to generate the PCS commands if is_stonith diff --git a/lib/puppet/provider/cs_property/crm.rb b/lib/puppet/provider/cs_property/crm.rb index d94a48a2..f912aceb 100644 --- a/lib/puppet/provider/cs_property/crm.rb +++ b/lib/puppet/provider/cs_property/crm.rb @@ -4,6 +4,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/crmsh' end @@ -32,10 +33,10 @@ def self.instances property = { name: items['name'], value: items['value'] } property_instance = { - name: property[:name], - ensure: :present, - value: property[:value], - provider: name + name: property[:name], + ensure: :present, + value: property[:value], + provider: name } instances << new(property_instance) end @@ -47,9 +48,9 @@ def self.instances # of actually doing the work. def create @property_hash = { - name: @resource[:name], + name: @resource[:name], ensure: :present, - value: @resource[:value] + value: @resource[:value] } end diff --git a/lib/puppet/provider/cs_property/pcs.rb b/lib/puppet/provider/cs_property/pcs.rb index fefb11cf..c0894d88 100644 --- a/lib/puppet/provider/cs_property/pcs.rb +++ b/lib/puppet/provider/cs_property/pcs.rb @@ -4,6 +4,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/pcs' end @@ -12,7 +13,7 @@ abstract corosync/pacemaker vs. keepalived. This provider will check the state of Corosync cluster configuration properties.' - defaultfor operatingsystem: [:fedora, :centos, :redhat] + defaultfor operatingsystem: %i[fedora centos redhat] # Path to the pcs binary for interacting with the cluster configuration. commands pcs: 'pcs' @@ -33,10 +34,10 @@ def self.instances property = { name: items['name'], value: items['value'] } property_instance = { - name: property[:name], - ensure: :present, - value: property[:value], - provider: name + name: property[:name], + ensure: :present, + value: property[:value], + provider: name } instances << new(property_instance) end @@ -48,9 +49,9 @@ def self.instances # of actually doing the work. def create @property_hash = { - name: @resource[:name], + name: @resource[:name], ensure: :present, - value: @resource[:value] + value: @resource[:value] } end diff --git a/lib/puppet/provider/cs_rsc_defaults/crm.rb b/lib/puppet/provider/cs_rsc_defaults/crm.rb index 65326f33..0ac4c9fe 100644 --- a/lib/puppet/provider/cs_rsc_defaults/crm.rb +++ b/lib/puppet/provider/cs_rsc_defaults/crm.rb @@ -4,6 +4,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/crmsh' end @@ -30,9 +31,9 @@ def self.instances rsc_defaults = { name: items['name'], value: items['value'] } rsc_defaults_instance = { - name: rsc_defaults[:name], - ensure: :present, - value: rsc_defaults[:value], + name: rsc_defaults[:name], + ensure: :present, + value: rsc_defaults[:value], provider: name } instances << new(rsc_defaults_instance) @@ -44,9 +45,9 @@ def self.instances # of actually doing the work. def create @property_hash = { - name: @resource[:name], + name: @resource[:name], ensure: :present, - value: @resource[:value] + value: @resource[:value] } end diff --git a/lib/puppet/provider/cs_rsc_defaults/pcs.rb b/lib/puppet/provider/cs_rsc_defaults/pcs.rb index 1b04cb90..bb587e8c 100644 --- a/lib/puppet/provider/cs_rsc_defaults/pcs.rb +++ b/lib/puppet/provider/cs_rsc_defaults/pcs.rb @@ -4,6 +4,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/pcs' end @@ -12,7 +13,7 @@ abstract corosync/pacemaker vs. keepalived. This provider will check the state of Corosync global defaults for resource options.' - defaultfor operatingsystem: [:fedora, :centos, :redhat] + defaultfor operatingsystem: %i[fedora centos redhat] # Path to the pcs binary for interacting with the cluster configuration. commands pcs: 'pcs' @@ -31,9 +32,9 @@ def self.instances rsc_defaults = { name: items['name'], value: items['value'] } rsc_defaults_instance = { - name: rsc_defaults[:name], - ensure: :present, - value: rsc_defaults[:value], + name: rsc_defaults[:name], + ensure: :present, + value: rsc_defaults[:value], provider: name } instances << new(rsc_defaults_instance) @@ -45,9 +46,9 @@ def self.instances # of actually doing the work. def create @property_hash = { - name: @resource[:name], + name: @resource[:name], ensure: :present, - value: @resource[:value] + value: @resource[:value] } end @@ -79,6 +80,7 @@ def value=(should) # as stdin for the pcs command. def flush return if @property_hash.empty? + # clear this on properties, in case it's set from a previous # run of a different corosync type cmd = [command(:pcs), 'resource', 'defaults', "#{@property_hash[:name]}=#{@property_hash[:value]}"] diff --git a/lib/puppet/provider/cs_shadow/crm.rb b/lib/puppet/provider/cs_shadow/crm.rb index c568c29d..c599775d 100644 --- a/lib/puppet/provider/cs_shadow/crm.rb +++ b/lib/puppet/provider/cs_shadow/crm.rb @@ -4,6 +4,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/crmsh' end diff --git a/lib/puppet/provider/cs_shadow/pcs.rb b/lib/puppet/provider/cs_shadow/pcs.rb index 024ab210..674d3783 100644 --- a/lib/puppet/provider/cs_shadow/pcs.rb +++ b/lib/puppet/provider/cs_shadow/pcs.rb @@ -4,6 +4,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/pcs' end diff --git a/lib/puppet/type/cs_clone.rb b/lib/puppet/type/cs_clone.rb index a8ff4125..5f9053c4 100644 --- a/lib/puppet/type/cs_clone.rb +++ b/lib/puppet/type/cs_clone.rb @@ -115,7 +115,8 @@ def unmunge_cs_primitive(name) validate do return if self[:ensure] == :absent - mandatory_single_properties = [:primitive, :group] + + mandatory_single_properties = %i[primitive group] has_should = mandatory_single_properties.select { |prop| should(prop) } raise Puppet::Error, "You cannot specify #{has_should.join(' and ')} on this type (only one)" if has_should.length > 1 raise Puppet::Error, "You must specify #{mandatory_single_properties.join(' or ')}" if has_should.length != 1 diff --git a/lib/puppet/type/cs_colocation.rb b/lib/puppet/type/cs_colocation.rb index f644c6ad..999cd90e 100644 --- a/lib/puppet/type/cs_colocation.rb +++ b/lib/puppet/type/cs_colocation.rb @@ -43,6 +43,7 @@ def should=(value) super raise Puppet::Error, 'Puppet::Type::Cs_Colocation: The primitives property must be an array.' unless value.is_a? Array raise Puppet::Error, 'Puppet::Type::Cs_Colocation: The primitives property must be an array of at least one element.' if value.empty? + @should end end @@ -83,9 +84,7 @@ def extract_primitives unless @parameters[:primitives].should.nil? if @parameters[:primitives].should.first.is_a?(Hash) @parameters[:primitives].should.each do |colocation_set| - if colocation_set.key?('primitives') - result << colocation_set['primitives'] - end + result << colocation_set['primitives'] if colocation_set.key?('primitives') end end if @parameters[:primitives].should.first.is_a?(String) @@ -97,7 +96,7 @@ def extract_primitives result.flatten end - [:cs_clone, :cs_primitive].each do |resource_type| + %i[cs_clone cs_primitive].each do |resource_type| autorequire(resource_type) do extract_primitives end diff --git a/lib/puppet/type/cs_location.rb b/lib/puppet/type/cs_location.rb index 13415dfe..8104cfcf 100644 --- a/lib/puppet/type/cs_location.rb +++ b/lib/puppet/type/cs_location.rb @@ -95,7 +95,7 @@ def insync?(is) %w[corosync pacemaker] end - [:cs_primitive, :cs_clone, :cs_group].each do |type| + %i[cs_primitive cs_clone cs_group].each do |type| autorequire(type) do autos = [] autos << unmunge_cs_primitive(should(:primitive)) if should(:primitive) @@ -112,8 +112,6 @@ def unmunge_cs_primitive(name) end validate do - if [self[:node_name], self[:rules]].compact.length > 1 - raise Puppet::Error, 'Location constraints dictate that node_name and rules cannot co-exist for this type.' - end + raise Puppet::Error, 'Location constraints dictate that node_name and rules cannot co-exist for this type.' if [self[:node_name], self[:rules]].compact.length > 1 end end diff --git a/lib/puppet/type/cs_order.rb b/lib/puppet/type/cs_order.rb index 1a08bb8f..0c6efe2c 100644 --- a/lib/puppet/type/cs_order.rb +++ b/lib/puppet/type/cs_order.rb @@ -92,7 +92,7 @@ %w[corosync pacemaker] end - [:cs_clone, :cs_group, :cs_primitive].each do |resource_type| + %i[cs_clone cs_group cs_primitive].each do |resource_type| autorequire(resource_type) do autos = [] autos << unmunge_cs_resourcename(should(:first)) @@ -109,6 +109,7 @@ def unmunge_cs_resourcename(name) return if name.nil? + name = name.split(':')[0] name = name[3..-1] if name.start_with? 'ms_' diff --git a/lib/puppet/type/cs_primitive.rb b/lib/puppet/type/cs_primitive.rb index a94522e6..77a7e6c7 100644 --- a/lib/puppet/type/cs_primitive.rb +++ b/lib/puppet/type/cs_primitive.rb @@ -75,6 +75,7 @@ munge do |value| return [value] if value.is_a?(String) || value.is_a?(Symbol) + value end diff --git a/lib/puppet/type/cs_shadow.rb b/lib/puppet/type/cs_shadow.rb index 7cddbfbd..515a5a4c 100644 --- a/lib/puppet/type/cs_shadow.rb +++ b/lib/puppet/type/cs_shadow.rb @@ -39,6 +39,7 @@ def change_to_s(currentvalue, _newvalue) def generate return [] if self[:autocommit] != true + options = { name: @title } [Puppet::Type.type(:cs_commit).new(options)] end diff --git a/lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb b/lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb index 6bc01a08..86e89e33 100644 --- a/lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb +++ b/lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb @@ -4,6 +4,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider' end @@ -69,21 +70,15 @@ def self.rule_expression(rulename, expressions, boolean_op = 'and') rule_parameters = [] count = 0 - if boolean_op != 'and' && boolean_op != 'or' - raise Puppet::Error, "boolean-op must be 'and' or 'or' in rule #{rulename}" - end + raise Puppet::Error, "boolean-op must be 'and' or 'or' in rule #{rulename}" if boolean_op != 'and' && boolean_op != 'or' expressions.each do |expr| rule_parameters << boolean_op if count > 0 count += 1 - if expr['attribute'].nil? - raise Puppet::Error, "attribute must be defined for expression #{count} in rule #{rulename}" - end + raise Puppet::Error, "attribute must be defined for expression #{count} in rule #{rulename}" if expr['attribute'].nil? - if expr['operation'].nil? - raise Puppet::Error, "operation must be defined for expression #{count} in rule #{rulename}" - end + raise Puppet::Error, "operation must be defined for expression #{count} in rule #{rulename}" if expr['operation'].nil? attribute = expr['attribute'] operation = expr['operation'] @@ -94,9 +89,7 @@ def self.rule_expression(rulename, expressions, boolean_op = 'and') rule_parameters << attribute when 'lt', 'gt', 'lte', 'gte', 'eq', 'ne' - if expr['value'].nil? - raise Puppet::Error, "value must be defined for expression #{count} in rule #{rulename}" - end + raise Puppet::Error, "value must be defined for expression #{count} in rule #{rulename}" if expr['value'].nil? rule_parameters << attribute rule_parameters << operation @@ -114,6 +107,7 @@ def self.rule_expression(rulename, expressions, boolean_op = 'and') def self._get_epoch(cmd, cib = nil) raw, status = run_command_in_cib(cmd, cib, false) return :absent if status.nonzero? + doc = REXML::Document.new(raw) current_epoch = REXML::XPath.first(doc, '/cib').attributes['epoch'] current_admin_epoch = REXML::XPath.first(doc, '/cib').attributes['admin_epoch'] diff --git a/lib/puppet_x/voxpupuli/corosync/provider/crmsh.rb b/lib/puppet_x/voxpupuli/corosync/provider/crmsh.rb index f07ecba3..cecc73f6 100644 --- a/lib/puppet_x/voxpupuli/corosync/provider/crmsh.rb +++ b/lib/puppet_x/voxpupuli/corosync/provider/crmsh.rb @@ -5,6 +5,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider' require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/cib_helper' end @@ -24,6 +25,7 @@ class PuppetX::Voxpupuli::Corosync::Provider::Crmsh < PuppetX::Voxpupuli::Corosy # rubocop:enable Style/ClassVars def self.ready?(shadow_cib) return true if @@crmready + cmd = [command(:crm_attribute), '--type', 'crm_config', '--query', '--name', 'dc-version'] raw, status = run_command_in_cib(cmd, nil, false) if status.zero? @@ -45,10 +47,10 @@ def self.ready?(shadow_cib) # rubocop:enable Style/ClassVars debug("Corosync is ready, CIB epoch is #{cib_epoch}.") - return true + true else debug("Corosync not ready, retrying: #{raw}") - return false + false end end diff --git a/lib/puppet_x/voxpupuli/corosync/provider/pcs.rb b/lib/puppet_x/voxpupuli/corosync/provider/pcs.rb index 3cb4e97b..59d548bb 100644 --- a/lib/puppet_x/voxpupuli/corosync/provider/pcs.rb +++ b/lib/puppet_x/voxpupuli/corosync/provider/pcs.rb @@ -5,6 +5,7 @@ require 'pathname' # WORKAROUND #14073, #7788 and SERVER-973 corosync = Puppet::Module.find('corosync') raise(LoadError, "Unable to find corosync module in modulepath #{Puppet[:basemodulepath] || Puppet[:modulepath]}") unless corosync + require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider' require File.join corosync.path, 'lib/puppet_x/voxpupuli/corosync/provider/cib_helper' end @@ -23,6 +24,7 @@ class PuppetX::Voxpupuli::Corosync::Provider::Pcs < PuppetX::Voxpupuli::Corosync # rubocop:enable Style/ClassVars def self.ready?(shadow_cib) return true if @@pcsready + cmd = [command(:pcs), 'property', 'show', 'dc-version'] raw, status = run_command_in_cib(cmd, nil, false) if status.zero? @@ -45,10 +47,10 @@ def self.ready?(shadow_cib) debug("Corosync is ready, CIB epoch is #{cib_epoch}. Sleeping 5 seconds for safety.") sleep 5 - return true + true else debug("Corosync not ready, retrying: #{raw}") - return false + false end end diff --git a/spec/acceptance/cs_clone_spec.rb b/spec/acceptance/cs_clone_spec.rb index 618590f7..c0168a8f 100755 --- a/spec/acceptance/cs_clone_spec.rb +++ b/spec/acceptance/cs_clone_spec.rb @@ -21,6 +21,10 @@ J76GtqoIOh+CTeY/BMwBotdQdgeR0zvjE9FuLWkhTmRtVFhbVIzJbFlFuYq5d3LH NWyN0RsTXFaqowV1/HSyvfD7LoF/CrmN5gOAM3Ierv/Ti9uqGVhdGBd/kw==' File.open('/tmp/ca.pem', 'w') { |f| f.write(cert) } + after :all do + cleanup_cs_resources + end + it 'with defaults' do pp = <<-EOS file { '/tmp/ca.pem': @@ -75,7 +79,7 @@ class { 'corosync': ensure => present, #{type} => '#{property_value}', } - EOS + EOS apply_manifest(pp, catch_failures: true, debug: false, trace: true) apply_manifest(pp, catch_changes: true, debug: false, trace: true) command = "cibadmin --query | grep duncan_vip_clone_#{type}" @@ -93,7 +97,7 @@ class { 'corosync': cs_clone { 'duncan_vip_clone_#{type}': ensure => absent, } - EOS + EOS apply_manifest(pp, catch_failures: true, debug: false, trace: true) apply_manifest(pp, catch_changes: true, debug: false, trace: true) command = "cibadmin --query | grep duncan_vip_clone_#{type}" @@ -123,7 +127,7 @@ def fetch_value_command(name) ordered => false, interleave => false, } - EOS + EOS apply_manifest(pp, catch_failures: true, debug: false, trace: true) apply_manifest(pp, catch_changes: true, debug: false, trace: true) @@ -184,7 +188,7 @@ def fetch_value_command(name) ordered => true, interleave => true, } - EOS + EOS apply_manifest(pp, catch_failures: true, debug: false, trace: true) apply_manifest(pp, catch_changes: true, debug: false, trace: true) @@ -237,7 +241,7 @@ def fetch_value_command(name) clone_max => 43, interleave => true, } - EOS + EOS apply_manifest(pp, catch_failures: true, debug: false, trace: true) apply_manifest(pp, catch_changes: true, debug: false, trace: true) @@ -311,8 +315,4 @@ def fetch_value_command(name) apply_manifest(pp, catch_changes: true, debug: false, trace: true) end end - - after :all do - cleanup_cs_resources - end end diff --git a/spec/acceptance/cs_colocation_spec.rb b/spec/acceptance/cs_colocation_spec.rb index e6b428ea..8da7136c 100644 --- a/spec/acceptance/cs_colocation_spec.rb +++ b/spec/acceptance/cs_colocation_spec.rb @@ -21,6 +21,10 @@ J76GtqoIOh+CTeY/BMwBotdQdgeR0zvjE9FuLWkhTmRtVFhbVIzJbFlFuYq5d3LH NWyN0RsTXFaqowV1/HSyvfD7LoF/CrmN5gOAM3Ierv/Ti9uqGVhdGBd/kw==' File.open('/tmp/ca.pem', 'w') { |f| f.write(cert) } + after :all do + cleanup_cs_resources + end + it 'with defaults' do pp = <<-EOS file { '/tmp/ca.pem': @@ -105,8 +109,4 @@ class { 'corosync': expect(r.stdout).to match(%r{colocation.*\srsc="nginx_service"}) end end - - after :all do - cleanup_cs_resources - end end diff --git a/spec/acceptance/cs_commit_spec.rb b/spec/acceptance/cs_commit_spec.rb index 827f6cff..64ec12f0 100644 --- a/spec/acceptance/cs_commit_spec.rb +++ b/spec/acceptance/cs_commit_spec.rb @@ -23,6 +23,10 @@ J76GtqoIOh+CTeY/BMwBotdQdgeR0zvjE9FuLWkhTmRtVFhbVIzJbFlFuYq5d3LH NWyN0RsTXFaqowV1/HSyvfD7LoF/CrmN5gOAM3Ierv/Ti9uqGVhdGBd/kw==' File.open('/tmp/ca.pem', 'w') { |f| f.write(cert) } + after :all do + cleanup_cs_resources + end + it 'with defaults' do pp = <<-EOS file { '/tmp/ca.pem': @@ -183,8 +187,4 @@ class { 'corosync': expect(r.stdout).to match(%r{colocation.*\srsc="apache2_service"}) end end - - after :all do - cleanup_cs_resources - end end diff --git a/spec/acceptance/cs_group_spec.rb b/spec/acceptance/cs_group_spec.rb index 585a5cca..72a3d904 100755 --- a/spec/acceptance/cs_group_spec.rb +++ b/spec/acceptance/cs_group_spec.rb @@ -21,6 +21,10 @@ J76GtqoIOh+CTeY/BMwBotdQdgeR0zvjE9FuLWkhTmRtVFhbVIzJbFlFuYq5d3LH NWyN0RsTXFaqowV1/HSyvfD7LoF/CrmN5gOAM3Ierv/Ti9uqGVhdGBd/kw==' File.open('/tmp/ca.pem', 'w') { |f| f.write(cert) } + after :all do + cleanup_cs_resources + end + it 'with defaults' do pp = <<-EOS file { '/tmp/ca.pem': @@ -110,8 +114,4 @@ class { 'corosync': it 'DEBUG' do shell('cibadmin --query') end - - after :all do - cleanup_cs_resources - end end diff --git a/spec/acceptance/cs_location_spec.rb b/spec/acceptance/cs_location_spec.rb index d476b5a0..7b5fa7c0 100755 --- a/spec/acceptance/cs_location_spec.rb +++ b/spec/acceptance/cs_location_spec.rb @@ -21,6 +21,10 @@ J76GtqoIOh+CTeY/BMwBotdQdgeR0zvjE9FuLWkhTmRtVFhbVIzJbFlFuYq5d3LH NWyN0RsTXFaqowV1/HSyvfD7LoF/CrmN5gOAM3Ierv/Ti9uqGVhdGBd/kw==' File.open('/tmp/ca.pem', 'w') { |f| f.write(cert) } + after :all do + cleanup_cs_resources + end + it 'with defaults' do pp = <<-EOS file { '/tmp/ca.pem': @@ -236,8 +240,4 @@ class { 'corosync': end end end - - after :all do - cleanup_cs_resources - end end diff --git a/spec/acceptance/cs_order_spec.rb b/spec/acceptance/cs_order_spec.rb index 89837f60..9d5396f4 100644 --- a/spec/acceptance/cs_order_spec.rb +++ b/spec/acceptance/cs_order_spec.rb @@ -21,6 +21,10 @@ J76GtqoIOh+CTeY/BMwBotdQdgeR0zvjE9FuLWkhTmRtVFhbVIzJbFlFuYq5d3LH NWyN0RsTXFaqowV1/HSyvfD7LoF/CrmN5gOAM3Ierv/Ti9uqGVhdGBd/kw==' File.open('/tmp/ca.pem', 'w') { |f| f.write(cert) } + after :all do + cleanup_cs_resources + end + it 'with defaults' do pp = <<-EOS file { '/tmp/ca.pem': @@ -166,8 +170,4 @@ class { 'corosync': end end end - - after :all do - cleanup_cs_resources - end end diff --git a/spec/acceptance/cs_primitive_spec.rb b/spec/acceptance/cs_primitive_spec.rb index 6d735de8..5736788a 100644 --- a/spec/acceptance/cs_primitive_spec.rb +++ b/spec/acceptance/cs_primitive_spec.rb @@ -22,6 +22,10 @@ J76GtqoIOh+CTeY/BMwBotdQdgeR0zvjE9FuLWkhTmRtVFhbVIzJbFlFuYq5d3LH NWyN0RsTXFaqowV1/HSyvfD7LoF/CrmN5gOAM3Ierv/Ti9uqGVhdGBd/kw==' File.open('/tmp/ca.pem', 'w') { |f| f.write(cert) } + after :all do + cleanup_cs_resources + end + it 'with defaults' do pp = <<-EOS file { '/tmp/ca.pem': @@ -332,8 +336,4 @@ class { 'corosync': end end end - - after :all do - cleanup_cs_resources - end end diff --git a/spec/acceptance/cs_shadow_spec.rb b/spec/acceptance/cs_shadow_spec.rb index 5c7312f5..c9230e67 100644 --- a/spec/acceptance/cs_shadow_spec.rb +++ b/spec/acceptance/cs_shadow_spec.rb @@ -23,6 +23,10 @@ J76GtqoIOh+CTeY/BMwBotdQdgeR0zvjE9FuLWkhTmRtVFhbVIzJbFlFuYq5d3LH NWyN0RsTXFaqowV1/HSyvfD7LoF/CrmN5gOAM3Ierv/Ti9uqGVhdGBd/kw==' File.open('/tmp/ca.pem', 'w') { |f| f.write(cert) } + after :all do + cleanup_cs_resources + end + it 'with defaults' do pp = <<-EOS file { '/tmp/ca.pem': @@ -189,7 +193,7 @@ class { 'corosync': primitive => 'apache3_vip', cib => 'puppet', } - EOS + EOS apply_manifest(pp, catch_failures: true, debug: false, trace: true) apply_manifest(pp, expect_changes: true, debug: false, trace: true) command = if fact('default_provider') == 'pcs' @@ -201,8 +205,4 @@ class { 'corosync': expect(r.stdout).to match(%r{ true) } @@ -1042,6 +1045,7 @@ require: 'Exec[authorize_qdevice]' ) end + it 'contains the quorum configuration' do is_expected.to contain_file('/etc/corosync/corosync.conf').with_content( %r!quorum { diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index bbf7f9bb..43de9a98 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -64,7 +64,7 @@ def cleanup_cs_resources resources { 'cs_location' : purge => true, } - EOS + EOS apply_manifest(pp, catch_failures: true, debug: false, trace: true) apply_manifest(pp, catch_changes: true, debug: false, trace: true) @@ -73,7 +73,7 @@ def cleanup_cs_resources resources { 'cs_primitive' : purge => true, } - EOS + EOS apply_manifest(pp, catch_failures: true, debug: false, trace: true) apply_manifest(pp, catch_changes: true, debug: false, trace: true) diff --git a/spec/unit/puppet/provider/cs_clone_crm_spec.rb b/spec/unit/puppet/provider/cs_clone_crm_spec.rb index f206337c..a715bc54 100644 --- a/spec/unit/puppet/provider/cs_clone_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_clone_crm_spec.rb @@ -123,16 +123,12 @@ def expect_update(pattern) if Puppet::Util::Package.versioncmp(Puppet::PUPPETVERSION, '3.4') == -1 Puppet::Util::SUIDManager.expects(:run_and_capture).with do |*args| - if args.slice(0..2) == %w[configure load update] - expect(File.read(args[3])).to match(pattern) - end + expect(File.read(args[3])).to match(pattern) if args.slice(0..2) == %w[configure load update] true end.at_least_once.returns(['', 0]) else Puppet::Util::Execution.expects(:execute).with do |*args| - if args.slice(0..2) == %w[configure load update] - expect(File.read(args[3])).to match(pattern) - end + expect(File.read(args[3])).to match(pattern) if args.slice(0..2) == %w[configure load update] true end.at_least_once.returns( Puppet::Util::Execution::ProcessOutput.new('', 0) @@ -142,10 +138,10 @@ def expect_update(pattern) let :resource do Puppet::Type.type(:cs_clone).new( - name: 'p_keystone-clone', - provider: :crm, + name: 'p_keystone-clone', + provider: :crm, primitive: 'p_keystone', - ensure: :present + ensure: :present ) end diff --git a/spec/unit/puppet/provider/cs_clone_pcs_spec.rb b/spec/unit/puppet/provider/cs_clone_pcs_spec.rb index 42fc162b..65cd18ea 100644 --- a/spec/unit/puppet/provider/cs_clone_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_clone_pcs_spec.rb @@ -119,10 +119,10 @@ context 'when flushing' do let :resource do Puppet::Type.type(:cs_clone).new( - name: 'p_keystone-clone', + name: 'p_keystone-clone', primitive: 'p_keystone', - provider: :pcs, - ensure: :present + provider: :pcs, + ensure: :present ) end @@ -180,19 +180,19 @@ context 'when changing clone id' do def clone_xml(name) - <<-EOS - - - - - - - - - - - - + <<~EOS + + + + + + + + + + + + EOS end diff --git a/spec/unit/puppet/provider/cs_colocation_crm_spec.rb b/spec/unit/puppet/provider/cs_colocation_crm_spec.rb index 9631a4d7..56c34412 100644 --- a/spec/unit/puppet/provider/cs_colocation_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_colocation_crm_spec.rb @@ -38,7 +38,7 @@ instances.first end - it "should be a kind of #{described_class.name}" do + it "is a kind of #{described_class.name}" do expect(instance).to be_a_kind_of(described_class) end @@ -64,16 +64,12 @@ def expect_update(pattern) if Puppet::Util::Package.versioncmp(Puppet::PUPPETVERSION, '3.4') == -1 Puppet::Util::SUIDManager.expects(:run_and_capture).with do |*args| - if args.slice(0..2) == %w[configure load update] - expect(File.read(args[3])).to match(pattern) - end + expect(File.read(args[3])).to match(pattern) if args.slice(0..2) == %w[configure load update] true end.at_least_once.returns(['', 0]) else Puppet::Util::Execution.expects(:execute).with do |*args| - if args.slice(0..2) == %w[configure load update] - expect(File.read(args[3])).to match(pattern) - end + expect(File.read(args[3])).to match(pattern) if args.slice(0..2) == %w[configure load update] true end.at_least_once.returns( Puppet::Util::Execution::ProcessOutput.new('', 0) @@ -84,10 +80,10 @@ def expect_update(pattern) context 'with 2 primitives' do let :resource do Puppet::Type.type(:cs_colocation).new( - name: 'first_with_second', - provider: :crm, + name: 'first_with_second', + provider: :crm, primitives: %w[first second], - ensure: :present + ensure: :present ) end @@ -130,10 +126,10 @@ def expect_update(pattern) context 'with 3 or more primitives' do let :resource do Puppet::Type.type(:cs_colocation).new( - name: 'first_with_second_with_third', - provider: :crm, + name: 'first_with_second_with_third', + provider: :crm, primitives: %w[first second third], - ensure: :present + ensure: :present ) end diff --git a/spec/unit/puppet/provider/cs_group_crm_spec.rb b/spec/unit/puppet/provider/cs_group_crm_spec.rb index 9ce7786d..2d9e789d 100644 --- a/spec/unit/puppet/provider/cs_group_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_group_crm_spec.rb @@ -65,7 +65,7 @@ instances.first end - it "should be a kind of #{described_class.name}" do + it "is a kind of #{described_class.name}" do expect(instance).to be_a_kind_of(described_class) end diff --git a/spec/unit/puppet/provider/cs_group_pcs_spec.rb b/spec/unit/puppet/provider/cs_group_pcs_spec.rb index 72c7ca54..dc1d8dc2 100644 --- a/spec/unit/puppet/provider/cs_group_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_group_pcs_spec.rb @@ -60,7 +60,7 @@ instances.first end - it "should be a kind of #{described_class.name}" do + it "is a kind of #{described_class.name}" do expect(instance).to be_a_kind_of(described_class) end diff --git a/spec/unit/puppet/provider/cs_location_pcs_spec.rb b/spec/unit/puppet/provider/cs_location_pcs_spec.rb index 1657fe73..d1dc3221 100644 --- a/spec/unit/puppet/provider/cs_location_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_location_pcs_spec.rb @@ -35,7 +35,7 @@ instances.first end - it "should be a kind of #{described_class.name}" do + it "is a kind of #{described_class.name}" do expect(instance).to be_a_kind_of(described_class) end end diff --git a/spec/unit/puppet/provider/cs_order_crm_spec.rb b/spec/unit/puppet/provider/cs_order_crm_spec.rb index 28e2e4a3..a51646ae 100644 --- a/spec/unit/puppet/provider/cs_order_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_order_crm_spec.rb @@ -36,7 +36,7 @@ instances.first end - it "should be a kind of #{described_class.name}" do + it "is a kind of #{described_class.name}" do expect(instance).to be_a_kind_of(described_class) end @@ -44,6 +44,7 @@ expect(instance.name).to eq('nul-messagebus_before_nul-interface-2') end end + describe 'first instance' do let :instance do instances.first diff --git a/spec/unit/puppet/provider/cs_order_pcs_spec.rb b/spec/unit/puppet/provider/cs_order_pcs_spec.rb index c7e456d7..24bc722a 100644 --- a/spec/unit/puppet/provider/cs_order_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_order_pcs_spec.rb @@ -29,7 +29,7 @@ instances.first end - it "should be a kind of #{described_class.name}" do + it "is a kind of #{described_class.name}" do expect(instance).to be_a_kind_of(described_class) end @@ -37,6 +37,7 @@ expect(instance.name).to eq('nul-messagebus_before_nul-interface-2') end end + describe 'first instance' do let :instance do instances.first diff --git a/spec/unit/puppet/provider/cs_primitive_crm_spec.rb b/spec/unit/puppet/provider/cs_primitive_crm_spec.rb index a4316303..774c027f 100644 --- a/spec/unit/puppet/provider/cs_primitive_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_primitive_crm_spec.rb @@ -119,16 +119,12 @@ def expect_update(pattern) if Puppet::Util::Package.versioncmp(Puppet::PUPPETVERSION, '3.4') == -1 Puppet::Util::SUIDManager.expects(:run_and_capture).with do |*args| - if args.slice(0..2) == %w[configure load update] - expect(File.read(args[3])).to match(pattern) - end + expect(File.read(args[3])).to match(pattern) if args.slice(0..2) == %w[configure load update] true end.at_least_once.returns(['', 0]) else Puppet::Util::Execution.expects(:execute).with do |*args| - if args.slice(0..2) == %w[configure load update] - expect(File.read(args[3])).to match(pattern) - end + expect(File.read(args[3])).to match(pattern) if args.slice(0..2) == %w[configure load update] true end.at_least_once.returns( Puppet::Util::Execution::ProcessOutput.new('', 0) diff --git a/spec/unit/puppet/provider/cs_primitive_pcs_spec.rb b/spec/unit/puppet/provider/cs_primitive_pcs_spec.rb index 2c2960b7..32849273 100644 --- a/spec/unit/puppet/provider/cs_primitive_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_primitive_pcs_spec.rb @@ -76,47 +76,47 @@ context 'when flushing' do let :instances do - cib = <<-EOS - - - - - - - - - - - - -h - - - - - - - - - - - - - - - - - - - - - - - - - - - + cib = <<~EOS + + + + + + + + + + + + + h + + + + + + + + + + + + + + + + + + + + + + + + + + + EOS pcs_load_cib(cib) diff --git a/spec/unit/puppet/type/cs_clone_spec.rb b/spec/unit/puppet/type/cs_clone_spec.rb index e98425f4..e7e52051 100644 --- a/spec/unit/puppet/type/cs_clone_spec.rb +++ b/spec/unit/puppet/type/cs_clone_spec.rb @@ -17,41 +17,41 @@ expect(subject.new(name: 'mock_clone', primitive: 'mock_primitive')).not_to be_nil end - [:name, :cib].each do |param| - it "should have a #{param} parameter" do + %i[name cib].each do |param| + it "has a #{param} parameter" do expect(subject).to be_validparameter(param) end - it "should have documentation for its #{param} parameter" do + it "has documentation for its #{param} parameter" do expect(subject.paramclass(param).doc).to be_instance_of(String) end end - [:primitive, :clone_max, :clone_node_max, :notify_clones, :globally_unique, - :ordered, :interleave].each do |property| - it "should have a #{property} property" do + %i[primitive clone_max clone_node_max notify_clones globally_unique + ordered interleave].each do |property| + it "has a #{property} property" do expect(subject).to be_validproperty(property) end - it "should have documentation for its #{property} property" do + it "has documentation for its #{property} property" do expect(subject.propertybyname(property).doc).to be_instance_of(String) end end end describe 'when validating attributes' do - [:notify_clones, :globally_unique, :ordered, :interleave].each do |attribute| - it "should validate that the #{attribute} attribute can be true/false" do + %i[notify_clones globally_unique ordered interleave].each do |attribute| + it "validates that the #{attribute} attribute can be true/false" do [true, false].each do |value| expect(subject.new( - name: 'mock_clone', + name: 'mock_clone', primitive: 'mock_primitive', attribute => value )[attribute]).to eq(value.to_s.to_sym) end end - it "should validate that the #{attribute} attribute cannot be other values" do + it "validates that the #{attribute} attribute cannot be other values" do ['fail', 42].each do |value| expect { subject.new(name: 'mock_clone', attribute => value) }. \ to raise_error Puppet::Error, %r{(true|false)} @@ -80,6 +80,7 @@ it 'has apache primitive as source of autorequire' do expect(autorequire_relationship.source).to eq apache_primitive end + it 'has apache clone as target of autorequire' do expect(autorequire_relationship.target).to eq apache_clone end @@ -119,6 +120,7 @@ it 'has apache group as source of autorequire' do expect(autorequire_relationship.source).to eq apache_group end + it 'has apache clone as target of autorequire' do expect(autorequire_relationship.target).to eq apache_clone end diff --git a/spec/unit/puppet/type/cs_group_spec.rb b/spec/unit/puppet/type/cs_group_spec.rb index 01faf37a..ca98ad57 100644 --- a/spec/unit/puppet/type/cs_group_spec.rb +++ b/spec/unit/puppet/type/cs_group_spec.rb @@ -17,22 +17,22 @@ expect(subject.new(name: 'mock_group')).not_to be_nil end - [:name, :cib].each do |param| - it "should have a #{param} parameter" do + %i[name cib].each do |param| + it "has a #{param} parameter" do expect(subject).to be_validparameter(param) end - it "should have documentation for its #{param} parameter" do + it "has documentation for its #{param} parameter" do expect(subject.paramclass(param).doc).to be_instance_of(String) end end [:primitives].each do |property| - it "should have a #{property} property" do + it "has a #{property} property" do expect(subject).to be_validproperty(property) end - it "should have documentation for its #{property} property" do + it "has documentation for its #{property} property" do expect(subject.propertybyname(property).doc).to be_instance_of(String) end end @@ -58,6 +58,7 @@ it 'has apache primitive as source of autorequire' do expect(autorequire_relationship.source).to eq apache_primitive end + it 'has apache group as target of autorequire' do expect(autorequire_relationship.target).to eq apache_group end diff --git a/spec/unit/puppet/type/cs_location_spec.rb b/spec/unit/puppet/type/cs_location_spec.rb index a4fb988e..247e4efd 100644 --- a/spec/unit/puppet/type/cs_location_spec.rb +++ b/spec/unit/puppet/type/cs_location_spec.rb @@ -17,22 +17,22 @@ expect(subject.new(name: 'mock_location')).not_to be_nil end - [:name, :cib].each do |param| - it "should have a #{param} parameter" do + %i[name cib].each do |param| + it "has a #{param} parameter" do expect(subject).to be_validparameter(param) end - it "should have documentation for its #{param} parameter" do + it "has documentation for its #{param} parameter" do expect(subject.paramclass(param).doc).to be_instance_of(String) end end - [:primitive, :node_name, :resource_discovery, :score, :rules].each do |property| - it "should have a #{property} property" do + %i[primitive node_name resource_discovery score rules].each do |property| + it "has a #{property} property" do expect(subject).to be_validproperty(property) end - it "should have documentation for its #{property} property" do + it "has documentation for its #{property} property" do expect(subject.propertybyname(property).doc).to be_instance_of(String) end end @@ -58,6 +58,7 @@ it 'has apache primitive as source of autorequire' do expect(autorequire_relationship.source).to eq apache_primitive end + it 'has apache location as target of autorequire' do expect(autorequire_relationship.target).to eq apache_location end @@ -123,6 +124,7 @@ it 'has apache clone as source of autorequire' do expect(autorequire_relationship.source).to eq apache_clone end + it 'has apache location as target of autorequire' do expect(autorequire_relationship.target).to eq apache_location end @@ -147,6 +149,7 @@ it 'has apache group as source of autorequire' do expect(autorequire_relationship.source).to eq apache_group end + it 'has apache location as target of autorequire' do expect(autorequire_relationship.target).to eq apache_location end diff --git a/spec/unit/puppet/type/cs_primitive_spec.rb b/spec/unit/puppet/type/cs_primitive_spec.rb index 4ce95343..98b6a058 100644 --- a/spec/unit/puppet/type/cs_primitive_spec.rb +++ b/spec/unit/puppet/type/cs_primitive_spec.rb @@ -17,37 +17,37 @@ expect(subject.new(name: 'mock_primitive')).not_to be_nil end - [:name, :primitive_class, :primitive_type, :provided_by, :cib].each do |param| - it "should have a #{param} parameter" do + %i[name primitive_class primitive_type provided_by cib].each do |param| + it "has a #{param} parameter" do expect(subject).to be_validparameter(param) end - it "should have documentation for its #{param} parameter" do + it "has documentation for its #{param} parameter" do expect(subject.paramclass(param).doc).to be_instance_of(String) end end - [:parameters, :operations, :metadata].each do |property| - it "should have a #{property} property" do + %i[parameters operations metadata].each do |property| + it "has a #{property} property" do expect(subject).to be_validproperty(property) end - it "should have documentation for its #{property} property" do + it "has documentation for its #{property} property" do expect(subject.propertybyname(property).doc).to be_instance_of(String) end end end describe 'when validating attributes' do - [:parameters, :operations, :metadata].each do |attribute| - it "should validate that the #{attribute} attribute defaults to a hash" do + %i[parameters operations metadata].each do |attribute| + it "validates that the #{attribute} attribute defaults to a hash" do expect(subject.new(name: 'mock_primitive')[:parameters]).to eq({}) end - it "should validate that the #{attribute} attribute must be a hash" do + it "validates that the #{attribute} attribute must be a hash" do expect do subject.new( - name: 'mock_primitive', + name: 'mock_primitive', parameters: 'fail' ) end.to raise_error Puppet::Error, %r{hash} @@ -66,6 +66,7 @@ { 'stop' => { 'interval' => '10' } } ]) end + it 'converts hashes into array' do Puppet.expects(:deprecation_warning).never expect(subject.new( @@ -76,6 +77,7 @@ { 'stop' => { 'interval' => '10' } } ]) end + it 'converts hashes into array with correct roles' do Puppet.expects(:deprecation_warning).once expect(subject.new( @@ -86,6 +88,7 @@ { 'stop' => { 'interval' => '10', 'role' => 'Master' } } ]) end + it 'converts sub-arrays into array' do Puppet.expects(:deprecation_warning).once expect(subject.new( @@ -97,6 +100,7 @@ { 'stop' => { 'interval' => '10' } } ]) end + it 'converts sub-arrays into array with correct roles' do # That case probably never happens in practice Puppet.expects(:deprecation_warning).twice expect(subject.new( diff --git a/spec/unit/puppet/type/cs_property_spec.rb b/spec/unit/puppet/type/cs_property_spec.rb index 49b84dde..64a28463 100644 --- a/spec/unit/puppet/type/cs_property_spec.rb +++ b/spec/unit/puppet/type/cs_property_spec.rb @@ -13,21 +13,21 @@ end [:replace].each do |param| - it "should have a #{param} parameter" do + it "has a #{param} parameter" do expect(subject).to be_validparameter(param) end - it "should have documentation for its #{param} parameter" do + it "has documentation for its #{param} parameter" do expect(subject.paramclass(param).doc).to be_instance_of(String) end end [:value].each do |property| - it "should have a #{property} property" do + it "has a #{property} property" do expect(subject).to be_validproperty(property) end - it "should have documentation for its #{property} property" do + it "has documentation for its #{property} property" do expect(subject.propertybyname(property).doc).to be_instance_of(String) end end From c9635a8fc3e6daa2c799948e85561a5f74106e51 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 17 Jan 2022 10:21:26 +0100 Subject: [PATCH 03/39] rubocop: Fix Style/FrozenStringLiteralComment --- lib/puppet/provider/cs_clone/crm.rb | 1 + lib/puppet/provider/cs_clone/pcs.rb | 1 + lib/puppet/provider/cs_colocation/crm.rb | 1 + lib/puppet/provider/cs_colocation/pcs.rb | 1 + lib/puppet/provider/cs_commit/crm.rb | 1 + lib/puppet/provider/cs_commit/pcs.rb | 1 + lib/puppet/provider/cs_group/crm.rb | 1 + lib/puppet/provider/cs_group/pcs.rb | 1 + lib/puppet/provider/cs_location/crm.rb | 1 + lib/puppet/provider/cs_location/pcs.rb | 1 + lib/puppet/provider/cs_order/crm.rb | 1 + lib/puppet/provider/cs_order/pcs.rb | 1 + lib/puppet/provider/cs_primitive/crm.rb | 1 + lib/puppet/provider/cs_primitive/pcs.rb | 1 + lib/puppet/provider/cs_property/crm.rb | 1 + lib/puppet/provider/cs_property/pcs.rb | 1 + lib/puppet/provider/cs_rsc_defaults/crm.rb | 1 + lib/puppet/provider/cs_rsc_defaults/pcs.rb | 1 + lib/puppet/provider/cs_shadow/crm.rb | 1 + lib/puppet/provider/cs_shadow/pcs.rb | 1 + lib/puppet/type/cs_clone.rb | 1 + lib/puppet/type/cs_colocation.rb | 1 + lib/puppet/type/cs_commit.rb | 1 + lib/puppet/type/cs_group.rb | 1 + lib/puppet/type/cs_location.rb | 1 + lib/puppet/type/cs_order.rb | 1 + lib/puppet/type/cs_primitive.rb | 1 + lib/puppet/type/cs_property.rb | 1 + lib/puppet/type/cs_rsc_defaults.rb | 1 + lib/puppet/type/cs_shadow.rb | 1 + lib/puppet_x/voxpupuli/corosync/provider.rb | 1 + lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb | 1 + lib/puppet_x/voxpupuli/corosync/provider/crmsh.rb | 1 + lib/puppet_x/voxpupuli/corosync/provider/pcs.rb | 1 + spec/acceptance/basic_spec.rb | 1 + spec/acceptance/corosync_class_spec.rb | 1 + spec/acceptance/cs_clone_spec.rb | 1 + spec/acceptance/cs_colocation_spec.rb | 1 + spec/acceptance/cs_commit_spec.rb | 1 + spec/acceptance/cs_group_spec.rb | 1 + spec/acceptance/cs_location_spec.rb | 1 + spec/acceptance/cs_order_spec.rb | 1 + spec/acceptance/cs_primitive_spec.rb | 1 + spec/acceptance/cs_rsc_defaults_spec.rb | 1 + spec/acceptance/cs_shadow_spec.rb | 1 + spec/classes/corosync_qdevice_spec.rb | 1 + spec/classes/corosync_spec.rb | 1 + spec/spec_helper_acceptance.rb | 1 + spec/spec_helper_corosync.rb | 1 + spec/spec_helper_methods.rb | 1 + spec/unit/puppet/provider/cs_clone_crm_spec.rb | 1 + spec/unit/puppet/provider/cs_clone_pcs_spec.rb | 1 + spec/unit/puppet/provider/cs_colocation_crm_spec.rb | 1 + spec/unit/puppet/provider/cs_group_crm_spec.rb | 1 + spec/unit/puppet/provider/cs_group_pcs_spec.rb | 1 + spec/unit/puppet/provider/cs_location_pcs_spec.rb | 1 + spec/unit/puppet/provider/cs_order_crm_spec.rb | 1 + spec/unit/puppet/provider/cs_order_pcs_spec.rb | 1 + spec/unit/puppet/provider/cs_primitive_crm_spec.rb | 1 + spec/unit/puppet/provider/cs_primitive_pcs_spec.rb | 1 + spec/unit/puppet/provider/cs_property_crm_spec.rb | 1 + spec/unit/puppet/provider/cs_property_pcs_spec.rb | 1 + spec/unit/puppet/provider/cs_rsc_defaults_crm_spec.rb | 1 + spec/unit/puppet/provider/cs_rsc_defaults_pcs_spec.rb | 1 + spec/unit/puppet/type/cs_clone_spec.rb | 1 + spec/unit/puppet/type/cs_group_spec.rb | 1 + spec/unit/puppet/type/cs_location_spec.rb | 1 + spec/unit/puppet/type/cs_primitive_spec.rb | 1 + spec/unit/puppet/type/cs_property_spec.rb | 1 + 69 files changed, 69 insertions(+) diff --git a/lib/puppet/provider/cs_clone/crm.rb b/lib/puppet/provider/cs_clone/crm.rb index 0d0df456..0270a813 100644 --- a/lib/puppet/provider/cs_clone/crm.rb +++ b/lib/puppet/provider/cs_clone/crm.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' rescue LoadError diff --git a/lib/puppet/provider/cs_clone/pcs.rb b/lib/puppet/provider/cs_clone/pcs.rb index a0175859..4282810c 100644 --- a/lib/puppet/provider/cs_clone/pcs.rb +++ b/lib/puppet/provider/cs_clone/pcs.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider/pcs' rescue LoadError diff --git a/lib/puppet/provider/cs_colocation/crm.rb b/lib/puppet/provider/cs_colocation/crm.rb index 2b4c8b4a..54b1ccf6 100644 --- a/lib/puppet/provider/cs_colocation/crm.rb +++ b/lib/puppet/provider/cs_colocation/crm.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' rescue LoadError diff --git a/lib/puppet/provider/cs_colocation/pcs.rb b/lib/puppet/provider/cs_colocation/pcs.rb index 3ba8c64f..6623f6ab 100644 --- a/lib/puppet/provider/cs_colocation/pcs.rb +++ b/lib/puppet/provider/cs_colocation/pcs.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider/pcs' rescue LoadError diff --git a/lib/puppet/provider/cs_commit/crm.rb b/lib/puppet/provider/cs_commit/crm.rb index 892bca63..98b59754 100644 --- a/lib/puppet/provider/cs_commit/crm.rb +++ b/lib/puppet/provider/cs_commit/crm.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' rescue LoadError diff --git a/lib/puppet/provider/cs_commit/pcs.rb b/lib/puppet/provider/cs_commit/pcs.rb index 9ac8a66d..248d7799 100644 --- a/lib/puppet/provider/cs_commit/pcs.rb +++ b/lib/puppet/provider/cs_commit/pcs.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider/pcs' rescue LoadError diff --git a/lib/puppet/provider/cs_group/crm.rb b/lib/puppet/provider/cs_group/crm.rb index 22484cd6..5c2eb3c5 100644 --- a/lib/puppet/provider/cs_group/crm.rb +++ b/lib/puppet/provider/cs_group/crm.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' rescue LoadError diff --git a/lib/puppet/provider/cs_group/pcs.rb b/lib/puppet/provider/cs_group/pcs.rb index 0046db03..3d317cb7 100644 --- a/lib/puppet/provider/cs_group/pcs.rb +++ b/lib/puppet/provider/cs_group/pcs.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider/pcs' rescue LoadError diff --git a/lib/puppet/provider/cs_location/crm.rb b/lib/puppet/provider/cs_location/crm.rb index ce524981..e3a8ce70 100644 --- a/lib/puppet/provider/cs_location/crm.rb +++ b/lib/puppet/provider/cs_location/crm.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' rescue LoadError diff --git a/lib/puppet/provider/cs_location/pcs.rb b/lib/puppet/provider/cs_location/pcs.rb index 0211cee6..3b4e8462 100644 --- a/lib/puppet/provider/cs_location/pcs.rb +++ b/lib/puppet/provider/cs_location/pcs.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider/pcs' rescue LoadError diff --git a/lib/puppet/provider/cs_order/crm.rb b/lib/puppet/provider/cs_order/crm.rb index 2f40171c..490a65e3 100644 --- a/lib/puppet/provider/cs_order/crm.rb +++ b/lib/puppet/provider/cs_order/crm.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' rescue LoadError diff --git a/lib/puppet/provider/cs_order/pcs.rb b/lib/puppet/provider/cs_order/pcs.rb index 003ed495..aa8d5939 100644 --- a/lib/puppet/provider/cs_order/pcs.rb +++ b/lib/puppet/provider/cs_order/pcs.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider/pcs' rescue LoadError diff --git a/lib/puppet/provider/cs_primitive/crm.rb b/lib/puppet/provider/cs_primitive/crm.rb index 5ba63221..ab761cd2 100644 --- a/lib/puppet/provider/cs_primitive/crm.rb +++ b/lib/puppet/provider/cs_primitive/crm.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' rescue LoadError diff --git a/lib/puppet/provider/cs_primitive/pcs.rb b/lib/puppet/provider/cs_primitive/pcs.rb index f2f6df8b..897886db 100644 --- a/lib/puppet/provider/cs_primitive/pcs.rb +++ b/lib/puppet/provider/cs_primitive/pcs.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider/pcs' rescue LoadError diff --git a/lib/puppet/provider/cs_property/crm.rb b/lib/puppet/provider/cs_property/crm.rb index f912aceb..af99d7df 100644 --- a/lib/puppet/provider/cs_property/crm.rb +++ b/lib/puppet/provider/cs_property/crm.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' rescue LoadError diff --git a/lib/puppet/provider/cs_property/pcs.rb b/lib/puppet/provider/cs_property/pcs.rb index c0894d88..c8d55b94 100644 --- a/lib/puppet/provider/cs_property/pcs.rb +++ b/lib/puppet/provider/cs_property/pcs.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider/pcs' rescue LoadError diff --git a/lib/puppet/provider/cs_rsc_defaults/crm.rb b/lib/puppet/provider/cs_rsc_defaults/crm.rb index 0ac4c9fe..eb811d91 100644 --- a/lib/puppet/provider/cs_rsc_defaults/crm.rb +++ b/lib/puppet/provider/cs_rsc_defaults/crm.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' rescue LoadError diff --git a/lib/puppet/provider/cs_rsc_defaults/pcs.rb b/lib/puppet/provider/cs_rsc_defaults/pcs.rb index bb587e8c..4e9d730d 100644 --- a/lib/puppet/provider/cs_rsc_defaults/pcs.rb +++ b/lib/puppet/provider/cs_rsc_defaults/pcs.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider/pcs' rescue LoadError diff --git a/lib/puppet/provider/cs_shadow/crm.rb b/lib/puppet/provider/cs_shadow/crm.rb index c599775d..fae446af 100644 --- a/lib/puppet/provider/cs_shadow/crm.rb +++ b/lib/puppet/provider/cs_shadow/crm.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' rescue LoadError diff --git a/lib/puppet/provider/cs_shadow/pcs.rb b/lib/puppet/provider/cs_shadow/pcs.rb index 674d3783..7ab9bcfb 100644 --- a/lib/puppet/provider/cs_shadow/pcs.rb +++ b/lib/puppet/provider/cs_shadow/pcs.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider/pcs' rescue LoadError diff --git a/lib/puppet/type/cs_clone.rb b/lib/puppet/type/cs_clone.rb index 5f9053c4..c67e5d6e 100644 --- a/lib/puppet/type/cs_clone.rb +++ b/lib/puppet/type/cs_clone.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Puppet::Type.newtype(:cs_clone) do @doc = "Type for manipulating corosync/pacemaker resource clone. More information on Corosync/Pacemaker colocation can be found here: diff --git a/lib/puppet/type/cs_colocation.rb b/lib/puppet/type/cs_colocation.rb index 999cd90e..952da255 100644 --- a/lib/puppet/type/cs_colocation.rb +++ b/lib/puppet/type/cs_colocation.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Puppet::Type.newtype(:cs_colocation) do @doc = "Type for manipulating corosync/pacemaker colocation. Colocation is the grouping together of a set of primitives so that they travel diff --git a/lib/puppet/type/cs_commit.rb b/lib/puppet/type/cs_commit.rb index b6accd30..5dd7a355 100644 --- a/lib/puppet/type/cs_commit.rb +++ b/lib/puppet/type/cs_commit.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Puppet::Type.newtype(:cs_commit) do @doc = 'Final commit statement which triggers the synchronous application of all primitive changes which reference this CIB. Do not generate more diff --git a/lib/puppet/type/cs_group.rb b/lib/puppet/type/cs_group.rb index ccf168aa..74cd28d0 100644 --- a/lib/puppet/type/cs_group.rb +++ b/lib/puppet/type/cs_group.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Puppet::Type.newtype(:cs_group) do @doc = "Type for manipulating Corosync/Pacemaker group entries. Groups are a set or resources (primitives) that need to be diff --git a/lib/puppet/type/cs_location.rb b/lib/puppet/type/cs_location.rb index 8104cfcf..08c143de 100644 --- a/lib/puppet/type/cs_location.rb +++ b/lib/puppet/type/cs_location.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Puppet::Type.newtype(:cs_location) do @doc = "Type for manipulating corosync/pacemaker resource location. More information on Corosync/Pacemaker colocation can be found here: diff --git a/lib/puppet/type/cs_order.rb b/lib/puppet/type/cs_order.rb index 0c6efe2c..5c727699 100644 --- a/lib/puppet/type/cs_order.rb +++ b/lib/puppet/type/cs_order.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'puppet/property/boolean' Puppet::Type.newtype(:cs_order) do diff --git a/lib/puppet/type/cs_primitive.rb b/lib/puppet/type/cs_primitive.rb index 77a7e6c7..02afe559 100644 --- a/lib/puppet/type/cs_primitive.rb +++ b/lib/puppet/type/cs_primitive.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'puppet/parameter/boolean' Puppet::Type.newtype(:cs_primitive) do diff --git a/lib/puppet/type/cs_property.rb b/lib/puppet/type/cs_property.rb index 4a9682c3..ff6bd787 100644 --- a/lib/puppet/type/cs_property.rb +++ b/lib/puppet/type/cs_property.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'puppet/parameter/boolean' Puppet::Type.newtype(:cs_property) do diff --git a/lib/puppet/type/cs_rsc_defaults.rb b/lib/puppet/type/cs_rsc_defaults.rb index 2f661723..af44608f 100644 --- a/lib/puppet/type/cs_rsc_defaults.rb +++ b/lib/puppet/type/cs_rsc_defaults.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Puppet::Type.newtype(:cs_rsc_defaults) do @doc = "Type for manipulating corosync/pacemaker global defaults for resource options. The type is pretty simple interface for setting diff --git a/lib/puppet/type/cs_shadow.rb b/lib/puppet/type/cs_shadow.rb index 515a5a4c..984408ea 100644 --- a/lib/puppet/type/cs_shadow.rb +++ b/lib/puppet/type/cs_shadow.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Puppet::Type.newtype(:cs_shadow) do @doc = "cs_shadow resources represent a Corosync shadow CIB. Any corosync resources defined with 'cib' set to the title of a cs_shadow resource diff --git a/lib/puppet_x/voxpupuli/corosync/provider.rb b/lib/puppet_x/voxpupuli/corosync/provider.rb index af9d4dcd..3b9a07ce 100644 --- a/lib/puppet_x/voxpupuli/corosync/provider.rb +++ b/lib/puppet_x/voxpupuli/corosync/provider.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module PuppetX module Voxpupuli module Corosync diff --git a/lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb b/lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb index 86e89e33..bda82adc 100644 --- a/lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb +++ b/lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider' rescue LoadError diff --git a/lib/puppet_x/voxpupuli/corosync/provider/crmsh.rb b/lib/puppet_x/voxpupuli/corosync/provider/crmsh.rb index cecc73f6..c923221f 100644 --- a/lib/puppet_x/voxpupuli/corosync/provider/crmsh.rb +++ b/lib/puppet_x/voxpupuli/corosync/provider/crmsh.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider' require 'puppet_x/voxpupuli/corosync/provider/cib_helper' diff --git a/lib/puppet_x/voxpupuli/corosync/provider/pcs.rb b/lib/puppet_x/voxpupuli/corosync/provider/pcs.rb index 59d548bb..814560dd 100644 --- a/lib/puppet_x/voxpupuli/corosync/provider/pcs.rb +++ b/lib/puppet_x/voxpupuli/corosync/provider/pcs.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'puppet_x/voxpupuli/corosync/provider' require 'puppet_x/voxpupuli/corosync/provider/cib_helper' diff --git a/spec/acceptance/basic_spec.rb b/spec/acceptance/basic_spec.rb index 2b00cfde..3aa0d03e 100644 --- a/spec/acceptance/basic_spec.rb +++ b/spec/acceptance/basic_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper_acceptance' # These tests are designed to ensure that the module, when ran with defaults, diff --git a/spec/acceptance/corosync_class_spec.rb b/spec/acceptance/corosync_class_spec.rb index af26682c..2665fd46 100644 --- a/spec/acceptance/corosync_class_spec.rb +++ b/spec/acceptance/corosync_class_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper_acceptance' # These tests are designed to ensure that the module, when ran with defaults, diff --git a/spec/acceptance/cs_clone_spec.rb b/spec/acceptance/cs_clone_spec.rb index c0168a8f..5dfad0c1 100755 --- a/spec/acceptance/cs_clone_spec.rb +++ b/spec/acceptance/cs_clone_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper_acceptance' describe 'corosync' do diff --git a/spec/acceptance/cs_colocation_spec.rb b/spec/acceptance/cs_colocation_spec.rb index 8da7136c..32016832 100644 --- a/spec/acceptance/cs_colocation_spec.rb +++ b/spec/acceptance/cs_colocation_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper_acceptance' describe 'corosync' do diff --git a/spec/acceptance/cs_commit_spec.rb b/spec/acceptance/cs_commit_spec.rb index 64ec12f0..fe7c12f6 100644 --- a/spec/acceptance/cs_commit_spec.rb +++ b/spec/acceptance/cs_commit_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper_acceptance' describe 'corosync' do diff --git a/spec/acceptance/cs_group_spec.rb b/spec/acceptance/cs_group_spec.rb index 72a3d904..689f5348 100755 --- a/spec/acceptance/cs_group_spec.rb +++ b/spec/acceptance/cs_group_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper_acceptance' describe 'corosync' do diff --git a/spec/acceptance/cs_location_spec.rb b/spec/acceptance/cs_location_spec.rb index 7b5fa7c0..8f6f6d07 100755 --- a/spec/acceptance/cs_location_spec.rb +++ b/spec/acceptance/cs_location_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper_acceptance' describe 'corosync' do diff --git a/spec/acceptance/cs_order_spec.rb b/spec/acceptance/cs_order_spec.rb index 9d5396f4..e568cb65 100644 --- a/spec/acceptance/cs_order_spec.rb +++ b/spec/acceptance/cs_order_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper_acceptance' describe 'corosync' do diff --git a/spec/acceptance/cs_primitive_spec.rb b/spec/acceptance/cs_primitive_spec.rb index 5736788a..9023deb7 100644 --- a/spec/acceptance/cs_primitive_spec.rb +++ b/spec/acceptance/cs_primitive_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper_acceptance' require 'pry' diff --git a/spec/acceptance/cs_rsc_defaults_spec.rb b/spec/acceptance/cs_rsc_defaults_spec.rb index 3fa942dc..7a67e55c 100644 --- a/spec/acceptance/cs_rsc_defaults_spec.rb +++ b/spec/acceptance/cs_rsc_defaults_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper_acceptance' describe 'corosync' do diff --git a/spec/acceptance/cs_shadow_spec.rb b/spec/acceptance/cs_shadow_spec.rb index c9230e67..afb288b9 100644 --- a/spec/acceptance/cs_shadow_spec.rb +++ b/spec/acceptance/cs_shadow_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper_acceptance' describe 'corosync' do diff --git a/spec/classes/corosync_qdevice_spec.rb b/spec/classes/corosync_qdevice_spec.rb index ca20e505..54afdf23 100644 --- a/spec/classes/corosync_qdevice_spec.rb +++ b/spec/classes/corosync_qdevice_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe 'corosync::qdevice' do diff --git a/spec/classes/corosync_spec.rb b/spec/classes/corosync_spec.rb index 5184f168..fab88f12 100644 --- a/spec/classes/corosync_spec.rb +++ b/spec/classes/corosync_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe 'corosync' do diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 43de9a98..43889438 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'voxpupuli/acceptance/spec_helper_acceptance' configure_beaker do |host| diff --git a/spec/spec_helper_corosync.rb b/spec/spec_helper_corosync.rb index 2bb231e2..4d23fd26 100644 --- a/spec/spec_helper_corosync.rb +++ b/spec/spec_helper_corosync.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # This file contains helpers that are specific to this module def corosync_stack(facts) diff --git a/spec/spec_helper_methods.rb b/spec/spec_helper_methods.rb index 0b621af5..352b7935 100644 --- a/spec/spec_helper_methods.rb +++ b/spec/spec_helper_methods.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true RSpec.configure do |c| c.alias_it_should_behave_like_to :it_configures, 'configures' c.expect_with :rspec do |r| diff --git a/spec/unit/puppet/provider/cs_clone_crm_spec.rb b/spec/unit/puppet/provider/cs_clone_crm_spec.rb index a715bc54..0eee9c32 100644 --- a/spec/unit/puppet/provider/cs_clone_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_clone_crm_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe Puppet::Type.type(:cs_clone).provider(:crm) do diff --git a/spec/unit/puppet/provider/cs_clone_pcs_spec.rb b/spec/unit/puppet/provider/cs_clone_pcs_spec.rb index 65cd18ea..441f6bb9 100644 --- a/spec/unit/puppet/provider/cs_clone_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_clone_pcs_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' require 'spec_helper_corosync' diff --git a/spec/unit/puppet/provider/cs_colocation_crm_spec.rb b/spec/unit/puppet/provider/cs_colocation_crm_spec.rb index 56c34412..38bfec3b 100644 --- a/spec/unit/puppet/provider/cs_colocation_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_colocation_crm_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe Puppet::Type.type(:cs_colocation).provider(:crm) do diff --git a/spec/unit/puppet/provider/cs_group_crm_spec.rb b/spec/unit/puppet/provider/cs_group_crm_spec.rb index 2d9e789d..8c202c26 100644 --- a/spec/unit/puppet/provider/cs_group_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_group_crm_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe Puppet::Type.type(:cs_group).provider(:crm) do diff --git a/spec/unit/puppet/provider/cs_group_pcs_spec.rb b/spec/unit/puppet/provider/cs_group_pcs_spec.rb index dc1d8dc2..77279690 100644 --- a/spec/unit/puppet/provider/cs_group_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_group_pcs_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe Puppet::Type.type(:cs_group).provider(:pcs) do diff --git a/spec/unit/puppet/provider/cs_location_pcs_spec.rb b/spec/unit/puppet/provider/cs_location_pcs_spec.rb index d1dc3221..ec7e075a 100644 --- a/spec/unit/puppet/provider/cs_location_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_location_pcs_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe Puppet::Type.type(:cs_location).provider(:pcs) do diff --git a/spec/unit/puppet/provider/cs_order_crm_spec.rb b/spec/unit/puppet/provider/cs_order_crm_spec.rb index a51646ae..bb8ee029 100644 --- a/spec/unit/puppet/provider/cs_order_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_order_crm_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe Puppet::Type.type(:cs_order).provider(:crm) do diff --git a/spec/unit/puppet/provider/cs_order_pcs_spec.rb b/spec/unit/puppet/provider/cs_order_pcs_spec.rb index 24bc722a..a9872c9e 100644 --- a/spec/unit/puppet/provider/cs_order_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_order_pcs_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe Puppet::Type.type(:cs_order).provider(:pcs) do diff --git a/spec/unit/puppet/provider/cs_primitive_crm_spec.rb b/spec/unit/puppet/provider/cs_primitive_crm_spec.rb index 774c027f..a36c2adb 100644 --- a/spec/unit/puppet/provider/cs_primitive_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_primitive_crm_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe Puppet::Type.type(:cs_primitive).provider(:crm) do diff --git a/spec/unit/puppet/provider/cs_primitive_pcs_spec.rb b/spec/unit/puppet/provider/cs_primitive_pcs_spec.rb index 32849273..3c6cd427 100644 --- a/spec/unit/puppet/provider/cs_primitive_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_primitive_pcs_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' require 'spec_helper_corosync' diff --git a/spec/unit/puppet/provider/cs_property_crm_spec.rb b/spec/unit/puppet/provider/cs_property_crm_spec.rb index 6e6ddc07..ba716e63 100644 --- a/spec/unit/puppet/provider/cs_property_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_property_crm_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe Puppet::Type.type(:cs_property).provider(:crm) do diff --git a/spec/unit/puppet/provider/cs_property_pcs_spec.rb b/spec/unit/puppet/provider/cs_property_pcs_spec.rb index 4355999e..2d37067a 100644 --- a/spec/unit/puppet/provider/cs_property_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_property_pcs_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe Puppet::Type.type(:cs_property).provider(:pcs) do diff --git a/spec/unit/puppet/provider/cs_rsc_defaults_crm_spec.rb b/spec/unit/puppet/provider/cs_rsc_defaults_crm_spec.rb index 016faf7b..c1d992a3 100644 --- a/spec/unit/puppet/provider/cs_rsc_defaults_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_rsc_defaults_crm_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe Puppet::Type.type(:cs_rsc_defaults).provider(:crm) do diff --git a/spec/unit/puppet/provider/cs_rsc_defaults_pcs_spec.rb b/spec/unit/puppet/provider/cs_rsc_defaults_pcs_spec.rb index cf41c400..d8075225 100644 --- a/spec/unit/puppet/provider/cs_rsc_defaults_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_rsc_defaults_pcs_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe Puppet::Type.type(:cs_rsc_defaults).provider(:pcs) do diff --git a/spec/unit/puppet/type/cs_clone_spec.rb b/spec/unit/puppet/type/cs_clone_spec.rb index e7e52051..f6176c42 100644 --- a/spec/unit/puppet/type/cs_clone_spec.rb +++ b/spec/unit/puppet/type/cs_clone_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe Puppet::Type.type(:cs_clone) do diff --git a/spec/unit/puppet/type/cs_group_spec.rb b/spec/unit/puppet/type/cs_group_spec.rb index ca98ad57..7efd35e0 100644 --- a/spec/unit/puppet/type/cs_group_spec.rb +++ b/spec/unit/puppet/type/cs_group_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe Puppet::Type.type(:cs_group) do diff --git a/spec/unit/puppet/type/cs_location_spec.rb b/spec/unit/puppet/type/cs_location_spec.rb index 247e4efd..dabcfd47 100644 --- a/spec/unit/puppet/type/cs_location_spec.rb +++ b/spec/unit/puppet/type/cs_location_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe Puppet::Type.type(:cs_location) do diff --git a/spec/unit/puppet/type/cs_primitive_spec.rb b/spec/unit/puppet/type/cs_primitive_spec.rb index 98b6a058..baface1b 100644 --- a/spec/unit/puppet/type/cs_primitive_spec.rb +++ b/spec/unit/puppet/type/cs_primitive_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe Puppet::Type.type(:cs_primitive) do diff --git a/spec/unit/puppet/type/cs_property_spec.rb b/spec/unit/puppet/type/cs_property_spec.rb index 64a28463..7301ba10 100644 --- a/spec/unit/puppet/type/cs_property_spec.rb +++ b/spec/unit/puppet/type/cs_property_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' describe Puppet::Type.type(:cs_property) do From 067f685afe9ac07c733b037e9c45fb6bb959fbbb Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 17 Jan 2022 10:30:05 +0100 Subject: [PATCH 04/39] rubocop: Fix Layout/EmptyLineAfterMagicComment --- lib/puppet/provider/cs_clone/crm.rb | 1 + lib/puppet/provider/cs_clone/pcs.rb | 1 + lib/puppet/provider/cs_colocation/crm.rb | 1 + lib/puppet/provider/cs_colocation/pcs.rb | 1 + lib/puppet/provider/cs_commit/crm.rb | 1 + lib/puppet/provider/cs_commit/pcs.rb | 1 + lib/puppet/provider/cs_group/crm.rb | 1 + lib/puppet/provider/cs_group/pcs.rb | 1 + lib/puppet/provider/cs_location/crm.rb | 1 + lib/puppet/provider/cs_location/pcs.rb | 1 + lib/puppet/provider/cs_order/crm.rb | 1 + lib/puppet/provider/cs_order/pcs.rb | 1 + lib/puppet/provider/cs_primitive/crm.rb | 1 + lib/puppet/provider/cs_primitive/pcs.rb | 1 + lib/puppet/provider/cs_property/crm.rb | 1 + lib/puppet/provider/cs_property/pcs.rb | 1 + lib/puppet/provider/cs_rsc_defaults/crm.rb | 1 + lib/puppet/provider/cs_rsc_defaults/pcs.rb | 1 + lib/puppet/provider/cs_shadow/crm.rb | 1 + lib/puppet/provider/cs_shadow/pcs.rb | 1 + lib/puppet/type/cs_clone.rb | 1 + lib/puppet/type/cs_colocation.rb | 1 + lib/puppet/type/cs_commit.rb | 1 + lib/puppet/type/cs_group.rb | 1 + lib/puppet/type/cs_location.rb | 1 + lib/puppet/type/cs_order.rb | 1 + lib/puppet/type/cs_primitive.rb | 1 + lib/puppet/type/cs_property.rb | 1 + lib/puppet/type/cs_rsc_defaults.rb | 1 + lib/puppet/type/cs_shadow.rb | 1 + lib/puppet_x/voxpupuli/corosync/provider.rb | 1 + lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb | 1 + lib/puppet_x/voxpupuli/corosync/provider/crmsh.rb | 1 + lib/puppet_x/voxpupuli/corosync/provider/pcs.rb | 1 + spec/acceptance/basic_spec.rb | 1 + spec/acceptance/corosync_class_spec.rb | 1 + spec/acceptance/cs_clone_spec.rb | 1 + spec/acceptance/cs_colocation_spec.rb | 1 + spec/acceptance/cs_commit_spec.rb | 1 + spec/acceptance/cs_group_spec.rb | 1 + spec/acceptance/cs_location_spec.rb | 1 + spec/acceptance/cs_order_spec.rb | 1 + spec/acceptance/cs_primitive_spec.rb | 1 + spec/acceptance/cs_rsc_defaults_spec.rb | 1 + spec/acceptance/cs_shadow_spec.rb | 1 + spec/classes/corosync_qdevice_spec.rb | 1 + spec/classes/corosync_spec.rb | 1 + spec/spec_helper_acceptance.rb | 1 + spec/spec_helper_corosync.rb | 1 + spec/spec_helper_methods.rb | 1 + spec/unit/puppet/provider/cs_clone_crm_spec.rb | 1 + spec/unit/puppet/provider/cs_clone_pcs_spec.rb | 1 + spec/unit/puppet/provider/cs_colocation_crm_spec.rb | 1 + spec/unit/puppet/provider/cs_group_crm_spec.rb | 1 + spec/unit/puppet/provider/cs_group_pcs_spec.rb | 1 + spec/unit/puppet/provider/cs_location_pcs_spec.rb | 1 + spec/unit/puppet/provider/cs_order_crm_spec.rb | 1 + spec/unit/puppet/provider/cs_order_pcs_spec.rb | 1 + spec/unit/puppet/provider/cs_primitive_crm_spec.rb | 1 + spec/unit/puppet/provider/cs_primitive_pcs_spec.rb | 1 + spec/unit/puppet/provider/cs_property_crm_spec.rb | 1 + spec/unit/puppet/provider/cs_property_pcs_spec.rb | 1 + spec/unit/puppet/provider/cs_rsc_defaults_crm_spec.rb | 1 + spec/unit/puppet/provider/cs_rsc_defaults_pcs_spec.rb | 1 + spec/unit/puppet/type/cs_clone_spec.rb | 1 + spec/unit/puppet/type/cs_group_spec.rb | 1 + spec/unit/puppet/type/cs_location_spec.rb | 1 + spec/unit/puppet/type/cs_primitive_spec.rb | 1 + spec/unit/puppet/type/cs_property_spec.rb | 1 + 69 files changed, 69 insertions(+) diff --git a/lib/puppet/provider/cs_clone/crm.rb b/lib/puppet/provider/cs_clone/crm.rb index 0270a813..a6cda367 100644 --- a/lib/puppet/provider/cs_clone/crm.rb +++ b/lib/puppet/provider/cs_clone/crm.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' rescue LoadError diff --git a/lib/puppet/provider/cs_clone/pcs.rb b/lib/puppet/provider/cs_clone/pcs.rb index 4282810c..5dee868f 100644 --- a/lib/puppet/provider/cs_clone/pcs.rb +++ b/lib/puppet/provider/cs_clone/pcs.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider/pcs' rescue LoadError diff --git a/lib/puppet/provider/cs_colocation/crm.rb b/lib/puppet/provider/cs_colocation/crm.rb index 54b1ccf6..b6a5453b 100644 --- a/lib/puppet/provider/cs_colocation/crm.rb +++ b/lib/puppet/provider/cs_colocation/crm.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' rescue LoadError diff --git a/lib/puppet/provider/cs_colocation/pcs.rb b/lib/puppet/provider/cs_colocation/pcs.rb index 6623f6ab..0b008a42 100644 --- a/lib/puppet/provider/cs_colocation/pcs.rb +++ b/lib/puppet/provider/cs_colocation/pcs.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider/pcs' rescue LoadError diff --git a/lib/puppet/provider/cs_commit/crm.rb b/lib/puppet/provider/cs_commit/crm.rb index 98b59754..8fe2504a 100644 --- a/lib/puppet/provider/cs_commit/crm.rb +++ b/lib/puppet/provider/cs_commit/crm.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' rescue LoadError diff --git a/lib/puppet/provider/cs_commit/pcs.rb b/lib/puppet/provider/cs_commit/pcs.rb index 248d7799..1decf0e3 100644 --- a/lib/puppet/provider/cs_commit/pcs.rb +++ b/lib/puppet/provider/cs_commit/pcs.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider/pcs' rescue LoadError diff --git a/lib/puppet/provider/cs_group/crm.rb b/lib/puppet/provider/cs_group/crm.rb index 5c2eb3c5..fa115700 100644 --- a/lib/puppet/provider/cs_group/crm.rb +++ b/lib/puppet/provider/cs_group/crm.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' rescue LoadError diff --git a/lib/puppet/provider/cs_group/pcs.rb b/lib/puppet/provider/cs_group/pcs.rb index 3d317cb7..8e3a7702 100644 --- a/lib/puppet/provider/cs_group/pcs.rb +++ b/lib/puppet/provider/cs_group/pcs.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider/pcs' rescue LoadError diff --git a/lib/puppet/provider/cs_location/crm.rb b/lib/puppet/provider/cs_location/crm.rb index e3a8ce70..98ff9f01 100644 --- a/lib/puppet/provider/cs_location/crm.rb +++ b/lib/puppet/provider/cs_location/crm.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' rescue LoadError diff --git a/lib/puppet/provider/cs_location/pcs.rb b/lib/puppet/provider/cs_location/pcs.rb index 3b4e8462..0218be1f 100644 --- a/lib/puppet/provider/cs_location/pcs.rb +++ b/lib/puppet/provider/cs_location/pcs.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider/pcs' rescue LoadError diff --git a/lib/puppet/provider/cs_order/crm.rb b/lib/puppet/provider/cs_order/crm.rb index 490a65e3..62f1278d 100644 --- a/lib/puppet/provider/cs_order/crm.rb +++ b/lib/puppet/provider/cs_order/crm.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' rescue LoadError diff --git a/lib/puppet/provider/cs_order/pcs.rb b/lib/puppet/provider/cs_order/pcs.rb index aa8d5939..d5e08179 100644 --- a/lib/puppet/provider/cs_order/pcs.rb +++ b/lib/puppet/provider/cs_order/pcs.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider/pcs' rescue LoadError diff --git a/lib/puppet/provider/cs_primitive/crm.rb b/lib/puppet/provider/cs_primitive/crm.rb index ab761cd2..be1e0007 100644 --- a/lib/puppet/provider/cs_primitive/crm.rb +++ b/lib/puppet/provider/cs_primitive/crm.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' rescue LoadError diff --git a/lib/puppet/provider/cs_primitive/pcs.rb b/lib/puppet/provider/cs_primitive/pcs.rb index 897886db..7eb5f466 100644 --- a/lib/puppet/provider/cs_primitive/pcs.rb +++ b/lib/puppet/provider/cs_primitive/pcs.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider/pcs' rescue LoadError diff --git a/lib/puppet/provider/cs_property/crm.rb b/lib/puppet/provider/cs_property/crm.rb index af99d7df..119ea3ad 100644 --- a/lib/puppet/provider/cs_property/crm.rb +++ b/lib/puppet/provider/cs_property/crm.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' rescue LoadError diff --git a/lib/puppet/provider/cs_property/pcs.rb b/lib/puppet/provider/cs_property/pcs.rb index c8d55b94..60e3bd83 100644 --- a/lib/puppet/provider/cs_property/pcs.rb +++ b/lib/puppet/provider/cs_property/pcs.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider/pcs' rescue LoadError diff --git a/lib/puppet/provider/cs_rsc_defaults/crm.rb b/lib/puppet/provider/cs_rsc_defaults/crm.rb index eb811d91..493e3f72 100644 --- a/lib/puppet/provider/cs_rsc_defaults/crm.rb +++ b/lib/puppet/provider/cs_rsc_defaults/crm.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' rescue LoadError diff --git a/lib/puppet/provider/cs_rsc_defaults/pcs.rb b/lib/puppet/provider/cs_rsc_defaults/pcs.rb index 4e9d730d..6433d3bd 100644 --- a/lib/puppet/provider/cs_rsc_defaults/pcs.rb +++ b/lib/puppet/provider/cs_rsc_defaults/pcs.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider/pcs' rescue LoadError diff --git a/lib/puppet/provider/cs_shadow/crm.rb b/lib/puppet/provider/cs_shadow/crm.rb index fae446af..158e56b3 100644 --- a/lib/puppet/provider/cs_shadow/crm.rb +++ b/lib/puppet/provider/cs_shadow/crm.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' rescue LoadError diff --git a/lib/puppet/provider/cs_shadow/pcs.rb b/lib/puppet/provider/cs_shadow/pcs.rb index 7ab9bcfb..d89d9ea1 100644 --- a/lib/puppet/provider/cs_shadow/pcs.rb +++ b/lib/puppet/provider/cs_shadow/pcs.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider/pcs' rescue LoadError diff --git a/lib/puppet/type/cs_clone.rb b/lib/puppet/type/cs_clone.rb index c67e5d6e..5b89c58d 100644 --- a/lib/puppet/type/cs_clone.rb +++ b/lib/puppet/type/cs_clone.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + Puppet::Type.newtype(:cs_clone) do @doc = "Type for manipulating corosync/pacemaker resource clone. More information on Corosync/Pacemaker colocation can be found here: diff --git a/lib/puppet/type/cs_colocation.rb b/lib/puppet/type/cs_colocation.rb index 952da255..2b6fca37 100644 --- a/lib/puppet/type/cs_colocation.rb +++ b/lib/puppet/type/cs_colocation.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + Puppet::Type.newtype(:cs_colocation) do @doc = "Type for manipulating corosync/pacemaker colocation. Colocation is the grouping together of a set of primitives so that they travel diff --git a/lib/puppet/type/cs_commit.rb b/lib/puppet/type/cs_commit.rb index 5dd7a355..5eec406f 100644 --- a/lib/puppet/type/cs_commit.rb +++ b/lib/puppet/type/cs_commit.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + Puppet::Type.newtype(:cs_commit) do @doc = 'Final commit statement which triggers the synchronous application of all primitive changes which reference this CIB. Do not generate more diff --git a/lib/puppet/type/cs_group.rb b/lib/puppet/type/cs_group.rb index 74cd28d0..8d00d8c4 100644 --- a/lib/puppet/type/cs_group.rb +++ b/lib/puppet/type/cs_group.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + Puppet::Type.newtype(:cs_group) do @doc = "Type for manipulating Corosync/Pacemaker group entries. Groups are a set or resources (primitives) that need to be diff --git a/lib/puppet/type/cs_location.rb b/lib/puppet/type/cs_location.rb index 08c143de..f7a193e0 100644 --- a/lib/puppet/type/cs_location.rb +++ b/lib/puppet/type/cs_location.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + Puppet::Type.newtype(:cs_location) do @doc = "Type for manipulating corosync/pacemaker resource location. More information on Corosync/Pacemaker colocation can be found here: diff --git a/lib/puppet/type/cs_order.rb b/lib/puppet/type/cs_order.rb index 5c727699..be69dc09 100644 --- a/lib/puppet/type/cs_order.rb +++ b/lib/puppet/type/cs_order.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'puppet/property/boolean' Puppet::Type.newtype(:cs_order) do diff --git a/lib/puppet/type/cs_primitive.rb b/lib/puppet/type/cs_primitive.rb index 02afe559..d91d4ad4 100644 --- a/lib/puppet/type/cs_primitive.rb +++ b/lib/puppet/type/cs_primitive.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'puppet/parameter/boolean' Puppet::Type.newtype(:cs_primitive) do diff --git a/lib/puppet/type/cs_property.rb b/lib/puppet/type/cs_property.rb index ff6bd787..d898ef63 100644 --- a/lib/puppet/type/cs_property.rb +++ b/lib/puppet/type/cs_property.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'puppet/parameter/boolean' Puppet::Type.newtype(:cs_property) do diff --git a/lib/puppet/type/cs_rsc_defaults.rb b/lib/puppet/type/cs_rsc_defaults.rb index af44608f..9c2b57fb 100644 --- a/lib/puppet/type/cs_rsc_defaults.rb +++ b/lib/puppet/type/cs_rsc_defaults.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + Puppet::Type.newtype(:cs_rsc_defaults) do @doc = "Type for manipulating corosync/pacemaker global defaults for resource options. The type is pretty simple interface for setting diff --git a/lib/puppet/type/cs_shadow.rb b/lib/puppet/type/cs_shadow.rb index 984408ea..292333ad 100644 --- a/lib/puppet/type/cs_shadow.rb +++ b/lib/puppet/type/cs_shadow.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + Puppet::Type.newtype(:cs_shadow) do @doc = "cs_shadow resources represent a Corosync shadow CIB. Any corosync resources defined with 'cib' set to the title of a cs_shadow resource diff --git a/lib/puppet_x/voxpupuli/corosync/provider.rb b/lib/puppet_x/voxpupuli/corosync/provider.rb index 3b9a07ce..3eeda94d 100644 --- a/lib/puppet_x/voxpupuli/corosync/provider.rb +++ b/lib/puppet_x/voxpupuli/corosync/provider.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module PuppetX module Voxpupuli module Corosync diff --git a/lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb b/lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb index bda82adc..8549206e 100644 --- a/lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb +++ b/lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider' rescue LoadError diff --git a/lib/puppet_x/voxpupuli/corosync/provider/crmsh.rb b/lib/puppet_x/voxpupuli/corosync/provider/crmsh.rb index c923221f..c6d0f51d 100644 --- a/lib/puppet_x/voxpupuli/corosync/provider/crmsh.rb +++ b/lib/puppet_x/voxpupuli/corosync/provider/crmsh.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider' require 'puppet_x/voxpupuli/corosync/provider/cib_helper' diff --git a/lib/puppet_x/voxpupuli/corosync/provider/pcs.rb b/lib/puppet_x/voxpupuli/corosync/provider/pcs.rb index 814560dd..5333c9d0 100644 --- a/lib/puppet_x/voxpupuli/corosync/provider/pcs.rb +++ b/lib/puppet_x/voxpupuli/corosync/provider/pcs.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + begin require 'puppet_x/voxpupuli/corosync/provider' require 'puppet_x/voxpupuli/corosync/provider/cib_helper' diff --git a/spec/acceptance/basic_spec.rb b/spec/acceptance/basic_spec.rb index 3aa0d03e..b620278c 100644 --- a/spec/acceptance/basic_spec.rb +++ b/spec/acceptance/basic_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper_acceptance' # These tests are designed to ensure that the module, when ran with defaults, diff --git a/spec/acceptance/corosync_class_spec.rb b/spec/acceptance/corosync_class_spec.rb index 2665fd46..1d0c49a9 100644 --- a/spec/acceptance/corosync_class_spec.rb +++ b/spec/acceptance/corosync_class_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper_acceptance' # These tests are designed to ensure that the module, when ran with defaults, diff --git a/spec/acceptance/cs_clone_spec.rb b/spec/acceptance/cs_clone_spec.rb index 5dfad0c1..9d251b7e 100755 --- a/spec/acceptance/cs_clone_spec.rb +++ b/spec/acceptance/cs_clone_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper_acceptance' describe 'corosync' do diff --git a/spec/acceptance/cs_colocation_spec.rb b/spec/acceptance/cs_colocation_spec.rb index 32016832..9b5948fc 100644 --- a/spec/acceptance/cs_colocation_spec.rb +++ b/spec/acceptance/cs_colocation_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper_acceptance' describe 'corosync' do diff --git a/spec/acceptance/cs_commit_spec.rb b/spec/acceptance/cs_commit_spec.rb index fe7c12f6..ec3fdeb4 100644 --- a/spec/acceptance/cs_commit_spec.rb +++ b/spec/acceptance/cs_commit_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper_acceptance' describe 'corosync' do diff --git a/spec/acceptance/cs_group_spec.rb b/spec/acceptance/cs_group_spec.rb index 689f5348..b933ccc2 100755 --- a/spec/acceptance/cs_group_spec.rb +++ b/spec/acceptance/cs_group_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper_acceptance' describe 'corosync' do diff --git a/spec/acceptance/cs_location_spec.rb b/spec/acceptance/cs_location_spec.rb index 8f6f6d07..f4a91846 100755 --- a/spec/acceptance/cs_location_spec.rb +++ b/spec/acceptance/cs_location_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper_acceptance' describe 'corosync' do diff --git a/spec/acceptance/cs_order_spec.rb b/spec/acceptance/cs_order_spec.rb index e568cb65..c4c58b3f 100644 --- a/spec/acceptance/cs_order_spec.rb +++ b/spec/acceptance/cs_order_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper_acceptance' describe 'corosync' do diff --git a/spec/acceptance/cs_primitive_spec.rb b/spec/acceptance/cs_primitive_spec.rb index 9023deb7..d9b56389 100644 --- a/spec/acceptance/cs_primitive_spec.rb +++ b/spec/acceptance/cs_primitive_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper_acceptance' require 'pry' diff --git a/spec/acceptance/cs_rsc_defaults_spec.rb b/spec/acceptance/cs_rsc_defaults_spec.rb index 7a67e55c..625ca039 100644 --- a/spec/acceptance/cs_rsc_defaults_spec.rb +++ b/spec/acceptance/cs_rsc_defaults_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper_acceptance' describe 'corosync' do diff --git a/spec/acceptance/cs_shadow_spec.rb b/spec/acceptance/cs_shadow_spec.rb index afb288b9..090d45d7 100644 --- a/spec/acceptance/cs_shadow_spec.rb +++ b/spec/acceptance/cs_shadow_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper_acceptance' describe 'corosync' do diff --git a/spec/classes/corosync_qdevice_spec.rb b/spec/classes/corosync_qdevice_spec.rb index 54afdf23..799b8db3 100644 --- a/spec/classes/corosync_qdevice_spec.rb +++ b/spec/classes/corosync_qdevice_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe 'corosync::qdevice' do diff --git a/spec/classes/corosync_spec.rb b/spec/classes/corosync_spec.rb index fab88f12..ec970c27 100644 --- a/spec/classes/corosync_spec.rb +++ b/spec/classes/corosync_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe 'corosync' do diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 43889438..cf08b0ea 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'voxpupuli/acceptance/spec_helper_acceptance' configure_beaker do |host| diff --git a/spec/spec_helper_corosync.rb b/spec/spec_helper_corosync.rb index 4d23fd26..06ea4f78 100644 --- a/spec/spec_helper_corosync.rb +++ b/spec/spec_helper_corosync.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file contains helpers that are specific to this module def corosync_stack(facts) diff --git a/spec/spec_helper_methods.rb b/spec/spec_helper_methods.rb index 352b7935..1e3408ec 100644 --- a/spec/spec_helper_methods.rb +++ b/spec/spec_helper_methods.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + RSpec.configure do |c| c.alias_it_should_behave_like_to :it_configures, 'configures' c.expect_with :rspec do |r| diff --git a/spec/unit/puppet/provider/cs_clone_crm_spec.rb b/spec/unit/puppet/provider/cs_clone_crm_spec.rb index 0eee9c32..dc83fb7a 100644 --- a/spec/unit/puppet/provider/cs_clone_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_clone_crm_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Puppet::Type.type(:cs_clone).provider(:crm) do diff --git a/spec/unit/puppet/provider/cs_clone_pcs_spec.rb b/spec/unit/puppet/provider/cs_clone_pcs_spec.rb index 441f6bb9..d471adc5 100644 --- a/spec/unit/puppet/provider/cs_clone_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_clone_pcs_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' require 'spec_helper_corosync' diff --git a/spec/unit/puppet/provider/cs_colocation_crm_spec.rb b/spec/unit/puppet/provider/cs_colocation_crm_spec.rb index 38bfec3b..b3e618e2 100644 --- a/spec/unit/puppet/provider/cs_colocation_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_colocation_crm_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Puppet::Type.type(:cs_colocation).provider(:crm) do diff --git a/spec/unit/puppet/provider/cs_group_crm_spec.rb b/spec/unit/puppet/provider/cs_group_crm_spec.rb index 8c202c26..6817f404 100644 --- a/spec/unit/puppet/provider/cs_group_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_group_crm_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Puppet::Type.type(:cs_group).provider(:crm) do diff --git a/spec/unit/puppet/provider/cs_group_pcs_spec.rb b/spec/unit/puppet/provider/cs_group_pcs_spec.rb index 77279690..df12e322 100644 --- a/spec/unit/puppet/provider/cs_group_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_group_pcs_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Puppet::Type.type(:cs_group).provider(:pcs) do diff --git a/spec/unit/puppet/provider/cs_location_pcs_spec.rb b/spec/unit/puppet/provider/cs_location_pcs_spec.rb index ec7e075a..5941ffc8 100644 --- a/spec/unit/puppet/provider/cs_location_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_location_pcs_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Puppet::Type.type(:cs_location).provider(:pcs) do diff --git a/spec/unit/puppet/provider/cs_order_crm_spec.rb b/spec/unit/puppet/provider/cs_order_crm_spec.rb index bb8ee029..91109243 100644 --- a/spec/unit/puppet/provider/cs_order_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_order_crm_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Puppet::Type.type(:cs_order).provider(:crm) do diff --git a/spec/unit/puppet/provider/cs_order_pcs_spec.rb b/spec/unit/puppet/provider/cs_order_pcs_spec.rb index a9872c9e..a9f4812f 100644 --- a/spec/unit/puppet/provider/cs_order_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_order_pcs_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Puppet::Type.type(:cs_order).provider(:pcs) do diff --git a/spec/unit/puppet/provider/cs_primitive_crm_spec.rb b/spec/unit/puppet/provider/cs_primitive_crm_spec.rb index a36c2adb..77c552dd 100644 --- a/spec/unit/puppet/provider/cs_primitive_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_primitive_crm_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Puppet::Type.type(:cs_primitive).provider(:crm) do diff --git a/spec/unit/puppet/provider/cs_primitive_pcs_spec.rb b/spec/unit/puppet/provider/cs_primitive_pcs_spec.rb index 3c6cd427..d3cd6da9 100644 --- a/spec/unit/puppet/provider/cs_primitive_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_primitive_pcs_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' require 'spec_helper_corosync' diff --git a/spec/unit/puppet/provider/cs_property_crm_spec.rb b/spec/unit/puppet/provider/cs_property_crm_spec.rb index ba716e63..3e8b2038 100644 --- a/spec/unit/puppet/provider/cs_property_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_property_crm_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Puppet::Type.type(:cs_property).provider(:crm) do diff --git a/spec/unit/puppet/provider/cs_property_pcs_spec.rb b/spec/unit/puppet/provider/cs_property_pcs_spec.rb index 2d37067a..2a7e2901 100644 --- a/spec/unit/puppet/provider/cs_property_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_property_pcs_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Puppet::Type.type(:cs_property).provider(:pcs) do diff --git a/spec/unit/puppet/provider/cs_rsc_defaults_crm_spec.rb b/spec/unit/puppet/provider/cs_rsc_defaults_crm_spec.rb index c1d992a3..71f7b12d 100644 --- a/spec/unit/puppet/provider/cs_rsc_defaults_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_rsc_defaults_crm_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Puppet::Type.type(:cs_rsc_defaults).provider(:crm) do diff --git a/spec/unit/puppet/provider/cs_rsc_defaults_pcs_spec.rb b/spec/unit/puppet/provider/cs_rsc_defaults_pcs_spec.rb index d8075225..58433df4 100644 --- a/spec/unit/puppet/provider/cs_rsc_defaults_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_rsc_defaults_pcs_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Puppet::Type.type(:cs_rsc_defaults).provider(:pcs) do diff --git a/spec/unit/puppet/type/cs_clone_spec.rb b/spec/unit/puppet/type/cs_clone_spec.rb index f6176c42..47a83409 100644 --- a/spec/unit/puppet/type/cs_clone_spec.rb +++ b/spec/unit/puppet/type/cs_clone_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Puppet::Type.type(:cs_clone) do diff --git a/spec/unit/puppet/type/cs_group_spec.rb b/spec/unit/puppet/type/cs_group_spec.rb index 7efd35e0..9895b6ef 100644 --- a/spec/unit/puppet/type/cs_group_spec.rb +++ b/spec/unit/puppet/type/cs_group_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Puppet::Type.type(:cs_group) do diff --git a/spec/unit/puppet/type/cs_location_spec.rb b/spec/unit/puppet/type/cs_location_spec.rb index dabcfd47..dcc86046 100644 --- a/spec/unit/puppet/type/cs_location_spec.rb +++ b/spec/unit/puppet/type/cs_location_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Puppet::Type.type(:cs_location) do diff --git a/spec/unit/puppet/type/cs_primitive_spec.rb b/spec/unit/puppet/type/cs_primitive_spec.rb index baface1b..242db812 100644 --- a/spec/unit/puppet/type/cs_primitive_spec.rb +++ b/spec/unit/puppet/type/cs_primitive_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Puppet::Type.type(:cs_primitive) do diff --git a/spec/unit/puppet/type/cs_property_spec.rb b/spec/unit/puppet/type/cs_property_spec.rb index 7301ba10..6a4d359c 100644 --- a/spec/unit/puppet/type/cs_property_spec.rb +++ b/spec/unit/puppet/type/cs_property_spec.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require 'spec_helper' describe Puppet::Type.type(:cs_property) do From 0274c75b68f2126f99d738a0966841ee8f3f20d1 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 17 Jan 2022 10:31:02 +0100 Subject: [PATCH 05/39] rubocop: Fix Style/StringConcatenation --- lib/puppet/provider/cs_commit/pcs.rb | 4 ++-- lib/puppet/provider/cs_rsc_defaults/pcs.rb | 2 +- lib/puppet_x/voxpupuli/corosync/provider/pcs.rb | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/puppet/provider/cs_commit/pcs.rb b/lib/puppet/provider/cs_commit/pcs.rb index 1decf0e3..979e098c 100644 --- a/lib/puppet/provider/cs_commit/pcs.rb +++ b/lib/puppet/provider/cs_commit/pcs.rb @@ -25,8 +25,8 @@ def self.instances end def commit - cib_path = File.join(Puppet[:vardir], 'shadow.' + @resource[:name]) - self.class.run_command_in_cib([command(:pcs), 'cluster', 'cib-push', cib_path, 'diff-against=' + cib_path + '.ori']) + cib_path = File.join(Puppet[:vardir], "shadow.#{@resource[:name]}") + self.class.run_command_in_cib([command(:pcs), 'cluster', 'cib-push', cib_path, "diff-against=#{cib_path}.ori"]) # We run the next command in the CIB directly by purpose: # We commit the shadow CIB with the admin_epoch it was created. self.class.run_command_in_cib([command(:cibadmin), '--modify', '--xml-text', '']) diff --git a/lib/puppet/provider/cs_rsc_defaults/pcs.rb b/lib/puppet/provider/cs_rsc_defaults/pcs.rb index 6433d3bd..b04afdcb 100644 --- a/lib/puppet/provider/cs_rsc_defaults/pcs.rb +++ b/lib/puppet/provider/cs_rsc_defaults/pcs.rb @@ -57,7 +57,7 @@ def create # Unlike create we actually immediately delete the item. def destroy debug('Removing resource default') - cmd = [command(:pcs), 'resource', 'defaults', (@property_hash[:name]).to_s + '='] + cmd = [command(:pcs), 'resource', 'defaults', "#{(@property_hash[:name]).to_s}="] self.class.run_command_in_cib(cmd, @resource[:cib]) @property_hash.clear end diff --git a/lib/puppet_x/voxpupuli/corosync/provider/pcs.rb b/lib/puppet_x/voxpupuli/corosync/provider/pcs.rb index 5333c9d0..12ace186 100644 --- a/lib/puppet_x/voxpupuli/corosync/provider/pcs.rb +++ b/lib/puppet_x/voxpupuli/corosync/provider/pcs.rb @@ -82,7 +82,7 @@ def self.run_command_in_cib(cmd, cib = nil, failonfail = true) unless cib.nil? if cmd.first == command(:pcs) - cib_path = File.join(Puppet[:vardir], 'shadow.' + cib) + cib_path = File.join(Puppet[:vardir], "shadow.#{cib}") cmd.push('-f', cib_path) else custom_environment[:custom_environment] = { 'CIB_shadow_dir' => Puppet[:vardir], 'CIB_shadow' => cib } @@ -93,9 +93,9 @@ def self.run_command_in_cib(cmd, cib = nil, failonfail = true) end def self.sync_shadow_cib(cib, failondeletefail = false) - cib_path = File.join(Puppet[:vardir], 'shadow.' + cib) + cib_path = File.join(Puppet[:vardir], "shadow.#{cib}") run_command_in_cib([command(:pcs), 'cluster', 'cib', cib_path], nil, failondeletefail) - FileUtils.cp cib_path, cib_path + '.ori' + FileUtils.cp cib_path, "#{cib_path}.ori" end def exists? From 05dd84b4df825e089818475805cb4a4826346e3c Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 17 Jan 2022 10:31:43 +0100 Subject: [PATCH 06/39] rubocop: Fix Style/NumericPredicate --- lib/puppet/provider/cs_colocation/pcs.rb | 2 +- lib/puppet/type/cs_commit.rb | 2 +- lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/puppet/provider/cs_colocation/pcs.rb b/lib/puppet/provider/cs_colocation/pcs.rb index 0b008a42..8a8d99de 100644 --- a/lib/puppet/provider/cs_colocation/pcs.rb +++ b/lib/puppet/provider/cs_colocation/pcs.rb @@ -44,7 +44,7 @@ def self.instances options[o] = rs.attributes[o] if rs.attributes[o] end # rubocop:disable Style/ZeroLengthPredicate - resource_set['options'] = options if options.keys.size > 0 + resource_set['options'] = options if options.keys.size.positive? # rubocop:enable Style/ZeroLengthPredicate resource_set['primitives'] = [] rs.each_element('resource_ref') do |rr| diff --git a/lib/puppet/type/cs_commit.rb b/lib/puppet/type/cs_commit.rb index 5eec406f..ef1f120a 100644 --- a/lib/puppet/type/cs_commit.rb +++ b/lib/puppet/type/cs_commit.rb @@ -37,7 +37,7 @@ def refresh autos end - if Puppet::Util::Package.versioncmp(Puppet::PUPPETVERSION, '4.0') < 0 + if Puppet::Util::Package.versioncmp(Puppet::PUPPETVERSION, '4.0').negative? autorequire(:cs_primitive) do resources_with_cib :cs_primitive end diff --git a/lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb b/lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb index 8549206e..96f46e4c 100644 --- a/lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb +++ b/lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb @@ -75,7 +75,7 @@ def self.rule_expression(rulename, expressions, boolean_op = 'and') raise Puppet::Error, "boolean-op must be 'and' or 'or' in rule #{rulename}" if boolean_op != 'and' && boolean_op != 'or' expressions.each do |expr| - rule_parameters << boolean_op if count > 0 + rule_parameters << boolean_op if count.positive? count += 1 raise Puppet::Error, "attribute must be defined for expression #{count} in rule #{rulename}" if expr['attribute'].nil? From aef944c7226503246d186965f727923c34031047 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 17 Jan 2022 10:34:52 +0100 Subject: [PATCH 07/39] rubocop: Fix Style/SafeNavigation --- lib/puppet/provider/cs_colocation/pcs.rb | 4 +--- lib/puppet/provider/cs_location/crm.rb | 4 +--- lib/puppet/provider/cs_location/pcs.rb | 4 +--- lib/puppet/provider/cs_order/pcs.rb | 4 +--- lib/puppet/provider/cs_primitive/crm.rb | 10 +++------- lib/puppet/provider/cs_primitive/pcs.rb | 12 ++++-------- lib/puppet/provider/cs_property/crm.rb | 4 +--- lib/puppet/provider/cs_property/pcs.rb | 4 +--- lib/puppet/type/cs_group.rb | 4 +--- 9 files changed, 14 insertions(+), 36 deletions(-) diff --git a/lib/puppet/provider/cs_colocation/pcs.rb b/lib/puppet/provider/cs_colocation/pcs.rb index 8a8d99de..72729154 100644 --- a/lib/puppet/provider/cs_colocation/pcs.rb +++ b/lib/puppet/provider/cs_colocation/pcs.rb @@ -31,8 +31,7 @@ def self.instances resource_set_options = %w[sequential require-all action role] constraints = doc.root.elements['configuration'].elements['constraints'] - unless constraints.nil? - constraints.each_element('rsc_colocation') do |e| + constraints&.each_element('rsc_colocation') do |e| items = e.attributes if e.has_elements? @@ -85,7 +84,6 @@ def self.instances end instances << new(colocation_instance) end - end instances end diff --git a/lib/puppet/provider/cs_location/crm.rb b/lib/puppet/provider/cs_location/crm.rb index 98ff9f01..3015a463 100644 --- a/lib/puppet/provider/cs_location/crm.rb +++ b/lib/puppet/provider/cs_location/crm.rb @@ -104,8 +104,7 @@ def flush updated << " #{@property_hash[:score]}: #{@property_hash[:node_name]}" unless @property_hash[:node_name].nil? - unless @property_hash[:rules].nil? - @property_hash[:rules].each do |rule_item| + @property_hash[:rules]&.each do |rule_item| name = rule_item.keys.first rule = rule_item[name] @@ -118,7 +117,6 @@ def flush updated << " $role=\"#{rule['role']}\"" unless rule['role'].nil? updated << " #{score}: #{expression.join(' ')}" end - end debug("Loading update: #{updated}") Tempfile.open('puppet_crm_update') do |tmpfile| diff --git a/lib/puppet/provider/cs_location/pcs.rb b/lib/puppet/provider/cs_location/pcs.rb index 0218be1f..0e6a9f64 100644 --- a/lib/puppet/provider/cs_location/pcs.rb +++ b/lib/puppet/provider/cs_location/pcs.rb @@ -33,8 +33,7 @@ def self.instances doc = REXML::Document.new(raw) constraints = doc.root.elements['configuration'].elements['constraints'] - unless constraints.nil? - constraints.each_element('rsc_location') do |e| + constraints&.each_element('rsc_location') do |e| # The node2hash method maps resource locations from XML into hashes. # The expression key is handled differently because the result must # not contain the id of the XML node. The crm command can not set the @@ -53,7 +52,6 @@ def self.instances } instances << new(location_instance) end - end instances end diff --git a/lib/puppet/provider/cs_order/pcs.rb b/lib/puppet/provider/cs_order/pcs.rb index d5e08179..d29d3e2f 100644 --- a/lib/puppet/provider/cs_order/pcs.rb +++ b/lib/puppet/provider/cs_order/pcs.rb @@ -35,8 +35,7 @@ def self.instances doc = REXML::Document.new(raw) constraints = doc.root.elements['configuration'].elements['constraints'] - unless constraints.nil? - constraints.each_element('rsc_order') do |e| + constraints&.each_element('rsc_order') do |e| items = e.attributes first = if items['first-action'] @@ -71,7 +70,6 @@ def self.instances } instances << new(order_instance) end - end instances end diff --git a/lib/puppet/provider/cs_primitive/crm.rb b/lib/puppet/provider/cs_primitive/crm.rb index be1e0007..2f0f4b82 100644 --- a/lib/puppet/provider/cs_primitive/crm.rb +++ b/lib/puppet/provider/cs_primitive/crm.rb @@ -41,8 +41,7 @@ def self.element_to_hash(e) } operations = e.elements['operations'] - unless operations.nil? - operations.each_element do |o| + operations&.each_element do |o| valids = o.attributes.reject { |k, _v| k == 'id' } name = valids['name'].to_s operation = {} @@ -50,14 +49,11 @@ def self.element_to_hash(e) valids.each do |k, v| operation[name][k] = v.to_s if k != 'name' end - unless o.elements['instance_attributes'].nil? - o.elements['instance_attributes'].each_element do |i| + o.elements['instance_attributes']&.each_element do |i| operation[name][i.attributes['name']] = i.attributes['value'] end - end hash[:operations] << operation end - end hash end @@ -163,7 +159,7 @@ def flush end end end - if @resource && @resource.instance_of?(:cs_primitive) && @resource[:unmanaged_metadata] + if @resource&.instance_of?(:cs_primitive) && @resource[:unmanaged_metadata] @resource[:unmanaged_metadata].each do |parameter_name| @property_hash[:metadata][parameter_name] = @property_hash[:existing_metadata]['target-role'] if @property_hash[:existing_metadata] && @property_hash[:existing_metadata][parameter_name] end diff --git a/lib/puppet/provider/cs_primitive/pcs.rb b/lib/puppet/provider/cs_primitive/pcs.rb index 7eb5f466..6f7a99b3 100644 --- a/lib/puppet/provider/cs_primitive/pcs.rb +++ b/lib/puppet/provider/cs_primitive/pcs.rb @@ -48,8 +48,7 @@ def self.element_to_hash(e) } operations = e.elements['operations'] - unless operations.nil? - operations.each_element do |o| + operations&.each_element do |o| valids = o.attributes.reject { |k, _v| k == 'id' } name = valids['name'].to_s operation = {} @@ -57,15 +56,12 @@ def self.element_to_hash(e) valids.each do |k, v| operation[name][k] = v.to_s if k != 'name' end - unless o.elements['instance_attributes'].nil? - o.elements['instance_attributes'].each_element do |i| + o.elements['instance_attributes']&.each_element do |i| operation[name][i.attributes['name']] = i.attributes['value'] end - end hash[:operations] << operation hash[:existing_operations] << operation end - end hash end @@ -270,10 +266,10 @@ def flush end # Clear all metadata structures when specified - if @resource && @resource.instance_of?(:cs_primitive) && @resource[:unmanaged_metadata] + if @resource&.instance_of?(:cs_primitive) && @resource[:unmanaged_metadata] @resource[:unmanaged_metadata].each do |parameter_name| @property_hash[:metadata].delete(parameter_name) - @property_hash[:existing_metadata].delete(parameter_name) if @property_hash[:existing_metadata] + @property_hash[:existing_metadata]&.delete(parameter_name) end end diff --git a/lib/puppet/provider/cs_property/crm.rb b/lib/puppet/provider/cs_property/crm.rb index 119ea3ad..6f83d31f 100644 --- a/lib/puppet/provider/cs_property/crm.rb +++ b/lib/puppet/provider/cs_property/crm.rb @@ -29,8 +29,7 @@ def self.instances doc = REXML::Document.new(raw) cluster_property_set = doc.root.elements["configuration/crm_config/cluster_property_set[@id='cib-bootstrap-options']"] - unless cluster_property_set.nil? - cluster_property_set.each_element do |e| + cluster_property_set&.each_element do |e| items = e.attributes property = { name: items['name'], value: items['value'] } @@ -42,7 +41,6 @@ def self.instances } instances << new(property_instance) end - end instances end diff --git a/lib/puppet/provider/cs_property/pcs.rb b/lib/puppet/provider/cs_property/pcs.rb index 60e3bd83..636434dc 100644 --- a/lib/puppet/provider/cs_property/pcs.rb +++ b/lib/puppet/provider/cs_property/pcs.rb @@ -30,8 +30,7 @@ def self.instances doc = REXML::Document.new(raw) cluster_property_set = doc.root.elements["configuration/crm_config/cluster_property_set[@id='cib-bootstrap-options']"] - unless cluster_property_set.nil? - cluster_property_set.each_element do |e| + cluster_property_set&.each_element do |e| items = e.attributes property = { name: items['name'], value: items['value'] } @@ -43,7 +42,6 @@ def self.instances } instances << new(property_instance) end - end instances end diff --git a/lib/puppet/type/cs_group.rb b/lib/puppet/type/cs_group.rb index 8d00d8c4..e2e3b22e 100644 --- a/lib/puppet/type/cs_group.rb +++ b/lib/puppet/type/cs_group.rb @@ -56,11 +56,9 @@ def insync?(is) autorequire(:cs_primitive) do autos = [] - if should(:primitives) - should(:primitives).each do |val| + should(:primitives)&.each do |val| autos << unmunge_cs_primitive(val) end - end autos end From a8042a425e256e7ca2227e1b62eef6c16eecebd9 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 17 Jan 2022 10:36:22 +0100 Subject: [PATCH 08/39] rubocop: Fix Layout/BlockAlignment --- lib/puppet/provider/cs_colocation/pcs.rb | 2 +- lib/puppet/provider/cs_location/crm.rb | 2 +- lib/puppet/provider/cs_location/pcs.rb | 2 +- lib/puppet/provider/cs_order/pcs.rb | 2 +- lib/puppet/provider/cs_primitive/crm.rb | 4 ++-- lib/puppet/provider/cs_primitive/pcs.rb | 4 ++-- lib/puppet/provider/cs_property/crm.rb | 2 +- lib/puppet/provider/cs_property/pcs.rb | 2 +- lib/puppet/type/cs_group.rb | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/puppet/provider/cs_colocation/pcs.rb b/lib/puppet/provider/cs_colocation/pcs.rb index 72729154..d6a5d415 100644 --- a/lib/puppet/provider/cs_colocation/pcs.rb +++ b/lib/puppet/provider/cs_colocation/pcs.rb @@ -83,7 +83,7 @@ def self.instances } end instances << new(colocation_instance) - end + end instances end diff --git a/lib/puppet/provider/cs_location/crm.rb b/lib/puppet/provider/cs_location/crm.rb index 3015a463..9d47f437 100644 --- a/lib/puppet/provider/cs_location/crm.rb +++ b/lib/puppet/provider/cs_location/crm.rb @@ -116,7 +116,7 @@ def flush updated << " rule $id=\"#{name}\"" updated << " $role=\"#{rule['role']}\"" unless rule['role'].nil? updated << " #{score}: #{expression.join(' ')}" - end + end debug("Loading update: #{updated}") Tempfile.open('puppet_crm_update') do |tmpfile| diff --git a/lib/puppet/provider/cs_location/pcs.rb b/lib/puppet/provider/cs_location/pcs.rb index 0e6a9f64..3dfef832 100644 --- a/lib/puppet/provider/cs_location/pcs.rb +++ b/lib/puppet/provider/cs_location/pcs.rb @@ -51,7 +51,7 @@ def self.instances provider: name } instances << new(location_instance) - end + end instances end diff --git a/lib/puppet/provider/cs_order/pcs.rb b/lib/puppet/provider/cs_order/pcs.rb index d29d3e2f..df4d9e67 100644 --- a/lib/puppet/provider/cs_order/pcs.rb +++ b/lib/puppet/provider/cs_order/pcs.rb @@ -69,7 +69,7 @@ def self.instances new: false } instances << new(order_instance) - end + end instances end diff --git a/lib/puppet/provider/cs_primitive/crm.rb b/lib/puppet/provider/cs_primitive/crm.rb index 2f0f4b82..f614f632 100644 --- a/lib/puppet/provider/cs_primitive/crm.rb +++ b/lib/puppet/provider/cs_primitive/crm.rb @@ -51,9 +51,9 @@ def self.element_to_hash(e) end o.elements['instance_attributes']&.each_element do |i| operation[name][i.attributes['name']] = i.attributes['value'] - end + end hash[:operations] << operation - end + end hash end diff --git a/lib/puppet/provider/cs_primitive/pcs.rb b/lib/puppet/provider/cs_primitive/pcs.rb index 6f7a99b3..5ded66e9 100644 --- a/lib/puppet/provider/cs_primitive/pcs.rb +++ b/lib/puppet/provider/cs_primitive/pcs.rb @@ -58,10 +58,10 @@ def self.element_to_hash(e) end o.elements['instance_attributes']&.each_element do |i| operation[name][i.attributes['name']] = i.attributes['value'] - end + end hash[:operations] << operation hash[:existing_operations] << operation - end + end hash end diff --git a/lib/puppet/provider/cs_property/crm.rb b/lib/puppet/provider/cs_property/crm.rb index 6f83d31f..c653c17a 100644 --- a/lib/puppet/provider/cs_property/crm.rb +++ b/lib/puppet/provider/cs_property/crm.rb @@ -40,7 +40,7 @@ def self.instances provider: name } instances << new(property_instance) - end + end instances end diff --git a/lib/puppet/provider/cs_property/pcs.rb b/lib/puppet/provider/cs_property/pcs.rb index 636434dc..762e7a14 100644 --- a/lib/puppet/provider/cs_property/pcs.rb +++ b/lib/puppet/provider/cs_property/pcs.rb @@ -41,7 +41,7 @@ def self.instances provider: name } instances << new(property_instance) - end + end instances end diff --git a/lib/puppet/type/cs_group.rb b/lib/puppet/type/cs_group.rb index e2e3b22e..c9186604 100644 --- a/lib/puppet/type/cs_group.rb +++ b/lib/puppet/type/cs_group.rb @@ -58,7 +58,7 @@ def insync?(is) autos = [] should(:primitives)&.each do |val| autos << unmunge_cs_primitive(val) - end + end autos end From a25f7498476f308b81ce8cb8f5f1772eb4fbd949 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 17 Jan 2022 10:37:19 +0100 Subject: [PATCH 09/39] rubocop: Fix Layout/IndentationWidth --- lib/puppet/provider/cs_colocation/pcs.rb | 2 +- lib/puppet/provider/cs_location/crm.rb | 2 +- lib/puppet/provider/cs_location/pcs.rb | 2 +- lib/puppet/provider/cs_order/pcs.rb | 2 +- lib/puppet/provider/cs_primitive/crm.rb | 4 ++-- lib/puppet/provider/cs_primitive/pcs.rb | 4 ++-- lib/puppet/provider/cs_property/crm.rb | 2 +- lib/puppet/provider/cs_property/pcs.rb | 2 +- lib/puppet/type/cs_group.rb | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/puppet/provider/cs_colocation/pcs.rb b/lib/puppet/provider/cs_colocation/pcs.rb index d6a5d415..d758536c 100644 --- a/lib/puppet/provider/cs_colocation/pcs.rb +++ b/lib/puppet/provider/cs_colocation/pcs.rb @@ -32,7 +32,7 @@ def self.instances constraints = doc.root.elements['configuration'].elements['constraints'] constraints&.each_element('rsc_colocation') do |e| - items = e.attributes + items = e.attributes if e.has_elements? resource_sets = [] diff --git a/lib/puppet/provider/cs_location/crm.rb b/lib/puppet/provider/cs_location/crm.rb index 9d47f437..af3f9ff7 100644 --- a/lib/puppet/provider/cs_location/crm.rb +++ b/lib/puppet/provider/cs_location/crm.rb @@ -105,7 +105,7 @@ def flush updated << " #{@property_hash[:score]}: #{@property_hash[:node_name]}" unless @property_hash[:node_name].nil? @property_hash[:rules]&.each do |rule_item| - name = rule_item.keys.first + name = rule_item.keys.first rule = rule_item[name] score = rule['score-attribute'] || rule['score'] diff --git a/lib/puppet/provider/cs_location/pcs.rb b/lib/puppet/provider/cs_location/pcs.rb index 3dfef832..24ae3857 100644 --- a/lib/puppet/provider/cs_location/pcs.rb +++ b/lib/puppet/provider/cs_location/pcs.rb @@ -38,7 +38,7 @@ def self.instances # The expression key is handled differently because the result must # not contain the id of the XML node. The crm command can not set the # expression id so Puppet would try to update the rule at every run. - id, items = node2hash(e, ['expression']).first + id, items = node2hash(e, ['expression']).first location_instance = { name: id, diff --git a/lib/puppet/provider/cs_order/pcs.rb b/lib/puppet/provider/cs_order/pcs.rb index df4d9e67..e2b730f5 100644 --- a/lib/puppet/provider/cs_order/pcs.rb +++ b/lib/puppet/provider/cs_order/pcs.rb @@ -36,7 +36,7 @@ def self.instances constraints = doc.root.elements['configuration'].elements['constraints'] constraints&.each_element('rsc_order') do |e| - items = e.attributes + items = e.attributes first = if items['first-action'] "#{items['first']}:#{items['first-action']}" diff --git a/lib/puppet/provider/cs_primitive/crm.rb b/lib/puppet/provider/cs_primitive/crm.rb index f614f632..d4aefa9e 100644 --- a/lib/puppet/provider/cs_primitive/crm.rb +++ b/lib/puppet/provider/cs_primitive/crm.rb @@ -42,7 +42,7 @@ def self.element_to_hash(e) operations = e.elements['operations'] operations&.each_element do |o| - valids = o.attributes.reject { |k, _v| k == 'id' } + valids = o.attributes.reject { |k, _v| k == 'id' } name = valids['name'].to_s operation = {} operation[name] = {} @@ -50,7 +50,7 @@ def self.element_to_hash(e) operation[name][k] = v.to_s if k != 'name' end o.elements['instance_attributes']&.each_element do |i| - operation[name][i.attributes['name']] = i.attributes['value'] + operation[name][i.attributes['name']] = i.attributes['value'] end hash[:operations] << operation end diff --git a/lib/puppet/provider/cs_primitive/pcs.rb b/lib/puppet/provider/cs_primitive/pcs.rb index 5ded66e9..6971de02 100644 --- a/lib/puppet/provider/cs_primitive/pcs.rb +++ b/lib/puppet/provider/cs_primitive/pcs.rb @@ -49,7 +49,7 @@ def self.element_to_hash(e) operations = e.elements['operations'] operations&.each_element do |o| - valids = o.attributes.reject { |k, _v| k == 'id' } + valids = o.attributes.reject { |k, _v| k == 'id' } name = valids['name'].to_s operation = {} operation[name] = {} @@ -57,7 +57,7 @@ def self.element_to_hash(e) operation[name][k] = v.to_s if k != 'name' end o.elements['instance_attributes']&.each_element do |i| - operation[name][i.attributes['name']] = i.attributes['value'] + operation[name][i.attributes['name']] = i.attributes['value'] end hash[:operations] << operation hash[:existing_operations] << operation diff --git a/lib/puppet/provider/cs_property/crm.rb b/lib/puppet/provider/cs_property/crm.rb index c653c17a..be34b01c 100644 --- a/lib/puppet/provider/cs_property/crm.rb +++ b/lib/puppet/provider/cs_property/crm.rb @@ -30,7 +30,7 @@ def self.instances cluster_property_set = doc.root.elements["configuration/crm_config/cluster_property_set[@id='cib-bootstrap-options']"] cluster_property_set&.each_element do |e| - items = e.attributes + items = e.attributes property = { name: items['name'], value: items['value'] } property_instance = { diff --git a/lib/puppet/provider/cs_property/pcs.rb b/lib/puppet/provider/cs_property/pcs.rb index 762e7a14..5258c51f 100644 --- a/lib/puppet/provider/cs_property/pcs.rb +++ b/lib/puppet/provider/cs_property/pcs.rb @@ -31,7 +31,7 @@ def self.instances cluster_property_set = doc.root.elements["configuration/crm_config/cluster_property_set[@id='cib-bootstrap-options']"] cluster_property_set&.each_element do |e| - items = e.attributes + items = e.attributes property = { name: items['name'], value: items['value'] } property_instance = { diff --git a/lib/puppet/type/cs_group.rb b/lib/puppet/type/cs_group.rb index c9186604..435ca576 100644 --- a/lib/puppet/type/cs_group.rb +++ b/lib/puppet/type/cs_group.rb @@ -57,7 +57,7 @@ def insync?(is) autorequire(:cs_primitive) do autos = [] should(:primitives)&.each do |val| - autos << unmunge_cs_primitive(val) + autos << unmunge_cs_primitive(val) end autos From c2ca6e3a01f3219f0827a73f177cce9743b13733 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 17 Jan 2022 10:38:42 +0100 Subject: [PATCH 10/39] rubocop: Fix Layout/IndentationConsistency --- lib/puppet/provider/cs_colocation/pcs.rb | 94 ++++++++++++------------ lib/puppet/provider/cs_location/crm.rb | 14 ++-- lib/puppet/provider/cs_location/pcs.rb | 22 +++--- lib/puppet/provider/cs_order/pcs.rb | 62 ++++++++-------- lib/puppet/provider/cs_primitive/crm.rb | 20 ++--- lib/puppet/provider/cs_primitive/pcs.rb | 22 +++--- lib/puppet/provider/cs_property/crm.rb | 16 ++-- lib/puppet/provider/cs_property/pcs.rb | 18 ++--- 8 files changed, 134 insertions(+), 134 deletions(-) diff --git a/lib/puppet/provider/cs_colocation/pcs.rb b/lib/puppet/provider/cs_colocation/pcs.rb index d758536c..21ada493 100644 --- a/lib/puppet/provider/cs_colocation/pcs.rb +++ b/lib/puppet/provider/cs_colocation/pcs.rb @@ -34,55 +34,55 @@ def self.instances constraints&.each_element('rsc_colocation') do |e| items = e.attributes - if e.has_elements? - resource_sets = [] - e.each_element('resource_set') do |rs| - resource_set = {} - options = {} - resource_set_options.each do |o| - options[o] = rs.attributes[o] if rs.attributes[o] - end - # rubocop:disable Style/ZeroLengthPredicate - resource_set['options'] = options if options.keys.size.positive? - # rubocop:enable Style/ZeroLengthPredicate - resource_set['primitives'] = [] - rs.each_element('resource_ref') do |rr| - resource_set['primitives'] << rr.attributes['id'] - end - resource_sets << resource_set + if e.has_elements? + resource_sets = [] + e.each_element('resource_set') do |rs| + resource_set = {} + options = {} + resource_set_options.each do |o| + options[o] = rs.attributes[o] if rs.attributes[o] end - colocation_instance = { - name: items['id'], - ensure: :present, - primitives: resource_sets, - score: items['score'], - provider: name, - new: false - } - else - rsc = if items['rsc-role'] && items['rsc-role'] != 'Started' - "#{items['rsc']}:#{items['rsc-role']}" - else - items['rsc'] - end - - with_rsc = if items['with-rsc-role'] && items['with-rsc-role'] != 'Started' - "#{items['with-rsc']}:#{items['with-rsc-role']}" - else - items['with-rsc'] - end - - colocation_instance = { - name: items['id'], - ensure: :present, - # Put primitives in chronological order, first 'with-rsc', then 'rsc'. - primitives: [with_rsc, rsc], - score: items['score'], - provider: name, - new: false - } + # rubocop:disable Style/ZeroLengthPredicate + resource_set['options'] = options if options.keys.size.positive? + # rubocop:enable Style/ZeroLengthPredicate + resource_set['primitives'] = [] + rs.each_element('resource_ref') do |rr| + resource_set['primitives'] << rr.attributes['id'] + end + resource_sets << resource_set end - instances << new(colocation_instance) + colocation_instance = { + name: items['id'], + ensure: :present, + primitives: resource_sets, + score: items['score'], + provider: name, + new: false + } + else + rsc = if items['rsc-role'] && items['rsc-role'] != 'Started' + "#{items['rsc']}:#{items['rsc-role']}" + else + items['rsc'] + end + + with_rsc = if items['with-rsc-role'] && items['with-rsc-role'] != 'Started' + "#{items['with-rsc']}:#{items['with-rsc-role']}" + else + items['with-rsc'] + end + + colocation_instance = { + name: items['id'], + ensure: :present, + # Put primitives in chronological order, first 'with-rsc', then 'rsc'. + primitives: [with_rsc, rsc], + score: items['score'], + provider: name, + new: false + } + end + instances << new(colocation_instance) end instances end diff --git a/lib/puppet/provider/cs_location/crm.rb b/lib/puppet/provider/cs_location/crm.rb index af3f9ff7..e87bd061 100644 --- a/lib/puppet/provider/cs_location/crm.rb +++ b/lib/puppet/provider/cs_location/crm.rb @@ -106,16 +106,16 @@ def flush @property_hash[:rules]&.each do |rule_item| name = rule_item.keys.first - rule = rule_item[name] + rule = rule_item[name] - score = rule['score-attribute'] || rule['score'] + score = rule['score-attribute'] || rule['score'] - boolean_op = rule['boolean-op'] || 'and' - expression = self.class.rule_expression(name, rule['expression'], boolean_op) + boolean_op = rule['boolean-op'] || 'and' + expression = self.class.rule_expression(name, rule['expression'], boolean_op) - updated << " rule $id=\"#{name}\"" - updated << " $role=\"#{rule['role']}\"" unless rule['role'].nil? - updated << " #{score}: #{expression.join(' ')}" + updated << " rule $id=\"#{name}\"" + updated << " $role=\"#{rule['role']}\"" unless rule['role'].nil? + updated << " #{score}: #{expression.join(' ')}" end debug("Loading update: #{updated}") diff --git a/lib/puppet/provider/cs_location/pcs.rb b/lib/puppet/provider/cs_location/pcs.rb index 24ae3857..33f779d1 100644 --- a/lib/puppet/provider/cs_location/pcs.rb +++ b/lib/puppet/provider/cs_location/pcs.rb @@ -40,17 +40,17 @@ def self.instances # expression id so Puppet would try to update the rule at every run. id, items = node2hash(e, ['expression']).first - location_instance = { - name: id, - ensure: :present, - primitive: items['rsc'], - node_name: items['node'], - score: items['score'] || 'INFINITY', - rules: items['rule'], - resource_discovery: items['resource-discovery'], - provider: name - } - instances << new(location_instance) + location_instance = { + name: id, + ensure: :present, + primitive: items['rsc'], + node_name: items['node'], + score: items['score'] || 'INFINITY', + rules: items['rule'], + resource_discovery: items['resource-discovery'], + provider: name + } + instances << new(location_instance) end instances end diff --git a/lib/puppet/provider/cs_order/pcs.rb b/lib/puppet/provider/cs_order/pcs.rb index e2b730f5..a527910a 100644 --- a/lib/puppet/provider/cs_order/pcs.rb +++ b/lib/puppet/provider/cs_order/pcs.rb @@ -38,37 +38,37 @@ def self.instances constraints&.each_element('rsc_order') do |e| items = e.attributes - first = if items['first-action'] - "#{items['first']}:#{items['first-action']}" - else - items['first'] - end - - second = if items['then-action'] - "#{items['then']}:#{items['then-action']}" - else - items['then'] - end - kind = items['kind'] || 'Mandatory' - - symmetrical = if items['symmetrical'] - (items['symmetrical'] == 'true') - else - # Default: symmetrical is true unless explicitly defined. - true - end - - order_instance = { - name: items['id'], - ensure: :present, - first: first, - second: second, - kind: kind, - symmetrical: symmetrical, - provider: name, - new: false - } - instances << new(order_instance) + first = if items['first-action'] + "#{items['first']}:#{items['first-action']}" + else + items['first'] + end + + second = if items['then-action'] + "#{items['then']}:#{items['then-action']}" + else + items['then'] + end + kind = items['kind'] || 'Mandatory' + + symmetrical = if items['symmetrical'] + (items['symmetrical'] == 'true') + else + # Default: symmetrical is true unless explicitly defined. + true + end + + order_instance = { + name: items['id'], + ensure: :present, + first: first, + second: second, + kind: kind, + symmetrical: symmetrical, + provider: name, + new: false + } + instances << new(order_instance) end instances end diff --git a/lib/puppet/provider/cs_primitive/crm.rb b/lib/puppet/provider/cs_primitive/crm.rb index d4aefa9e..96a309c9 100644 --- a/lib/puppet/provider/cs_primitive/crm.rb +++ b/lib/puppet/provider/cs_primitive/crm.rb @@ -43,16 +43,16 @@ def self.element_to_hash(e) operations = e.elements['operations'] operations&.each_element do |o| valids = o.attributes.reject { |k, _v| k == 'id' } - name = valids['name'].to_s - operation = {} - operation[name] = {} - valids.each do |k, v| - operation[name][k] = v.to_s if k != 'name' - end - o.elements['instance_attributes']&.each_element do |i| - operation[name][i.attributes['name']] = i.attributes['value'] - end - hash[:operations] << operation + name = valids['name'].to_s + operation = {} + operation[name] = {} + valids.each do |k, v| + operation[name][k] = v.to_s if k != 'name' + end + o.elements['instance_attributes']&.each_element do |i| + operation[name][i.attributes['name']] = i.attributes['value'] + end + hash[:operations] << operation end hash diff --git a/lib/puppet/provider/cs_primitive/pcs.rb b/lib/puppet/provider/cs_primitive/pcs.rb index 6971de02..6fd8557b 100644 --- a/lib/puppet/provider/cs_primitive/pcs.rb +++ b/lib/puppet/provider/cs_primitive/pcs.rb @@ -50,17 +50,17 @@ def self.element_to_hash(e) operations = e.elements['operations'] operations&.each_element do |o| valids = o.attributes.reject { |k, _v| k == 'id' } - name = valids['name'].to_s - operation = {} - operation[name] = {} - valids.each do |k, v| - operation[name][k] = v.to_s if k != 'name' - end - o.elements['instance_attributes']&.each_element do |i| - operation[name][i.attributes['name']] = i.attributes['value'] - end - hash[:operations] << operation - hash[:existing_operations] << operation + name = valids['name'].to_s + operation = {} + operation[name] = {} + valids.each do |k, v| + operation[name][k] = v.to_s if k != 'name' + end + o.elements['instance_attributes']&.each_element do |i| + operation[name][i.attributes['name']] = i.attributes['value'] + end + hash[:operations] << operation + hash[:existing_operations] << operation end hash diff --git a/lib/puppet/provider/cs_property/crm.rb b/lib/puppet/provider/cs_property/crm.rb index be34b01c..4e9a0cac 100644 --- a/lib/puppet/provider/cs_property/crm.rb +++ b/lib/puppet/provider/cs_property/crm.rb @@ -31,15 +31,15 @@ def self.instances cluster_property_set = doc.root.elements["configuration/crm_config/cluster_property_set[@id='cib-bootstrap-options']"] cluster_property_set&.each_element do |e| items = e.attributes - property = { name: items['name'], value: items['value'] } + property = { name: items['name'], value: items['value'] } - property_instance = { - name: property[:name], - ensure: :present, - value: property[:value], - provider: name - } - instances << new(property_instance) + property_instance = { + name: property[:name], + ensure: :present, + value: property[:value], + provider: name + } + instances << new(property_instance) end instances end diff --git a/lib/puppet/provider/cs_property/pcs.rb b/lib/puppet/provider/cs_property/pcs.rb index 5258c51f..3132c2aa 100644 --- a/lib/puppet/provider/cs_property/pcs.rb +++ b/lib/puppet/provider/cs_property/pcs.rb @@ -32,15 +32,15 @@ def self.instances cluster_property_set = doc.root.elements["configuration/crm_config/cluster_property_set[@id='cib-bootstrap-options']"] cluster_property_set&.each_element do |e| items = e.attributes - property = { name: items['name'], value: items['value'] } - - property_instance = { - name: property[:name], - ensure: :present, - value: property[:value], - provider: name - } - instances << new(property_instance) + property = { name: items['name'], value: items['value'] } + + property_instance = { + name: property[:name], + ensure: :present, + value: property[:value], + provider: name + } + instances << new(property_instance) end instances end From a04d195e2c7e78b37de5b894641a41f1191560d3 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 17 Jan 2022 10:41:16 +0100 Subject: [PATCH 11/39] fix namespace --- lib/puppet/type/cs_primitive.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/puppet/type/cs_primitive.rb b/lib/puppet/type/cs_primitive.rb index d91d4ad4..b1848409 100644 --- a/lib/puppet/type/cs_primitive.rb +++ b/lib/puppet/type/cs_primitive.rb @@ -223,9 +223,7 @@ def insync?(is) super(is.reject { |k| @resource[:unmanaged_metadata].include?(k) }) end - # rubocop:disable Style/PredicateName - def is_to_s(is) - # rubocop:enable Style/PredicateName + def is_to_s(is) # rubocop:disable Naming/PredicateName super(is.reject { |k| @resource[:unmanaged_metadata].include?(k) }) end From ff36728953692749eac3f587ab03e71c2c984914 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 17 Jan 2022 10:41:32 +0100 Subject: [PATCH 12/39] generate rubocop todo config --- .rubocop.yml | 2 + .rubocop_todo.yml | 112 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 .rubocop_todo.yml diff --git a/.rubocop.yml b/.rubocop.yml index fded90cf..7e8bb89d 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..879cd261 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,112 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2022-01-17 09:39:27 UTC using RuboCop version 1.22.3. +# 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: 1 +# Cop supports --auto-correct. +Layout/CommentIndentation: + Exclude: + - 'lib/puppet/provider/cs_location/pcs.rb' + +# Offense count: 4 +# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches. +Lint/DuplicateBranch: + Exclude: + - 'lib/puppet/provider/cs_primitive/pcs.rb' + - 'spec/spec_helper_acceptance.rb' + - 'spec/spec_helper_corosync.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Lint/RedundantCopDisableDirective: + Exclude: + - 'lib/puppet/provider/cs_colocation/pcs.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: AllowedMethods. +# AllowedMethods: instance_of?, kind_of?, is_a?, eql?, respond_to?, equal? +Lint/RedundantSafeNavigation: + Exclude: + - 'lib/puppet/provider/cs_primitive/crm.rb' + - 'lib/puppet/provider/cs_primitive/pcs.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Lint/RedundantStringCoercion: + Exclude: + - 'lib/puppet/provider/cs_rsc_defaults/pcs.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: AllowedMethods. +# AllowedMethods: present?, blank?, presence, try, try! +Lint/SafeNavigationConsistency: + Exclude: + - 'lib/puppet/provider/cs_primitive/crm.rb' + - 'lib/puppet/provider/cs_primitive/pcs.rb' + +# Offense count: 1 +# Configuration parameters: CheckForMethodsWithNoSideEffects. +Lint/Void: + Exclude: + - 'lib/puppet/type/cs_colocation.rb' + +# Offense count: 13 +# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. +# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to +Naming/MethodParameterName: + Exclude: + - 'lib/puppet/provider/cs_colocation/pcs.rb' + - 'lib/puppet/provider/cs_primitive/crm.rb' + - 'lib/puppet/provider/cs_primitive/pcs.rb' + - 'lib/puppet/type/cs_commit.rb' + - 'lib/puppet/type/cs_group.rb' + - 'lib/puppet/type/cs_location.rb' + - 'lib/puppet/type/cs_primitive.rb' + - 'lib/puppet/type/cs_property.rb' + - 'lib/puppet/type/cs_shadow.rb' + - 'lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb' + +# Offense count: 1 +# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers. +# SupportedStyles: snake_case, normalcase, non_integer +# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339 +Naming/VariableNumber: + Exclude: + - 'lib/puppet_x/voxpupuli/corosync/provider/pcs.rb' + +# Offense count: 1 +RSpec/EmptyExampleGroup: + Exclude: + - 'spec/classes/corosync_qdevice_spec.rb' + +# Offense count: 1 +# Configuration parameters: AllowSubject. +RSpec/MultipleMemoizedHelpers: + Max: 10 + +# Offense count: 4 +RSpec/RepeatedExampleGroupBody: + Exclude: + - 'spec/acceptance/basic_spec.rb' + - 'spec/acceptance/corosync_class_spec.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Style/CaseLikeIf: + Exclude: + - 'lib/puppet/provider/cs_colocation/pcs.rb' + +# Offense count: 7 +# Configuration parameters: AllowedMethods. +# AllowedMethods: respond_to_missing? +Style/OptionalBooleanParameter: + Exclude: + - 'lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb' + - 'lib/puppet_x/voxpupuli/corosync/provider/crmsh.rb' + - 'lib/puppet_x/voxpupuli/corosync/provider/pcs.rb' From dab220d93eb84b5adc64a66b498e69cfcac5b59a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 17 Jan 2022 10:45:28 +0100 Subject: [PATCH 13/39] Disable params_empty_string_assignment for pcs_version --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 1b4fe15f..2250abae 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -402,7 +402,7 @@ Boolean $test_corosync_config = $corosync::params::test_corosync_config, Optional[Variant[Stdlib::Absolutepath, Enum['off']]] $watchdog_device = undef, Enum['pcs', 'crm'] $provider = 'pcs', - String $pcs_version = '', + String $pcs_version = '', # lint:ignore:params_empty_string_assignment ) inherits corosync::params { if $set_votequorum and (empty($quorum_members) and empty($multicast_address) and !$cluster_name) { fail('set_votequorum is true, so you must set either quorum_members, or one of multicast_address or cluster_name.') From 5a6394f693d0a4c771e4de61254113dadd73bdad Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 16 Nov 2022 15:58:51 +0100 Subject: [PATCH 14/39] rubocop: autofix --- lib/puppet/type/cs_primitive.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/type/cs_primitive.rb b/lib/puppet/type/cs_primitive.rb index b1848409..1be05cfb 100644 --- a/lib/puppet/type/cs_primitive.rb +++ b/lib/puppet/type/cs_primitive.rb @@ -223,7 +223,7 @@ def insync?(is) super(is.reject { |k| @resource[:unmanaged_metadata].include?(k) }) end - def is_to_s(is) # rubocop:disable Naming/PredicateName + def is_to_s(is) super(is.reject { |k| @resource[:unmanaged_metadata].include?(k) }) end From 7b8472f87ee5ffac1e24e13dfe24af6ef2fcf839 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 16 Nov 2022 16:04:41 +0100 Subject: [PATCH 15/39] unfreeze crm.rb --- lib/puppet/provider/cs_clone/crm.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/provider/cs_clone/crm.rb b/lib/puppet/provider/cs_clone/crm.rb index a6cda367..3d775be3 100644 --- a/lib/puppet/provider/cs_clone/crm.rb +++ b/lib/puppet/provider/cs_clone/crm.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: true +# frozen_string_literal: false begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' From 9a2d52dfaaf7c328d0324056f0ef9b4c0a4882f0 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 16 Nov 2022 16:12:38 +0100 Subject: [PATCH 16/39] update rubocop config --- .rubocop_todo.yml | 23 ++--------------------- lib/puppet/provider/cs_colocation/crm.rb | 2 +- lib/puppet/provider/cs_primitive/crm.rb | 2 +- 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 879cd261..c4a09799 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2022-01-17 09:39:27 UTC using RuboCop version 1.22.3. +# on 2022-11-16 15:12:16 UTC using RuboCop version 1.22.3. # 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 @@ -56,7 +56,7 @@ Lint/Void: Exclude: - 'lib/puppet/type/cs_colocation.rb' -# Offense count: 13 +# Offense count: 5 # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. # AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to Naming/MethodParameterName: @@ -64,12 +64,7 @@ Naming/MethodParameterName: - 'lib/puppet/provider/cs_colocation/pcs.rb' - 'lib/puppet/provider/cs_primitive/crm.rb' - 'lib/puppet/provider/cs_primitive/pcs.rb' - - 'lib/puppet/type/cs_commit.rb' - - 'lib/puppet/type/cs_group.rb' - - 'lib/puppet/type/cs_location.rb' - 'lib/puppet/type/cs_primitive.rb' - - 'lib/puppet/type/cs_property.rb' - - 'lib/puppet/type/cs_shadow.rb' - 'lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb' # Offense count: 1 @@ -80,11 +75,6 @@ Naming/VariableNumber: Exclude: - 'lib/puppet_x/voxpupuli/corosync/provider/pcs.rb' -# Offense count: 1 -RSpec/EmptyExampleGroup: - Exclude: - - 'spec/classes/corosync_qdevice_spec.rb' - # Offense count: 1 # Configuration parameters: AllowSubject. RSpec/MultipleMemoizedHelpers: @@ -101,12 +91,3 @@ RSpec/RepeatedExampleGroupBody: Style/CaseLikeIf: Exclude: - 'lib/puppet/provider/cs_colocation/pcs.rb' - -# Offense count: 7 -# Configuration parameters: AllowedMethods. -# AllowedMethods: respond_to_missing? -Style/OptionalBooleanParameter: - Exclude: - - 'lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb' - - 'lib/puppet_x/voxpupuli/corosync/provider/crmsh.rb' - - 'lib/puppet_x/voxpupuli/corosync/provider/pcs.rb' diff --git a/lib/puppet/provider/cs_colocation/crm.rb b/lib/puppet/provider/cs_colocation/crm.rb index b6a5453b..ecd8f5b1 100644 --- a/lib/puppet/provider/cs_colocation/crm.rb +++ b/lib/puppet/provider/cs_colocation/crm.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: true +# frozen_string_literal: false begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' diff --git a/lib/puppet/provider/cs_primitive/crm.rb b/lib/puppet/provider/cs_primitive/crm.rb index 96a309c9..4bc5a15f 100644 --- a/lib/puppet/provider/cs_primitive/crm.rb +++ b/lib/puppet/provider/cs_primitive/crm.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: true +# frozen_string_literal: false begin require 'puppet_x/voxpupuli/corosync/provider/crmsh' From 4b0531a6a8181a27438c6a3d93e0826cc5e01f2c Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 16 Nov 2022 16:20:05 +0100 Subject: [PATCH 17/39] fix broken code --- .rubocop_todo.yml | 43 ++++++++++++++----------- lib/puppet/provider/cs_primitive/crm.rb | 6 ++-- lib/puppet/provider/cs_primitive/pcs.rb | 6 ++-- lib/puppet/type/cs_primitive.rb | 2 +- 4 files changed, 32 insertions(+), 25 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index c4a09799..4d51cc4e 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2022-11-16 15:12:16 UTC using RuboCop version 1.22.3. +# on 2022-11-16 15:26:02 UTC using RuboCop version 1.22.3. # 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 @@ -26,30 +26,12 @@ Lint/RedundantCopDisableDirective: Exclude: - 'lib/puppet/provider/cs_colocation/pcs.rb' -# Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: AllowedMethods. -# AllowedMethods: instance_of?, kind_of?, is_a?, eql?, respond_to?, equal? -Lint/RedundantSafeNavigation: - Exclude: - - 'lib/puppet/provider/cs_primitive/crm.rb' - - 'lib/puppet/provider/cs_primitive/pcs.rb' - # Offense count: 1 # Cop supports --auto-correct. Lint/RedundantStringCoercion: Exclude: - 'lib/puppet/provider/cs_rsc_defaults/pcs.rb' -# Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: AllowedMethods. -# AllowedMethods: present?, blank?, presence, try, try! -Lint/SafeNavigationConsistency: - Exclude: - - 'lib/puppet/provider/cs_primitive/crm.rb' - - 'lib/puppet/provider/cs_primitive/pcs.rb' - # Offense count: 1 # Configuration parameters: CheckForMethodsWithNoSideEffects. Lint/Void: @@ -91,3 +73,26 @@ RSpec/RepeatedExampleGroupBody: Style/CaseLikeIf: Exclude: - 'lib/puppet/provider/cs_colocation/pcs.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: IgnoredMethods. +# IgnoredMethods: ==, equal?, eql? +Style/ClassEqualityComparison: + Exclude: + - 'lib/puppet/provider/cs_primitive/crm.rb' + - 'lib/puppet/provider/cs_primitive/pcs.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/IfUnlessModifier: + Exclude: + - 'lib/puppet/provider/cs_primitive/crm.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods. +# AllowedMethods: present?, blank?, presence, try, try! +Style/SafeNavigation: + Exclude: + - 'lib/puppet/provider/cs_primitive/pcs.rb' diff --git a/lib/puppet/provider/cs_primitive/crm.rb b/lib/puppet/provider/cs_primitive/crm.rb index 4bc5a15f..308adb0f 100644 --- a/lib/puppet/provider/cs_primitive/crm.rb +++ b/lib/puppet/provider/cs_primitive/crm.rb @@ -159,9 +159,11 @@ def flush end end end - if @resource&.instance_of?(:cs_primitive) && @resource[:unmanaged_metadata] + if @resource && @resource.class.name == :cs_primitive && @resource[:unmanaged_metadata] @resource[:unmanaged_metadata].each do |parameter_name| - @property_hash[:metadata][parameter_name] = @property_hash[:existing_metadata]['target-role'] if @property_hash[:existing_metadata] && @property_hash[:existing_metadata][parameter_name] + if @property_hash[:existing_metadata] && @property_hash[:existing_metadata][parameter_name] + @property_hash[:metadata][parameter_name] = @property_hash[:existing_metadata]['target-role'] + end end end unless @property_hash[:parameters].empty? diff --git a/lib/puppet/provider/cs_primitive/pcs.rb b/lib/puppet/provider/cs_primitive/pcs.rb index 6fd8557b..62b96df3 100644 --- a/lib/puppet/provider/cs_primitive/pcs.rb +++ b/lib/puppet/provider/cs_primitive/pcs.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: true +# frozen_string_literal: false begin require 'puppet_x/voxpupuli/corosync/provider/pcs' @@ -266,10 +266,10 @@ def flush end # Clear all metadata structures when specified - if @resource&.instance_of?(:cs_primitive) && @resource[:unmanaged_metadata] + if @resource && @resource.class.name == :cs_primitive && @resource[:unmanaged_metadata] @resource[:unmanaged_metadata].each do |parameter_name| @property_hash[:metadata].delete(parameter_name) - @property_hash[:existing_metadata]&.delete(parameter_name) + @property_hash[:existing_metadata].delete(parameter_name) if @property_hash[:existing_metadata] end end diff --git a/lib/puppet/type/cs_primitive.rb b/lib/puppet/type/cs_primitive.rb index 1be05cfb..5400bcc7 100644 --- a/lib/puppet/type/cs_primitive.rb +++ b/lib/puppet/type/cs_primitive.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: true +# frozen_string_literal: false require 'puppet/parameter/boolean' From e90c6ddef082367d70201aafd18e8d4074dfa253 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 16 Nov 2022 16:30:56 +0100 Subject: [PATCH 18/39] purge pry --- spec/acceptance/cs_primitive_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/acceptance/cs_primitive_spec.rb b/spec/acceptance/cs_primitive_spec.rb index d9b56389..c063d631 100644 --- a/spec/acceptance/cs_primitive_spec.rb +++ b/spec/acceptance/cs_primitive_spec.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require 'spec_helper_acceptance' -require 'pry' describe 'corosync' do cert = '-----BEGIN CERTIFICATE----- From 6d393d12634515e0cede480b6d7d20fbf0c29cbf Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 20 Dec 2022 15:00:13 +0100 Subject: [PATCH 19/39] modulesync 5.4.0 --- .msync.yml | 2 +- .rubocop.yml | 2 -- Gemfile | 2 +- 3 files changed, 2 insertions(+), 4 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/.rubocop.yml b/.rubocop.yml index 7e8bb89d..fded90cf 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,4 @@ --- -inherit_from: .rubocop_todo.yml - # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 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 501d78c116301aca9f73446f7244b8f98f92f69e Mon Sep 17 00:00:00 2001 From: Massimiliano Adamo Date: Sat, 15 Apr 2023 09:53:32 +0200 Subject: [PATCH 20/39] 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 962ad7e8..1a9b0607 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-corosync' 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-corosync' - 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 2b5eae6c77bbce6bc28fc770a8e861f4b00e697f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 12 May 2023 11:18:20 +0200 Subject: [PATCH 21/39] 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 c3547700cf87118bb7c05b49fd75b0c0ae35aff8 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 20 Jul 2023 10:36:34 +0200 Subject: [PATCH 22/39] Regenerate REFERENCE.md --- REFERENCE.md | 983 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 593 insertions(+), 390 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 1260fdb2..42addf42 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -1,44 +1,45 @@ # Reference + ## Table of Contents -**Classes** +### Classes * [`corosync`](#corosync): Configures the Pacemaker+Corosync stack to provide high-availability. -* [`corosync::params`](#corosyncparams): Configures sane defaults based on the operating system. -* [`corosync::qdevice`](#corosyncqdevice): Performs basic initial configuration of the qdevice daemon on a node. -* [`corosync::reprobe`](#corosyncreprobe): Triggers re-probe for changes any of the native cs_* types. +* [`corosync::params`](#corosync--params): Configures sane defaults based on the operating system. +* [`corosync::qdevice`](#corosync--qdevice): Performs basic initial configuration of the qdevice daemon on a node. +* [`corosync::reprobe`](#corosync--reprobe): Triggers re-probe for changes any of the native cs_* types. -**Defined types** +### Defined types -* [`corosync::service`](#corosyncservice): Declare services within /etc/corosync/service.d/ (Corosync 1.x) +* [`corosync::service`](#corosync--service): Declare services within /etc/corosync/service.d/ (Corosync 1.x) -**Resource types** +### Resource types * [`cs_clone`](#cs_clone): Type for manipulating corosync/pacemaker resource clone. More information on Corosync/Pacemaker colocation can be found here: * http://www.c * [`cs_colocation`](#cs_colocation): Type for manipulating corosync/pacemaker colocation. Colocation is the grouping together of a set of primitives so that they travel together -* [`cs_commit`](#cs_commit): Final commit statement which triggers the syncronous application of all primitive changes which reference this CIB. Do not generate more than -* [`cs_group`](#cs_group): Type for manipulating Corosync/Pacemkaer group entries. Groups are a set or resources (primitives) that need to be grouped together. More in +* [`cs_commit`](#cs_commit): Final commit statement which triggers the synchronous application of all primitive changes which reference this CIB. Do not generate more tha +* [`cs_group`](#cs_group): Type for manipulating Corosync/Pacemaker group entries. Groups are a set or resources (primitives) that need to be grouped together. More in * [`cs_location`](#cs_location): Type for manipulating corosync/pacemaker resource location. More information on Corosync/Pacemaker colocation can be found here: * http://ww -* [`cs_order`](#cs_order): Type for manipulating Corosync/Pacemkaer ordering entries. Order entries are another type of constraint that can be put on sets of primitive +* [`cs_order`](#cs_order): Type for manipulating Corosync/Pacemaker ordering entries. Order entries are another type of constraint that can be put on sets of primitive * [`cs_primitive`](#cs_primitive): Type for manipulating Corosync/Pacemaker primitives. Primitives are probably the most important building block when creating highly availabl -* [`cs_property`](#cs_property): Type for manipulating corosync/pacemaker configuration properties. Besides the configuration file that is managed by the module the contains +* [`cs_property`](#cs_property): Type for manipulating corosync/pacemaker configuration properties. Besides the configuration file that is managed by the module the contains * [`cs_rsc_defaults`](#cs_rsc_defaults): Type for manipulating corosync/pacemaker global defaults for resource options. The type is pretty simple interface for setting key/value pair -* [`cs_shadow`](#cs_shadow): cs_shadow resources represent a Corosync shadow CIB. Any corosync resources defined with 'cib' set to the title of a cs_shadow resource will +* [`cs_shadow`](#cs_shadow): cs_shadow resources represent a Corosync shadow CIB. Any corosync resources defined with 'cib' set to the title of a cs_shadow resource will -**Data types** +### Data types -* [`Corosync::ArrayRing`](#corosyncarrayring): -* [`Corosync::CryptoCipher`](#corosynccryptocipher): Defines the allowed cipher types for secure corosync communication -* [`Corosync::CryptoHash`](#corosynccryptohash): -* [`Corosync::IpStringIp`](#corosyncipstringip): -* [`Corosync::QuorumAlgorithm`](#corosyncquorumalgorithm): -* [`Corosync::Syslogpriority`](#corosyncsyslogpriority): +* [`Corosync::ArrayRing`](#Corosync--ArrayRing) +* [`Corosync::CryptoCipher`](#Corosync--CryptoCipher): Defines the allowed cipher types for secure corosync communication +* [`Corosync::CryptoHash`](#Corosync--CryptoHash) +* [`Corosync::IpStringIp`](#Corosync--IpStringIp) +* [`Corosync::QuorumAlgorithm`](#Corosync--QuorumAlgorithm) +* [`Corosync::Syslogpriority`](#Corosync--Syslogpriority) ## Classes -### corosync +### `corosync` This class will set up corosync for use by the Puppet Enterprise console to facilitate an active/standby configuration for high availability. It is @@ -68,53 +69,125 @@ class { 'corosync': #### Parameters -The following parameters are available in the `corosync` class. - -##### `enable_secauth` +The following parameters are available in the `corosync` class: + +* [`enable_secauth`](#-corosync--enable_secauth) +* [`authkey_source`](#-corosync--authkey_source) +* [`authkey`](#-corosync--authkey) +* [`crypto_hash`](#-corosync--crypto_hash) +* [`crypto_cipher`](#-corosync--crypto_cipher) +* [`threads`](#-corosync--threads) +* [`bind_address`](#-corosync--bind_address) +* [`port`](#-corosync--port) +* [`multicast_address`](#-corosync--multicast_address) +* [`unicast_addresses`](#-corosync--unicast_addresses) +* [`force_online`](#-corosync--force_online) +* [`check_standby`](#-corosync--check_standby) +* [`log_timestamp`](#-corosync--log_timestamp) +* [`log_file`](#-corosync--log_file) +* [`log_file_name`](#-corosync--log_file_name) +* [`debug`](#-corosync--debug) +* [`log_stderr`](#-corosync--log_stderr) +* [`syslog_priority`](#-corosync--syslog_priority) +* [`log_function_name`](#-corosync--log_function_name) +* [`rrp_mode`](#-corosync--rrp_mode) +* [`netmtu`](#-corosync--netmtu) +* [`ttl`](#-corosync--ttl) +* [`vsftype`](#-corosync--vsftype) +* [`package_corosync`](#-corosync--package_corosync) +* [`package_pacemaker`](#-corosync--package_pacemaker) +* [`package_fence_agents`](#-corosync--package_fence_agents) +* [`packageopts_corosync`](#-corosync--packageopts_corosync) +* [`packageopts_crmsh`](#-corosync--packageopts_crmsh) +* [`packageopts_pacemaker`](#-corosync--packageopts_pacemaker) +* [`packageopts_pcs`](#-corosync--packageopts_pcs) +* [`packageopts_fence_agents`](#-corosync--packageopts_fence_agents) +* [`ensure_corosync`](#-corosync--ensure_corosync) +* [`ensure_crmsh`](#-corosync--ensure_crmsh) +* [`ensure_pacemaker`](#-corosync--ensure_pacemaker) +* [`ensure_pcs`](#-corosync--ensure_pcs) +* [`ensure_fence_agents`](#-corosync--ensure_fence_agents) +* [`set_votequorum`](#-corosync--set_votequorum) +* [`votequorum_expected_votes`](#-corosync--votequorum_expected_votes) +* [`quorum_members`](#-corosync--quorum_members) +* [`quorum_members_ids`](#-corosync--quorum_members_ids) +* [`quorum_members_names`](#-corosync--quorum_members_names) +* [`token`](#-corosync--token) +* [`token_retransmits_before_loss_const`](#-corosync--token_retransmits_before_loss_const) +* [`compatibility`](#-corosync--compatibility) +* [`enable_corosync_service`](#-corosync--enable_corosync_service) +* [`manage_corosync_service`](#-corosync--manage_corosync_service) +* [`enable_pacemaker_service`](#-corosync--enable_pacemaker_service) +* [`manage_pacemaker_service`](#-corosync--manage_pacemaker_service) +* [`enable_pcsd_service`](#-corosync--enable_pcsd_service) +* [`manage_pcsd_service`](#-corosync--manage_pcsd_service) +* [`manage_pcsd_auth`](#-corosync--manage_pcsd_auth) +* [`manage_pcsd_auth_node`](#-corosync--manage_pcsd_auth_node) +* [`sensitive_hacluster_password`](#-corosync--sensitive_hacluster_password) +* [`sensitive_hacluster_hash`](#-corosync--sensitive_hacluster_hash) +* [`manage_quorum_device`](#-corosync--manage_quorum_device) +* [`quorum_device_host`](#-corosync--quorum_device_host) +* [`quorum_device_algorithm`](#-corosync--quorum_device_algorithm) +* [`package_quorum_device`](#-corosync--package_quorum_device) +* [`sensitive_quorum_device_password`](#-corosync--sensitive_quorum_device_password) +* [`cluster_name`](#-corosync--cluster_name) +* [`join`](#-corosync--join) +* [`consensus`](#-corosync--consensus) +* [`ip_version`](#-corosync--ip_version) +* [`clear_node_high_bit`](#-corosync--clear_node_high_bit) +* [`max_messages`](#-corosync--max_messages) +* [`test_corosync_config`](#-corosync--test_corosync_config) +* [`test_corosync_config_cmd`](#-corosync--test_corosync_config_cmd) +* [`watchdog_device`](#-corosync--watchdog_device) +* [`provider`](#-corosync--provider) +* [`config_validate_cmd`](#-corosync--config_validate_cmd) +* [`pcs_version`](#-corosync--pcs_version) + +##### `enable_secauth` Data type: `Boolean` Controls corosync's ability to authenticate and encrypt multicast messages. -Default value: $corosync::params::enable_secauth +Default value: `$corosync::params::enable_secauth` -##### `authkey_source` +##### `authkey_source` Data type: `Enum['file', 'string']` Allows to use either a file or a string as a authkey. -Default value: $corosync::params::authkey_source +Default value: `$corosync::params::authkey_source` -##### `authkey` +##### `authkey` -Data type: `Variant[Stdlib::Absolutepath,Stdlib::Base64]` +Data type: `Variant[Stdlib::Filesource,Stdlib::Base64]` Specifies the path to the CA which is used to sign Corosync's certificate if authkey_source is 'file' or a base64 encoded version of the actual authkey if 'string' is used instead. -Default value: $corosync::params::authkey +Default value: `$corosync::params::authkey` -##### `crypto_hash` +##### `crypto_hash` Data type: `Corosync::CryptoHash` Hashing algorithm used by corosync for intra-cluster communication. Valid values are none, md5, sha1, sha256, sha384, and sha512 -Default value: 'sha1' +Default value: `'sha1'` -##### `crypto_cipher` +##### `crypto_cipher` Data type: `Corosync::CryptoCipher` Encryption cipher used by corosync for intra-cluster communication. Valid values are none, aes256, aes192, aes128, and 3des -Default value: 'aes256' +Default value: `'aes256'` -##### `threads` +##### `threads` Data type: `Optional[Integer]` @@ -124,16 +197,16 @@ threads. Default value: `undef` -##### `bind_address` +##### `bind_address` Data type: `Corosync::IpStringIp` The ip address we are going to bind the corosync daemon too. Can be specified as an array to have multiple rings. -Default value: $corosync::params::bind_address +Default value: `$corosync::params::bind_address` -##### `port` +##### `port` Data type: `Optional[Variant[Stdlib::Port, Array[Stdlib::Port]]]` @@ -141,9 +214,9 @@ The UDP port that corosync will use to do its multicast communication. Be aware that corosync used this defined port plus minus one. Can be specified as an array to have multiple rings. -Default value: $corosync::params::port +Default value: `$corosync::params::port` -##### `multicast_address` +##### `multicast_address` Data type: `Optional[Corosync::IpStringIp]` @@ -154,56 +227,57 @@ Can be specified as an array to have multiple rings (multicast only). Default value: `undef` -##### `unicast_addresses` +##### `unicast_addresses` Data type: `Optional[Array]` An array of IP addresses that make up the cluster's members. These are -use if you are able to use multicast on your network and instead opt for -the udpu transport. You need a relatively recent version of Corosync to +used if you are not able to use multicast on your network and instead opt +for the udpu transport. You need a relatively recent version of Corosync to make this possible. You can also have an array of arrays to have multiple rings. In that case, each subarray matches a host IP addresses. +As of Corosync 3 knet is the new default which also does not use multicast. Default value: `undef` -##### `force_online` +##### `force_online` Data type: `Boolean` Boolean parameter specifying whether to force nodes that have been put in standby back online. -Default value: $corosync::params::force_online +Default value: `$corosync::params::force_online` -##### `check_standby` +##### `check_standby` Data type: `Boolean` Boolean parameter specifying whether puppet should return an error log message if a node is in standby. Useful for monitoring node state. -Default value: $corosync::params::check_standby +Default value: `$corosync::params::check_standby` -##### `log_timestamp` +##### `log_timestamp` Data type: `Boolean` Boolean parameter specifying whether a timestamp should be placed on all log messages. -Default value: $corosync::params::log_timestamp +Default value: `$corosync::params::log_timestamp` -##### `log_file` +##### `log_file` Data type: `Boolean` Boolean parameter specifying whether Corosync should produce debug output in a logfile. -Default value: $corosync::params::log_file +Default value: `$corosync::params::log_file` -##### `log_file_name` +##### `log_file_name` Data type: `Optional[Stdlib::Absolutepath]` @@ -212,43 +286,43 @@ above) is true. Default value: `undef` -##### `debug` +##### `debug` Data type: `Boolean` Boolean parameter specifying whether Corosync should produce debug output in its logs. -Default value: $corosync::params::debug +Default value: `$corosync::params::debug` -##### `log_stderr` +##### `log_stderr` Data type: `Boolean` Boolean parameter specifying whether Corosync should log errors to stderr. -Default value: $corosync::params::log_stderr +Default value: `$corosync::params::log_stderr` -##### `syslog_priority` +##### `syslog_priority` Data type: `Corosync::SyslogPriority` String parameter specifying the minimal log level for Corosync syslog messages. Allowed values: debug|info|notice|warning|err|emerg. -Default value: $corosync::params::syslog_priority +Default value: `$corosync::params::syslog_priority` -##### `log_function_name` +##### `log_function_name` Data type: `Boolean` Boolean parameter specifying whether Corosync should log called function names to. -Default value: $corosync::params::log_function_name +Default value: `$corosync::params::log_function_name` -##### `rrp_mode` +##### `rrp_mode` Data type: `Optional[Enum['none', 'active', 'passive']]` @@ -256,7 +330,7 @@ Mode of redundant ring. May be none, active, or passive. Default value: `undef` -##### `netmtu` +##### `netmtu` Data type: `Optional[Integer]` @@ -264,7 +338,7 @@ This specifies the network maximum transmit unit. Default value: `undef` -##### `ttl` +##### `ttl` Data type: `Optional[Integer[0,255]]` @@ -272,7 +346,7 @@ Time To Live. Default value: `undef` -##### `vsftype` +##### `vsftype` Data type: `Optional[Enum['ykd', 'none']]` @@ -280,43 +354,23 @@ Virtual synchrony filter type. Default value: `undef` -##### `package_corosync` +##### `package_corosync` Data type: `Boolean` Define if package corosync should be managed. -Default value: $corosync::params::package_corosync - -##### `package_crmsh` - -Data type: `Boolean` - -Define if package crmsh should be managed. -Default (Debian): true -Default: false - -Default value: $corosync::params::package_crmsh +Default value: `$corosync::params::package_corosync` -##### `package_pacemaker` +##### `package_pacemaker` Data type: `Boolean` Define if package pacemaker should be managed. -Default value: $corosync::params::package_pacemaker - -##### `package_pcs` - -Data type: `Boolean` - -Define if package pcs should be managed. -Default (Red Hat based): true -Default (otherwise): false +Default value: `$corosync::params::package_pacemaker` -Default value: $corosync::params::package_pcs - -##### `package_fence_agents` +##### `package_fence_agents` Data type: `Boolean` @@ -324,99 +378,99 @@ Define if package fence-agents should be managed. Default (Red Hat based): true Default (otherwise): false -Default value: $corosync::params::package_fence_agents +Default value: `false` -##### `packageopts_corosync` +##### `packageopts_corosync` Data type: `Optional[Array[String[1]]]` Additional install-options for the corosync package resource. Default: undef -Default value: $corosync::params::package_install_options +Default value: `$corosync::params::package_install_options` -##### `packageopts_crmsh` +##### `packageopts_crmsh` Data type: `Optional[Array[String[1]]]` Additional install-options for the crmsh package resource. Default: undef -Default value: $corosync::params::package_install_options +Default value: `$corosync::params::package_install_options` -##### `packageopts_pacemaker` +##### `packageopts_pacemaker` Data type: `Optional[Array[String[1]]]` Additional install-options for the pacemaker package resource. Default: undef -Default value: $corosync::params::package_install_options +Default value: `$corosync::params::package_install_options` -##### `packageopts_pcs` +##### `packageopts_pcs` Data type: `Optional[Array[String[1]]]` Additional install-options for the pcs package resource. Default: undef -Default value: $corosync::params::package_install_options +Default value: `$corosync::params::package_install_options` -##### `packageopts_fence_agents` +##### `packageopts_fence_agents` Data type: `Optional[Array[String[1]]]` Additional install-options for the pcs package resource. Default: undef -Default value: $corosync::params::package_install_options +Default value: `$corosync::params::package_install_options` -##### `version_corosync` +##### `ensure_corosync` Data type: `String[1]` Define what version of the corosync package should be installed. Default: 'present' -Default value: $corosync::params::version_corosync +Default value: `$corosync::params::ensure_corosync` -##### `version_crmsh` +##### `ensure_crmsh` Data type: `String[1]` Define what version of the crmsh package should be installed. Default: 'present' -Default value: $corosync::params::version_crmsh +Default value: `$corosync::params::ensure_crmsh` -##### `version_pacemaker` +##### `ensure_pacemaker` Data type: `String[1]` Define what version of the pacemaker package should be installed. Default: 'present' -Default value: $corosync::params::version_pacemaker +Default value: `$corosync::params::ensure_pacemaker` -##### `version_pcs` +##### `ensure_pcs` Data type: `String[1]` Define what version of the pcs package should be installed. Default: 'present' -Default value: $corosync::params::version_pcs +Default value: `$corosync::params::ensure_pcs` -##### `version_fence_agents` +##### `ensure_fence_agents` Data type: `String[1]` Define what version of the fence-agents-all package should be installed. Default: 'present' -Default value: $corosync::params::version_fence_agents +Default value: `$corosync::params::ensure_fence_agents` -##### `set_votequorum` +##### `set_votequorum` Data type: `Boolean` @@ -425,9 +479,9 @@ Default (Red Hat based): true Default (Ubuntu >= 14.04): true Default (otherwise): false -Default value: $corosync::params::set_votequorum +Default value: `$corosync::params::set_votequorum` -##### `votequorum_expected_votes` +##### `votequorum_expected_votes` Data type: `Optional[Integer]` @@ -436,7 +490,7 @@ derived from the number of nodes. Default value: `undef` -##### `quorum_members` +##### `quorum_members` Data type: `Array` @@ -445,9 +499,9 @@ is set to true. You can also have an array of arrays to have multiple rings. In that case, each subarray matches a member IP addresses. -Default value: ['localhost'] +Default value: `['localhost']` -##### `quorum_members_ids` +##### `quorum_members_ids` Data type: `Optional[Array]` @@ -457,7 +511,7 @@ Should be used only with the quorum_members parameter. Default value: `undef` -##### `quorum_members_names` +##### `quorum_members_names` Data type: `Optional[Array]` @@ -466,7 +520,7 @@ define IP addresses in quorum_members. Default value: `undef` -##### `token` +##### `token` Data type: `Optional[Integer]` @@ -474,7 +528,7 @@ Time (in ms) to wait for a token Default value: `undef` -##### `token_retransmits_before_loss_const` +##### `token_retransmits_before_loss_const` Data type: `Optional[Integer]` @@ -482,7 +536,7 @@ How many token retransmits before forming a new configuration. Default value: `undef` -##### `compatibility` +##### `compatibility` Data type: `Optional[String]` @@ -491,32 +545,32 @@ backward compatibility. This sets that. Default value: `undef` -##### `enable_corosync_service` +##### `enable_corosync_service` Data type: `Boolean` Whether the module should enable the corosync service. -Default value: $corosync::params::enable_corosync_service +Default value: `$corosync::params::enable_corosync_service` -##### `manage_corosync_service` +##### `manage_corosync_service` Data type: `Boolean` Whether the module should try to manage the corosync service. If set to false, the service will need to be specified in the catalog elsewhere. -Default value: $corosync::params::manage_corosync_service +Default value: `$corosync::params::manage_corosync_service` -##### `enable_pacemaker_service` +##### `enable_pacemaker_service` Data type: `Boolean` Whether the module should enable the pacemaker service. -Default value: $corosync::params::enable_pacemaker_service +Default value: `$corosync::params::enable_pacemaker_service` -##### `manage_pacemaker_service` +##### `manage_pacemaker_service` Data type: `Boolean` @@ -525,17 +579,17 @@ Default (Red Hat based >= 7): true Default (Ubuntu >= 14.04): true Default (otherwise): false -Default value: $corosync::params::manage_pacemaker_service +Default value: `$corosync::params::manage_pacemaker_service` -##### `enable_pcsd_service` +##### `enable_pcsd_service` Data type: `Boolean` Whether the module should enable the pcsd service. -Default value: $corosync::params::enable_pcsd_service +Default value: `$corosync::params::enable_pcsd_service` -##### `manage_pcsd_service` +##### `manage_pcsd_service` Data type: `Boolean` @@ -545,7 +599,7 @@ interface. Default value: `false` -##### `manage_pcsd_auth` +##### `manage_pcsd_auth` Data type: `Boolean` @@ -558,7 +612,7 @@ $sensitive_hacluster_password is mandatory if this parameter is set. Default value: `false` -##### `manage_pcsd_auth_node` +##### `manage_pcsd_auth_node` Data type: `Enum['first','last']` @@ -567,9 +621,9 @@ work. Note that only one node 'should' do the work and nodes are chosen by matching local facts to the contents of quorum_members. When manage_pcsd_auth is disabled this parameter has no effect. -Default value: 'first' +Default value: `'first'` -##### `sensitive_hacluster_password` +##### `sensitive_hacluster_password` Data type: `Optional[Sensitive[String]]` @@ -580,7 +634,7 @@ to authorize all nodes. Default value: `undef` -##### `sensitive_hacluster_hash` +##### `sensitive_hacluster_hash` Data type: `Optional[Sensitive[String]]` @@ -590,7 +644,7 @@ be used to set the password for the hacluster user on each node. Default value: `undef` -##### `manage_quorum_device` +##### `manage_quorum_device` Data type: `Boolean` @@ -602,7 +656,7 @@ nodes have failed. Default value: `false` -##### `quorum_device_host` +##### `quorum_device_host` Data type: `Optional[Stdlib::Fqdn]` @@ -611,9 +665,9 @@ mandatory when manage_quorum_device is true. Default value: `undef` -##### `quorum_device_algorithm` +##### `quorum_device_algorithm` -Data type: `Optional[Corosync::QuorumAlgorithm]` +Data type: `Corosync::QuorumAlgorithm` There are currently two algorithms the quorum device can utilize to determine how its vote should be allocated; Fifty-fifty split and @@ -621,18 +675,18 @@ last-man-standing. See the [corosync-qdevice man page](https://www.systutorials.com/docs/linux/man/8-corosync-qdevice/) for details. -Default value: 'ffsplit' +Default value: `'ffsplit'` -##### `package_quorum_device` +##### `package_quorum_device` Data type: `Optional[String]` The name of the package providing the quorum device functionality. This parameter is mandatory if manage_quorum_device is true. -Default value: $corosync::params::package_quorum_device +Default value: `$corosync::params::package_quorum_device` -##### `sensitive_quorum_device_password` +##### `sensitive_quorum_device_password` Data type: `Optional[Sensitive[String]]` @@ -641,7 +695,7 @@ This parameter is mandatory if manage_quorum_device is true. Default value: `undef` -##### `cluster_name` +##### `cluster_name` Data type: `Optional[String[1]]` @@ -650,7 +704,7 @@ generating of multicast address. Default value: `undef` -##### `join` +##### `join` Data type: `Optional[Integer]` @@ -659,7 +713,7 @@ in the membership protocol. Default value: `undef` -##### `consensus` +##### `consensus` Data type: `Optional[Integer]` @@ -671,7 +725,7 @@ consensus value. Default value: `undef` -##### `ip_version` +##### `ip_version` Data type: `Optional[String[1]]` @@ -686,7 +740,7 @@ Default (if unspecified) is ipv6-4 for knet and udpu transports and ipv4 for udp Default value: `undef` -##### `clear_node_high_bit` +##### `clear_node_high_bit` Data type: `Optional[Enum['yes', 'no']]` @@ -701,7 +755,7 @@ only a subset of the cluster (for example during a rolling upgrade). Default value: `undef` -##### `max_messages` +##### `max_messages` Data type: `Optional[Integer]` @@ -711,20 +765,57 @@ to 256000 / netmtu to prevent overflow of the kernel transmit buffers. Default value: `undef` -##### `test_corosync_config` +##### `test_corosync_config` Data type: `Boolean` Whether we should test new configuration files with `corosync -t`. (requires corosync 2.3.4) -Default value: $corosync::params::test_corosync_config +Default value: `$corosync::params::test_corosync_config` + +##### `test_corosync_config_cmd` + +Override the standard config_validate_cmd which only works for corosync 2.x. + +##### `watchdog_device` + +Data type: `Optional[Variant[Stdlib::Absolutepath, Enum['off']]]` + +Watchdog device to use, for example '/dev/watchdog' or 'off'. +Its presence (or lack thereof) shifted with corosync versions. + +Default value: `undef` + +##### `provider` + +Data type: `Enum['pcs', 'crm']` + +What command line utility provides corosync configuration capabilities. + +Default value: `'pcs'` + +##### `config_validate_cmd` + +Data type: `String[1]` + -### corosync::params + +Default value: `'/usr/bin/env COROSYNC_MAIN_CONFIG_FILE=% /usr/sbin/corosync -t'` + +##### `pcs_version` + +Data type: `String` + + + +Default value: `''` + +### `corosync::params` Configures sane defaults based on the operating system. -### corosync::qdevice +### `corosync::qdevice` This class performs the configuration of the qdevice daemon on a target node. Note that this requires corosync 2.x and must never be deployed on a node @@ -733,7 +824,7 @@ correct firewall ports for both pcs, and the actual quorum device as shown in the included example. * **See also** -https://www.systutorials.com/docs/linux/man/8-corosync-qnetd/ + * https://www.systutorials.com/docs/linux/man/8-corosync-qnetd/ #### Examples @@ -773,35 +864,47 @@ firewalld_service { 'high-availability': #### Parameters -The following parameters are available in the `corosync::qdevice` class. +The following parameters are available in the `corosync::qdevice` class: -##### `sensitive_hacluster_hash` +* [`sensitive_hacluster_hash`](#-corosync--qdevice--sensitive_hacluster_hash) +* [`package_pcs`](#-corosync--qdevice--package_pcs) +* [`package_corosync_qnetd`](#-corosync--qdevice--package_corosync_qnetd) +* [`provider`](#-corosync--qdevice--provider) -Data type: `Sensitive[String]` +##### `sensitive_hacluster_hash` + +Data type: `Optional[Sensitive[String]]` -The password hash for the hacluster user on this quorum device node. This -is currently a mandatory parameter because pcsd must be used to perform the +The password hash for the hacluster user on this quorum device node. If +omitted, you must create the hacluster user and haclient group yourself. +This user is required because pcsd must be used to perform the quorum node configuration. Default value: `undef` -##### `package_pcs` +##### `package_pcs` Data type: `String[1]` Name of the PCS package on this system. -Default value: 'pcs' +Default value: `'pcs'` -##### `package_corosync_qnetd` +##### `package_corosync_qnetd` Data type: `String[1]` Name of the corosync qnetd package for this system. -Default value: 'corosync-qnetd' +Default value: `'corosync-qnetd'` -### corosync::reprobe +##### `provider` + +Data type: `String` + +What command line utility provides corosync configuration capabilities. + +### `corosync::reprobe` Include this class to reprobe the corosync cluster when there are changes in any of the native cs_* types. Useful for multi-node provisioning when the @@ -820,7 +923,7 @@ include corosync::reprobe ## Defined types -### corosync::service +### `corosync::service` Models a Corosync service. Corosync services are plugins that provide functionality for monitoring cluster resources. One of the most common @@ -847,9 +950,12 @@ corosync::service { 'pacemaker': #### Parameters -The following parameters are available in the `corosync::service` defined type. +The following parameters are available in the `corosync::service` defined type: + +* [`name`](#-corosync--service--name) +* [`version`](#-corosync--service--version) -##### `name` +##### `name` Data type: `String` @@ -857,7 +963,7 @@ The namevar in this type is the title you give it when you define a resource instance. It is used for a handful of purposes; defining the name of the config file and the name defined inside the file itself. -##### `version` +##### `version` Data type: `String[1]` @@ -865,7 +971,7 @@ Version of the protocol used by this service. This is currently unused. ## Resource types -### cs_clone +### `cs_clone` Type for manipulating corosync/pacemaker resource clone. More information on Corosync/Pacemaker colocation can be found here: @@ -876,101 +982,110 @@ More information on Corosync/Pacemaker colocation can be found here: The following properties are available in the `cs_clone` type. -##### `ensure` - -Valid values: present, absent - -The basic property that the resource should be in. - -Default value: present - -##### `primitive` - -The corosync resource primitive to be cloned. - -##### `group` - -The corosync resource group to be cloned. - ##### `clone_max` -Valid values: %r{\d+}, absent +Valid values: `%r{\d+}`, `absent` How many copies of the resource to start. Defaults to the number of nodes in the cluster. -Default value: absent +Default value: `absent` ##### `clone_node_max` -Valid values: %r{\d+}, absent +Valid values: `%r{\d+}`, `absent` How many copies of the resource can be started on a single node. Defaults to 1. -Default value: absent +Default value: `absent` -##### `notify_clones` +##### `ensure` -Valid values: `true`, `false`, absent +Valid values: `present`, `absent` -When stopping or starting a copy of the clone, tell all the other copies beforehand -and when the action was successful. -Allowed values: true, false +The basic property that the resource should be in. -Default value: absent +Default value: `present` ##### `globally_unique` -Valid values: `true`, `false`, absent +Valid values: `true`, `false`, `absent` Does each copy of the clone perform a different function? Allowed values: true, false -Default value: absent +Default value: `absent` -##### `ordered` - -Valid values: `true`, `false`, absent - -Should the copies be started in series (instead of in parallel). Allowed values: true, false +##### `group` -Default value: absent +The corosync resource group to be cloned. ##### `interleave` -Valid values: `true`, `false`, absent +Valid values: `true`, `false`, `absent` Changes the behavior of ordering constraints (between clones/masters) so that instances can start/stop as soon as their peer instance has (rather than waiting for every instance of the other clone has). Allowed values: true, false -Default value: absent +Default value: `absent` -#### Parameters +##### `notify_clones` -The following parameters are available in the `cs_clone` type. +Valid values: `true`, `false`, `absent` -##### `name` +When stopping or starting a copy of the clone, tell all the other copies beforehand +and when the action was successful. +Allowed values: true, false -namevar +Default value: `absent` -Identifier of the clone entry. This value needs to be unique -across the entire Corosync/Pacemaker configuration since it doesn't have -the concept of name spaces per type. +##### `ordered` + +Valid values: `true`, `false`, `absent` + +Should the copies be started in series (instead of in parallel). Allowed values: true, false + +Default value: `absent` + +##### `primitive` + +The corosync resource primitive to be cloned. + +#### Parameters + +The following parameters are available in the `cs_clone` type. -##### `cib` +* [`cib`](#-cs_clone--cib) +* [`name`](#-cs_clone--name) +* [`provider`](#-cs_clone--provider) + +##### `cib` Corosync applies its configuration immediately. Using a CIB allows you to group multiple primitives and relationships to be applied at once. This can be necessary to insert complex configurations into Corosync correctly. -This paramater sets the CIB this colocation should be created in. A +This parameter sets the CIB this colocation should be created in. A cs_shadow resource with a title of the same name as this value should also be added to your manifest. -### cs_colocation +##### `name` + +namevar + +Identifier of the clone entry. This value needs to be unique +across the entire Corosync/Pacemaker configuration since it doesn't have +the concept of name spaces per type. + +##### `provider` + +The specific backend to use for this `cs_clone` resource. You will seldom need to specify this --- Puppet will usually +discover the appropriate provider for your platform. + +### `cs_colocation` Type for manipulating corosync/pacemaker colocation. Colocation is the grouping together of a set of primitives so that they travel @@ -988,11 +1103,11 @@ The following properties are available in the `cs_colocation` type. ##### `ensure` -Valid values: present, absent +Valid values: `present`, `absent` The basic property that the resource should be in. -Default value: present +Default value: `present` ##### `primitives` @@ -1021,21 +1136,17 @@ primitives get priority when forcing the move of other primitives. This value can be an integer but is often defined as the string INFINITY. -Default value: INFINITY +Default value: `INFINITY` #### Parameters The following parameters are available in the `cs_colocation` type. -##### `name` +* [`cib`](#-cs_colocation--cib) +* [`name`](#-cs_colocation--name) +* [`provider`](#-cs_colocation--provider) -namevar - -Identifier of the colocation entry. This value needs to be unique -across the entire Corosync/Pacemaker configuration since it doesn't have -the concept of name spaces per type. - -##### `cib` +##### `cib` Corosync applies its configuration immediately. Using a CIB allows you to group multiple primitives and relationships to be applied at @@ -1046,9 +1157,22 @@ This paramater sets the CIB this colocation should be created in. A cs_shadow resource with a title of the same name as this value should also be added to your manifest. -### cs_commit +##### `name` + +namevar + +Identifier of the colocation entry. This value needs to be unique +across the entire Corosync/Pacemaker configuration since it doesn't have +the concept of name spaces per type. + +##### `provider` -Final commit statement which triggers the syncronous application of +The specific backend to use for this `cs_colocation` resource. You will seldom need to specify this --- Puppet will +usually discover the appropriate provider for your platform. + +### `cs_commit` + +Final commit statement which triggers the synchronous application of all primitive changes which reference this CIB. Do not generate more than one cs_commit referencing the same CIB for a given cluster! @@ -1056,20 +1180,29 @@ than one cs_commit referencing the same CIB for a given cluster! The following parameters are available in the `cs_commit` type. -##### `cib` +* [`cib`](#-cs_commit--cib) +* [`name`](#-cs_commit--name) +* [`provider`](#-cs_commit--provider) + +##### `cib` Name of the CIB to commit. This value defaults to the name of the cs_commit resource. -##### `name` +##### `name` namevar Name of the CIB to commit. See the cib parameter for more detail. -### cs_group +##### `provider` + +The specific backend to use for this `cs_commit` resource. You will seldom need to specify this --- Puppet will usually +discover the appropriate provider for your platform. + +### `cs_group` -Type for manipulating Corosync/Pacemkaer group entries. +Type for manipulating Corosync/Pacemaker group entries. Groups are a set or resources (primitives) that need to be grouped together. @@ -1083,11 +1216,11 @@ The following properties are available in the `cs_group` type. ##### `ensure` -Valid values: present, absent +Valid values: `present`, `absent` The basic property that the resource should be in. -Default value: present +Default value: `present` ##### `primitives` @@ -1098,26 +1231,35 @@ order that you wish them to start. The following parameters are available in the `cs_group` type. -##### `name` - -namevar - -Name identifier of this group entry. This value needs to be unique -across the entire Corosync/Pacemaker configuration since it doesn't have -the concept of name spaces per type. +* [`cib`](#-cs_group--cib) +* [`name`](#-cs_group--name) +* [`provider`](#-cs_group--provider) -##### `cib` +##### `cib` Corosync applies its configuration immediately. Using a CIB allows you to group multiple primitives and relationships to be applied at once. This can be necessary to insert complex configurations into Corosync correctly. -This paramater sets the CIB this order should be created in. A +This parameter sets the CIB this order should be created in. A cs_shadow resource with a title of the same name as this value should also be added to your manifest. -### cs_location +##### `name` + +namevar + +Name identifier of this group entry. This value needs to be unique +across the entire Corosync/Pacemaker configuration since it doesn't have +the concept of name spaces per type. + +##### `provider` + +The specific backend to use for this `cs_group` resource. You will seldom need to specify this --- Puppet will usually +discover the appropriate provider for your platform. + +### `cs_location` Type for manipulating corosync/pacemaker resource location. More information on Corosync/Pacemaker colocation can be found here: @@ -1130,36 +1272,26 @@ The following properties are available in the `cs_location` type. ##### `ensure` -Valid values: present, absent +Valid values: `present`, `absent` The basic property that the resource should be in. -Default value: present - -##### `primitive` - -The corosync resource primitive to have a location applied. +Default value: `present` ##### `node_name` The corosync node_name where the resource should be located. +##### `primitive` + +The corosync resource primitive to have a location applied. + ##### `resource_discovery` Whether Pacemaker should perform resource discovery on this node for the specified resource. It matches the resource-discovery location property in pacemaker -##### `score` - -The priority of this location. Primitives can be a part of -multiple location groups and so there is a way to control which -primitives get priority when forcing the move of other primitives. -This value can be an integer but is often defined as the string -INFINITY. - -Default value: INFINITY - ##### `rules` The rules of this location. This is an array of hashes where @@ -1190,19 +1322,25 @@ Example: ], } -#### Parameters +##### `score` -The following parameters are available in the `cs_location` type. +The priority of this location. Primitives can be a part of +multiple location groups and so there is a way to control which +primitives get priority when forcing the move of other primitives. +This value can be an integer but is often defined as the string +INFINITY. -##### `name` +Default value: `INFINITY` -namevar +#### Parameters -Identifier of the location entry. This value needs to be unique -across the entire Corosync/Pacemaker configuration since it doesn't have -the concept of name spaces per type. +The following parameters are available in the `cs_location` type. + +* [`cib`](#-cs_location--cib) +* [`name`](#-cs_location--name) +* [`provider`](#-cs_location--provider) -##### `cib` +##### `cib` Corosync applies its configuration immediately. Using a CIB allows you to group multiple primitives and relationships to be applied at @@ -1213,9 +1351,22 @@ This paramater sets the CIB this colocation should be created in. A cs_shadow resource with a title of the same name as this value should also be added to your manifest. -### cs_order +##### `name` + +namevar + +Identifier of the location entry. This value needs to be unique +across the entire Corosync/Pacemaker configuration since it doesn't have +the concept of name spaces per type. + +##### `provider` -Type for manipulating Corosync/Pacemkaer ordering entries. Order +The specific backend to use for this `cs_location` resource. You will seldom need to specify this --- Puppet will +usually discover the appropriate provider for your platform. + +### `cs_order` + +Type for manipulating Corosync/Pacemaker ordering entries. Order entries are another type of constraint that can be put on sets of primitives but unlike colocation, order does matter. These designate the order at which you need specific primitives to come into a desired @@ -1231,33 +1382,18 @@ The following properties are available in the `cs_order` type. ##### `ensure` -Valid values: present, absent +Valid values: `present`, `absent` The basic property that the resource should be in. -Default value: present +Default value: `present` ##### `first` First Corosync primitive. Just like colocation, our primitives for -ording come in pairs but this time order matters so we need to define +ordering come in pairs but this time order matters so we need to define which primitive starts the desired state change chain. -##### `second` - -Second Corosync primitive. Our second primitive will move to the -desired state after the first primitive. - -##### `score` - -The priority of the this ordered grouping. Primitives can be a part -of multiple order groups and so there is a way to control which -primitives get priority when forcing the order of state changes on -other primitives. This value can be an integer but is often defined -as the string INFINITY. - -Default value: INFINITY - ##### `kind` How to enforce the constraint. @@ -1274,39 +1410,63 @@ the resources. First and then can start in either order, but one must complete starting before the other can be started. A typical use case is when resource start-up puts a high load on the host. -Default value: Mandatory +Default value: `Mandatory` + +##### `score` + +The priority of the this ordered grouping. Primitives can be a part +of multiple order groups and so there is a way to control which +primitives get priority when forcing the order of state changes on +other primitives. This value can be an integer but is often defined +as the string INFINITY. +When using pcs as provider this value is not used. +It is generally preferred to use the `kind` parameter. + +##### `second` + +Second Corosync primitive. Our second primitive will move to the +desired state after the first primitive. ##### `symmetrical` Boolean specifying if the resources should stop in reverse order. Default value: true. -Default value: true +Default value: `true` #### Parameters The following parameters are available in the `cs_order` type. -##### `name` - -namevar - -Name identifier of this ordering entry. This value needs to be unique -across the entire Corosync/Pacemaker configuration since it doesn't have -the concept of name spaces per type. +* [`cib`](#-cs_order--cib) +* [`name`](#-cs_order--name) +* [`provider`](#-cs_order--provider) -##### `cib` +##### `cib` Corosync applies its configuration immediately. Using a CIB allows you to group multiple primitives and relationships to be applied at once. This can be necessary to insert complex configurations into Corosync correctly. -This paramater sets the CIB this order should be created in. A +This parameter sets the CIB this order should be created in. A cs_shadow resource with a title of the same name as this value should also be added to your manifest. -### cs_primitive +##### `name` + +namevar + +Name identifier of this ordering entry. This value needs to be unique +across the entire Corosync/Pacemaker configuration since it doesn't have +the concept of name spaces per type. + +##### `provider` + +The specific backend to use for this `cs_order` resource. You will seldom need to specify this --- Puppet will usually +discover the appropriate provider for your platform. + +### `cs_primitive` Type for manipulating Corosync/Pacemaker primitives. Primitives are probably the most important building block when creating highly @@ -1314,7 +1474,7 @@ available clusters using Corosync and Pacemaker. Each primitive defines an application, ip address, or similar to monitor and maintain. These managed primitives are maintained using what is called a resource agent. These resource agents have a concept of class, type, and subsystem that -provides the functionality. Regretibly these pieces of vocabulary +provides the functionality. Regrettably these pieces of vocabulary clash with those used in Puppet so to overcome the name clashing the property and parameter names have been qualified a bit for clarity. @@ -1329,22 +1489,21 @@ The following properties are available in the `cs_primitive` type. ##### `ensure` -Valid values: present, absent +Valid values: `present`, `absent` The basic property that the resource should be in. -Default value: present +Default value: `present` -##### `parameters` +##### `metadata` -A hash of params for the primitive. Parameters in a primitive are -used by the underlying resource agent, each class using them slightly -differently. In ocf scripts they are exported and pulled into the -script as variables to be used. Since the list of these parameters -are completely arbitrary and validity not enforced we simply defer -defining a model and just accept a hash. +A hash of metadata for the primitive. A primitive can have a set of +metadata that doesn't affect the underlying Corosync type/provider but +affect that concept of a resource. This metadata is similar to Puppet's +resources resource and some meta-parameters, they change resource +behavior but have no affect of the data that is synced or manipulated. -Default value: Hash.new +Default value: `Hash.new` ##### `operations` @@ -1356,42 +1515,56 @@ and just accept a hash. There maybe room to model this one but it would require a review of all resource agents to see if each operation is valid. -Default value: Hash.new +Default value: `Hash.new` + +##### `parameters` + +A hash of params for the primitive. Parameters in a primitive are +used by the underlying resource agent, each class using them slightly +differently. In ocf scripts they are exported and pulled into the +script as variables to be used. Since the list of these parameters +are completely arbitrary and validity not enforced we simply defer +defining a model and just accept a hash. + +Default value: `Hash.new` ##### `utilization` A hash of utilization attributes for the primitive. If nodes are also configured with available resources, and Pacemaker's placement -stratgey is set appropriately, then Pacemaker can place primitives on +strategy is set appropriately, then Pacemaker can place primitives on nodes only where resources are available. See the Pacemaker documentation: http://clusterlabs.org/doc/en-US/Pacemaker/1.1/html/Pacemaker_Explained/ch11.html -Default value: Hash.new +Default value: `Hash.new` -##### `metadata` - -A hash of metadata for the primitive. A primitive can have a set of -metadata that doesn't affect the underlying Corosync type/provider but -affect that concept of a resource. This metadata is similar to Puppet's -resources resource and some meta-parameters, they change resource -behavior but have no affect of the data that is synced or manipulated. - -Default value: Hash.new +#### Parameters -##### `ms_metadata` +The following parameters are available in the `cs_primitive` type. -A hash of metadata for the master/slave primitive state. +* [`cib`](#-cs_primitive--cib) +* [`name`](#-cs_primitive--name) +* [`primitive_class`](#-cs_primitive--primitive_class) +* [`primitive_type`](#-cs_primitive--primitive_type) +* [`provided_by`](#-cs_primitive--provided_by) +* [`provider`](#-cs_primitive--provider) +* [`unmanaged_metadata`](#-cs_primitive--unmanaged_metadata) -Default value: Hash.new +##### `cib` -#### Parameters +Corosync applies its configuration immediately. Using a CIB allows +you to group multiple primitives and relationships to be applied at +once. This can be necessary to insert complex configurations into +Corosync correctly. -The following parameters are available in the `cs_primitive` type. +This parameter sets the CIB this primitive should be created in. A +cs_shadow resource with a title of the same name as this value should +also be added to your manifest. -##### `name` +##### `name` namevar @@ -1399,24 +1572,24 @@ Name identifier of primitive. This value needs to be unique across the entire Corosync/Pacemaker configuration since it doesn't have the concept of name spaces per type. -##### `primitive_class` +##### `primitive_class` Corosync class of the primitive. Examples of classes are lsb or ocf. -Lsb funtions a lot like the init provider in Puppet for services, an init +Lsb functions a lot like the init provider in Puppet for services, an init script is ran periodically on each host to identify status, or to start and stop a particular application. Ocf of the other hand is a script with -meta-data and stucture that is specific to Corosync and Pacemaker. +meta-data and structure that is specific to Corosync and Pacemaker. -##### `primitive_type` +##### `primitive_type` Corosync primitive type. Type generally matches to the specific 'thing' your managing, i.e. ip address or vhost. Though, they can be -completely arbitarily named and manage any number of underlying +completely arbitrarily named and manage any number of underlying applications or resources. -##### `provided_by` +##### `provided_by` -Corosync primitive provider. All resource agents used in a primitve +Corosync primitive provider. All resource agents used in a primitive have something that provides them to the system, be it the Pacemaker or redhat plugins...they're not always obvious though so currently you're left to understand Corosync enough to figure it out. Usually, if it isn't @@ -1427,25 +1600,19 @@ from the command line has Corosync installed: * `crm configure ra providers ` -##### `cib` +##### `provider` -Corosync applies its configuration immediately. Using a CIB allows -you to group multiple primitives and relationships to be applied at -once. This can be necessary to insert complex configurations into -Corosync correctly. - -This paramater sets the CIB this primitive should be created in. A -cs_shadow resource with a title of the same name as this value should -also be added to your manifest. +The specific backend to use for this `cs_primitive` resource. You will seldom need to specify this --- Puppet will +usually discover the appropriate provider for your platform. -##### `unmanaged_metadata` +##### `unmanaged_metadata` Metadata options that should not be managed by Puppet. Examples: ['target-role', 'is-managed'] -Default value: Array.new +Default value: `Array.new` -### cs_property +### `cs_property` Type for manipulating corosync/pacemaker configuration properties. Besides the configuration file that is managed by the module the contains @@ -1470,11 +1637,11 @@ The following properties are available in the `cs_property` type. ##### `ensure` -Valid values: present, absent +Valid values: `present`, `absent` The basic property that the resource should be in. -Default value: present +Default value: `present` ##### `value` @@ -1486,27 +1653,37 @@ cluster properties can range the gambit. The following parameters are available in the `cs_property` type. -##### `name` - -namevar - -Name identifier of this property. Simply the name of the cluster -property. Happily most of these are unique. +* [`cib`](#-cs_property--cib) +* [`name`](#-cs_property--name) +* [`provider`](#-cs_property--provider) +* [`replace`](#-cs_property--replace) -##### `cib` +##### `cib` Corosync applies its configuration immediately. Using a CIB allows you to group multiple primitives and relationships to be applied at once. This can be necessary to insert complex configurations into Corosync correctly. -This paramater sets the CIB this parameter should be created in. A +This parameter sets the CIB this parameter should be created in. A cs_shadow resource with a title of the same name as this value should also be added to your manifest. -##### `replace` +##### `name` + +namevar + +Name identifier of this property. Simply the name of the cluster +property. Happily most of these are unique. + +##### `provider` + +The specific backend to use for this `cs_property` resource. You will seldom need to specify this --- Puppet will +usually discover the appropriate provider for your platform. -Valid values: `true`, `false`, yes, no +##### `replace` + +Valid values: `true`, `false`, `yes`, `no` Whether to replace a property that already exists on the cluster whose value doesn't match what the `value` attribute specifies. Setting @@ -1515,7 +1692,7 @@ overwriting future changes. Defaults to `true`. Default value: `true` -### cs_rsc_defaults +### `cs_rsc_defaults` Type for manipulating corosync/pacemaker global defaults for resource options. The type is pretty simple interface for setting @@ -1533,11 +1710,11 @@ The following properties are available in the `cs_rsc_defaults` type. ##### `ensure` -Valid values: present, absent +Valid values: `present`, `absent` The basic property that the resource should be in. -Default value: present +Default value: `present` ##### `value` @@ -1549,25 +1726,34 @@ resource options can range the gambit. The following parameters are available in the `cs_rsc_defaults` type. -##### `name` - -namevar +* [`cib`](#-cs_rsc_defaults--cib) +* [`name`](#-cs_rsc_defaults--name) +* [`provider`](#-cs_rsc_defaults--provider) -Name identifier of this property. Simply the name of the resource -option. Happily most of these are unique. - -##### `cib` +##### `cib` Corosync applies its configuration immediately. Using a CIB allows you to group multiple primitives and relationships to be applied at once. This can be necessary to insert complex configurations into Corosync correctly. -This paramater sets the CIB this rsc_defaults should be created in. A +This parameter sets the CIB this rsc_defaults should be created in. A cs_shadow resource with a title of the same name as this value should also be added to your manifest. -### cs_shadow +##### `name` + +namevar + +Name identifier of this property. Simply the name of the resource +option. Happily most of these are unique. + +##### `provider` + +The specific backend to use for this `cs_rsc_defaults` resource. You will seldom need to specify this --- Puppet will +usually discover the appropriate provider for your platform. + +### `cs_shadow` cs_shadow resources represent a Corosync shadow CIB. Any corosync resources defined with 'cib' set to the title of a cs_shadow resource @@ -1582,64 +1768,81 @@ The following properties are available in the `cs_shadow` type. Implementation detail. DO NOT SET DIRECTLY. -Default value: latest +Default value: `latest` #### Parameters The following parameters are available in the `cs_shadow` type. -##### `cib` - -namevar - -Name of the CIB to begin tracking changes against. +* [`autocommit`](#-cs_shadow--autocommit) +* [`cib`](#-cs_shadow--cib) +* [`provider`](#-cs_shadow--provider) -##### `autocommit` +##### `autocommit` -Valid values: `true`, `false`, yes, no +Valid values: `true`, `false`, `yes`, `no` Whether to generate a cs_commit or not. Can be used to create shadow CIB without committing them. Default value: `true` +##### `cib` + +namevar + +Name of the CIB to begin tracking changes against. + +##### `provider` + +The specific backend to use for this `cs_shadow` resource. You will seldom need to specify this --- Puppet will usually +discover the appropriate provider for your platform. + ## Data types -### Corosync::ArrayRing +### `Corosync::ArrayRing` The Corosync::ArrayRing data type. -Alias of `Variant[Array[Stdlib::IP::Address], Array[ +Alias of + +```puppet +Variant[Array[Stdlib::IP::Address], Array[ Array[Stdlib::IP::Address] - ]]` + ]] +``` -### Corosync::CryptoCipher +### `Corosync::CryptoCipher` Defines the allowed cipher types for secure corosync communication Alias of `Enum['aes256', 'aes192', 'aes128', '3des']` -### Corosync::CryptoHash +### `Corosync::CryptoHash` The Corosync::CryptoHash data type. Alias of `Enum['md5', 'sha1', 'sha256', 'sha384', 'sha512']` -### Corosync::IpStringIp +### `Corosync::IpStringIp` The Corosync::IpStringIp data type. -Alias of `Variant[Stdlib::IP::Address, Array[ +Alias of + +```puppet +Variant[Stdlib::IP::Address, Array[ Stdlib::IP::Address - ]]` + ]] +``` -### Corosync::QuorumAlgorithm +### `Corosync::QuorumAlgorithm` The Corosync::QuorumAlgorithm data type. Alias of `Enum['ffsplit', 'lms']` -### Corosync::Syslogpriority +### `Corosync::Syslogpriority` The Corosync::Syslogpriority data type. From cba14904c2372a4c551ff66f8421c9beaf80379f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 17 Aug 2023 14:53:11 +0200 Subject: [PATCH 23/39] 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 d7b05f8f..ad70e4c9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -25,3 +25,4 @@ require 'spec_helper_corosync' require 'spec_helper_methods' +Dir['./spec/support/spec/**/*.rb'].sort.each { |f| require f } From 037d315cd069c673ffd554fbda78ea155fe512dd Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 18 Aug 2023 00:06:06 +0200 Subject: [PATCH 24/39] rubocop: autofix --- .rubocop_todo.yml | 50 ++++++++++++------- spec/acceptance/basic_spec.rb | 2 +- spec/acceptance/corosync_class_spec.rb | 2 +- spec/acceptance/cs_clone_spec.rb | 2 +- spec/acceptance/cs_colocation_spec.rb | 2 +- spec/acceptance/cs_commit_spec.rb | 2 +- spec/acceptance/cs_group_spec.rb | 2 +- spec/acceptance/cs_location_spec.rb | 2 +- spec/acceptance/cs_order_spec.rb | 2 +- spec/acceptance/cs_primitive_spec.rb | 2 +- spec/acceptance/cs_rsc_defaults_spec.rb | 2 +- spec/acceptance/cs_shadow_spec.rb | 2 +- .../unit/puppet/provider/cs_clone_crm_spec.rb | 4 +- .../unit/puppet/provider/cs_clone_pcs_spec.rb | 4 +- .../puppet/provider/cs_colocation_crm_spec.rb | 2 +- .../unit/puppet/provider/cs_group_crm_spec.rb | 2 +- .../unit/puppet/provider/cs_group_pcs_spec.rb | 2 +- .../puppet/provider/cs_location_pcs_spec.rb | 2 +- .../unit/puppet/provider/cs_order_crm_spec.rb | 2 +- .../unit/puppet/provider/cs_order_pcs_spec.rb | 2 +- .../puppet/provider/cs_primitive_crm_spec.rb | 7 +-- .../puppet/provider/cs_primitive_pcs_spec.rb | 2 +- .../puppet/provider/cs_property_crm_spec.rb | 2 +- .../puppet/provider/cs_property_pcs_spec.rb | 2 +- .../provider/cs_rsc_defaults_crm_spec.rb | 2 +- .../provider/cs_rsc_defaults_pcs_spec.rb | 2 +- 26 files changed, 59 insertions(+), 50 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 4d51cc4e..eb412042 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,13 +1,14 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2022-11-16 15:26:02 UTC using RuboCop version 1.22.3. +# on 2023-08-17 21:31:19 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: 1 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowForAlignment. Layout/CommentIndentation: Exclude: - 'lib/puppet/provider/cs_location/pcs.rb' @@ -21,13 +22,13 @@ Lint/DuplicateBranch: - 'spec/spec_helper_corosync.rb' # Offense count: 1 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). Lint/RedundantCopDisableDirective: Exclude: - 'lib/puppet/provider/cs_colocation/pcs.rb' # Offense count: 1 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). Lint/RedundantStringCoercion: Exclude: - 'lib/puppet/provider/cs_rsc_defaults/pcs.rb' @@ -40,7 +41,7 @@ Lint/Void: # Offense count: 5 # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. -# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to +# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to Naming/MethodParameterName: Exclude: - 'lib/puppet/provider/cs_colocation/pcs.rb' @@ -50,13 +51,20 @@ Naming/MethodParameterName: - 'lib/puppet_x/voxpupuli/corosync/provider/cib_helper.rb' # Offense count: 1 -# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers. +# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns. # SupportedStyles: snake_case, normalcase, non_integer -# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339 +# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64 Naming/VariableNumber: Exclude: - 'lib/puppet_x/voxpupuli/corosync/provider/pcs.rb' +# Offense count: 4 +# This cop supports unsafe autocorrection (--autocorrect-all). +RSpec/BeEq: + Exclude: + - 'spec/unit/puppet/provider/cs_order_crm_spec.rb' + - 'spec/unit/puppet/provider/cs_order_pcs_spec.rb' + # Offense count: 1 # Configuration parameters: AllowSubject. RSpec/MultipleMemoizedHelpers: @@ -68,31 +76,35 @@ RSpec/RepeatedExampleGroupBody: - 'spec/acceptance/basic_spec.rb' - 'spec/acceptance/corosync_class_spec.rb' -# Offense count: 3 -# Cop supports --auto-correct. -Style/CaseLikeIf: - Exclude: - - 'lib/puppet/provider/cs_colocation/pcs.rb' - # Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: IgnoredMethods. -# IgnoredMethods: ==, equal?, eql? +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowedMethods, AllowedPatterns. +# AllowedMethods: ==, equal?, eql? Style/ClassEqualityComparison: Exclude: - 'lib/puppet/provider/cs_primitive/crm.rb' - 'lib/puppet/provider/cs_primitive/pcs.rb' # Offense count: 1 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). Style/IfUnlessModifier: Exclude: - 'lib/puppet/provider/cs_primitive/crm.rb' # Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods. +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength. # AllowedMethods: present?, blank?, presence, try, try! Style/SafeNavigation: Exclude: - 'lib/puppet/provider/cs_primitive/pcs.rb' + +# Offense count: 5 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/SlicingWithRange: + Exclude: + - 'lib/puppet/type/cs_clone.rb' + - 'lib/puppet/type/cs_colocation.rb' + - 'lib/puppet/type/cs_group.rb' + - 'lib/puppet/type/cs_location.rb' + - 'lib/puppet/type/cs_order.rb' diff --git a/spec/acceptance/basic_spec.rb b/spec/acceptance/basic_spec.rb index b620278c..38a44e08 100644 --- a/spec/acceptance/basic_spec.rb +++ b/spec/acceptance/basic_spec.rb @@ -24,7 +24,7 @@ japvs+0tdy9iwHj3z1ZME2Ntm/5TzG537e7Hb2zogatM9aBTUAWlZ1tpoaXuTH52 J76GtqoIOh+CTeY/BMwBotdQdgeR0zvjE9FuLWkhTmRtVFhbVIzJbFlFuYq5d3LH NWyN0RsTXFaqowV1/HSyvfD7LoF/CrmN5gOAM3Ierv/Ti9uqGVhdGBd/kw==' - File.open('/tmp/ca.pem', 'w') { |f| f.write(cert) } + File.write('/tmp/ca.pem', cert) it 'with defaults' do pp = <<-EOS file { '/tmp/ca.pem': diff --git a/spec/acceptance/corosync_class_spec.rb b/spec/acceptance/corosync_class_spec.rb index 1d0c49a9..daa4bed9 100644 --- a/spec/acceptance/corosync_class_spec.rb +++ b/spec/acceptance/corosync_class_spec.rb @@ -24,7 +24,7 @@ japvs+0tdy9iwHj3z1ZME2Ntm/5TzG537e7Hb2zogatM9aBTUAWlZ1tpoaXuTH52 J76GtqoIOh+CTeY/BMwBotdQdgeR0zvjE9FuLWkhTmRtVFhbVIzJbFlFuYq5d3LH NWyN0RsTXFaqowV1/HSyvfD7LoF/CrmN5gOAM3Ierv/Ti9uqGVhdGBd/kw==' - File.open('/tmp/ca.pem', 'w') { |f| f.write(cert) } + File.write('/tmp/ca.pem', cert) it 'with only cluster_name' do pp = <<-EOS file { '/tmp/ca.pem': diff --git a/spec/acceptance/cs_clone_spec.rb b/spec/acceptance/cs_clone_spec.rb index 9d251b7e..add7f18c 100755 --- a/spec/acceptance/cs_clone_spec.rb +++ b/spec/acceptance/cs_clone_spec.rb @@ -22,7 +22,7 @@ japvs+0tdy9iwHj3z1ZME2Ntm/5TzG537e7Hb2zogatM9aBTUAWlZ1tpoaXuTH52 J76GtqoIOh+CTeY/BMwBotdQdgeR0zvjE9FuLWkhTmRtVFhbVIzJbFlFuYq5d3LH NWyN0RsTXFaqowV1/HSyvfD7LoF/CrmN5gOAM3Ierv/Ti9uqGVhdGBd/kw==' - File.open('/tmp/ca.pem', 'w') { |f| f.write(cert) } + File.write('/tmp/ca.pem', cert) after :all do cleanup_cs_resources end diff --git a/spec/acceptance/cs_colocation_spec.rb b/spec/acceptance/cs_colocation_spec.rb index 9b5948fc..75127839 100644 --- a/spec/acceptance/cs_colocation_spec.rb +++ b/spec/acceptance/cs_colocation_spec.rb @@ -22,7 +22,7 @@ japvs+0tdy9iwHj3z1ZME2Ntm/5TzG537e7Hb2zogatM9aBTUAWlZ1tpoaXuTH52 J76GtqoIOh+CTeY/BMwBotdQdgeR0zvjE9FuLWkhTmRtVFhbVIzJbFlFuYq5d3LH NWyN0RsTXFaqowV1/HSyvfD7LoF/CrmN5gOAM3Ierv/Ti9uqGVhdGBd/kw==' - File.open('/tmp/ca.pem', 'w') { |f| f.write(cert) } + File.write('/tmp/ca.pem', cert) after :all do cleanup_cs_resources end diff --git a/spec/acceptance/cs_commit_spec.rb b/spec/acceptance/cs_commit_spec.rb index ec3fdeb4..dff1f2b9 100644 --- a/spec/acceptance/cs_commit_spec.rb +++ b/spec/acceptance/cs_commit_spec.rb @@ -24,7 +24,7 @@ japvs+0tdy9iwHj3z1ZME2Ntm/5TzG537e7Hb2zogatM9aBTUAWlZ1tpoaXuTH52 J76GtqoIOh+CTeY/BMwBotdQdgeR0zvjE9FuLWkhTmRtVFhbVIzJbFlFuYq5d3LH NWyN0RsTXFaqowV1/HSyvfD7LoF/CrmN5gOAM3Ierv/Ti9uqGVhdGBd/kw==' - File.open('/tmp/ca.pem', 'w') { |f| f.write(cert) } + File.write('/tmp/ca.pem', cert) after :all do cleanup_cs_resources end diff --git a/spec/acceptance/cs_group_spec.rb b/spec/acceptance/cs_group_spec.rb index b933ccc2..ec356d30 100755 --- a/spec/acceptance/cs_group_spec.rb +++ b/spec/acceptance/cs_group_spec.rb @@ -22,7 +22,7 @@ japvs+0tdy9iwHj3z1ZME2Ntm/5TzG537e7Hb2zogatM9aBTUAWlZ1tpoaXuTH52 J76GtqoIOh+CTeY/BMwBotdQdgeR0zvjE9FuLWkhTmRtVFhbVIzJbFlFuYq5d3LH NWyN0RsTXFaqowV1/HSyvfD7LoF/CrmN5gOAM3Ierv/Ti9uqGVhdGBd/kw==' - File.open('/tmp/ca.pem', 'w') { |f| f.write(cert) } + File.write('/tmp/ca.pem', cert) after :all do cleanup_cs_resources end diff --git a/spec/acceptance/cs_location_spec.rb b/spec/acceptance/cs_location_spec.rb index f4a91846..34d4bbb7 100755 --- a/spec/acceptance/cs_location_spec.rb +++ b/spec/acceptance/cs_location_spec.rb @@ -22,7 +22,7 @@ japvs+0tdy9iwHj3z1ZME2Ntm/5TzG537e7Hb2zogatM9aBTUAWlZ1tpoaXuTH52 J76GtqoIOh+CTeY/BMwBotdQdgeR0zvjE9FuLWkhTmRtVFhbVIzJbFlFuYq5d3LH NWyN0RsTXFaqowV1/HSyvfD7LoF/CrmN5gOAM3Ierv/Ti9uqGVhdGBd/kw==' - File.open('/tmp/ca.pem', 'w') { |f| f.write(cert) } + File.write('/tmp/ca.pem', cert) after :all do cleanup_cs_resources end diff --git a/spec/acceptance/cs_order_spec.rb b/spec/acceptance/cs_order_spec.rb index c4c58b3f..a97e1802 100644 --- a/spec/acceptance/cs_order_spec.rb +++ b/spec/acceptance/cs_order_spec.rb @@ -22,7 +22,7 @@ japvs+0tdy9iwHj3z1ZME2Ntm/5TzG537e7Hb2zogatM9aBTUAWlZ1tpoaXuTH52 J76GtqoIOh+CTeY/BMwBotdQdgeR0zvjE9FuLWkhTmRtVFhbVIzJbFlFuYq5d3LH NWyN0RsTXFaqowV1/HSyvfD7LoF/CrmN5gOAM3Ierv/Ti9uqGVhdGBd/kw==' - File.open('/tmp/ca.pem', 'w') { |f| f.write(cert) } + File.write('/tmp/ca.pem', cert) after :all do cleanup_cs_resources end diff --git a/spec/acceptance/cs_primitive_spec.rb b/spec/acceptance/cs_primitive_spec.rb index c063d631..7ffdb6f1 100644 --- a/spec/acceptance/cs_primitive_spec.rb +++ b/spec/acceptance/cs_primitive_spec.rb @@ -22,7 +22,7 @@ japvs+0tdy9iwHj3z1ZME2Ntm/5TzG537e7Hb2zogatM9aBTUAWlZ1tpoaXuTH52 J76GtqoIOh+CTeY/BMwBotdQdgeR0zvjE9FuLWkhTmRtVFhbVIzJbFlFuYq5d3LH NWyN0RsTXFaqowV1/HSyvfD7LoF/CrmN5gOAM3Ierv/Ti9uqGVhdGBd/kw==' - File.open('/tmp/ca.pem', 'w') { |f| f.write(cert) } + File.write('/tmp/ca.pem', cert) after :all do cleanup_cs_resources end diff --git a/spec/acceptance/cs_rsc_defaults_spec.rb b/spec/acceptance/cs_rsc_defaults_spec.rb index 625ca039..581efe06 100644 --- a/spec/acceptance/cs_rsc_defaults_spec.rb +++ b/spec/acceptance/cs_rsc_defaults_spec.rb @@ -23,7 +23,7 @@ japvs+0tdy9iwHj3z1ZME2Ntm/5TzG537e7Hb2zogatM9aBTUAWlZ1tpoaXuTH52 J76GtqoIOh+CTeY/BMwBotdQdgeR0zvjE9FuLWkhTmRtVFhbVIzJbFlFuYq5d3LH NWyN0RsTXFaqowV1/HSyvfD7LoF/CrmN5gOAM3Ierv/Ti9uqGVhdGBd/kw==' - File.open('/tmp/ca.pem', 'w') { |f| f.write(cert) } + File.write('/tmp/ca.pem', cert) it 'creates a rsc_defaults' do pp = <<-EOS file { '/tmp/ca.pem': diff --git a/spec/acceptance/cs_shadow_spec.rb b/spec/acceptance/cs_shadow_spec.rb index 090d45d7..05cbc1a7 100644 --- a/spec/acceptance/cs_shadow_spec.rb +++ b/spec/acceptance/cs_shadow_spec.rb @@ -24,7 +24,7 @@ japvs+0tdy9iwHj3z1ZME2Ntm/5TzG537e7Hb2zogatM9aBTUAWlZ1tpoaXuTH52 J76GtqoIOh+CTeY/BMwBotdQdgeR0zvjE9FuLWkhTmRtVFhbVIzJbFlFuYq5d3LH NWyN0RsTXFaqowV1/HSyvfD7LoF/CrmN5gOAM3Ierv/Ti9uqGVhdGBd/kw==' - File.open('/tmp/ca.pem', 'w') { |f| f.write(cert) } + File.write('/tmp/ca.pem', cert) after :all do cleanup_cs_resources end diff --git a/spec/unit/puppet/provider/cs_clone_crm_spec.rb b/spec/unit/puppet/provider/cs_clone_crm_spec.rb index dc83fb7a..4b3b03d4 100644 --- a/spec/unit/puppet/provider/cs_clone_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_clone_crm_spec.rb @@ -42,7 +42,7 @@ end it "is a kind of #{described_class.name}" do - expect(instance).to be_a_kind_of(described_class) + expect(instance).to be_a(described_class) end it "is named by the 's id attribute" do @@ -104,7 +104,7 @@ end it "is a kind of #{described_class.name}" do - expect(instance).to be_a_kind_of(described_class) + expect(instance).to be_a(described_class) end it "is named by the 's id attribute" do diff --git a/spec/unit/puppet/provider/cs_clone_pcs_spec.rb b/spec/unit/puppet/provider/cs_clone_pcs_spec.rb index d471adc5..ca96419b 100644 --- a/spec/unit/puppet/provider/cs_clone_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_clone_pcs_spec.rb @@ -42,7 +42,7 @@ end it "is a kind of #{described_class.name}" do - expect(instance).to be_a_kind_of(described_class) + expect(instance).to be_a(described_class) end it "is named by the 's id attribute" do @@ -101,7 +101,7 @@ end it "is a kind of #{described_class.name}" do - expect(instance).to be_a_kind_of(described_class) + expect(instance).to be_a(described_class) end it "is named by the 's id attribute" do diff --git a/spec/unit/puppet/provider/cs_colocation_crm_spec.rb b/spec/unit/puppet/provider/cs_colocation_crm_spec.rb index b3e618e2..102edf02 100644 --- a/spec/unit/puppet/provider/cs_colocation_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_colocation_crm_spec.rb @@ -41,7 +41,7 @@ end it "is a kind of #{described_class.name}" do - expect(instance).to be_a_kind_of(described_class) + expect(instance).to be_a(described_class) end it "is named by the 's id attribute" do diff --git a/spec/unit/puppet/provider/cs_group_crm_spec.rb b/spec/unit/puppet/provider/cs_group_crm_spec.rb index 6817f404..4f310dbf 100644 --- a/spec/unit/puppet/provider/cs_group_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_group_crm_spec.rb @@ -68,7 +68,7 @@ end it "is a kind of #{described_class.name}" do - expect(instance).to be_a_kind_of(described_class) + expect(instance).to be_a(described_class) end it 'is named by the group id attribute' do diff --git a/spec/unit/puppet/provider/cs_group_pcs_spec.rb b/spec/unit/puppet/provider/cs_group_pcs_spec.rb index df12e322..e752aaa2 100644 --- a/spec/unit/puppet/provider/cs_group_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_group_pcs_spec.rb @@ -63,7 +63,7 @@ end it "is a kind of #{described_class.name}" do - expect(instance).to be_a_kind_of(described_class) + expect(instance).to be_a(described_class) end it 'is named by the group id attribute' do diff --git a/spec/unit/puppet/provider/cs_location_pcs_spec.rb b/spec/unit/puppet/provider/cs_location_pcs_spec.rb index 5941ffc8..3e2c6ef7 100644 --- a/spec/unit/puppet/provider/cs_location_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_location_pcs_spec.rb @@ -38,7 +38,7 @@ end it "is a kind of #{described_class.name}" do - expect(instance).to be_a_kind_of(described_class) + expect(instance).to be_a(described_class) end end diff --git a/spec/unit/puppet/provider/cs_order_crm_spec.rb b/spec/unit/puppet/provider/cs_order_crm_spec.rb index 91109243..4dbeea99 100644 --- a/spec/unit/puppet/provider/cs_order_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_order_crm_spec.rb @@ -39,7 +39,7 @@ end it "is a kind of #{described_class.name}" do - expect(instance).to be_a_kind_of(described_class) + expect(instance).to be_a(described_class) end it "is named by the 's id attribute" do diff --git a/spec/unit/puppet/provider/cs_order_pcs_spec.rb b/spec/unit/puppet/provider/cs_order_pcs_spec.rb index a9f4812f..aa6a0b88 100644 --- a/spec/unit/puppet/provider/cs_order_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_order_pcs_spec.rb @@ -32,7 +32,7 @@ end it "is a kind of #{described_class.name}" do - expect(instance).to be_a_kind_of(described_class) + expect(instance).to be_a(described_class) end it "is named by the 's id attribute" do diff --git a/spec/unit/puppet/provider/cs_primitive_crm_spec.rb b/spec/unit/puppet/provider/cs_primitive_crm_spec.rb index 77c552dd..2f3e08bc 100644 --- a/spec/unit/puppet/provider/cs_primitive_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_primitive_crm_spec.rb @@ -56,7 +56,7 @@ end it "is a kind of #{described_class.name}" do - expect(instance).to be_a_kind_of(described_class) + expect(instance).to be_a(described_class) end it "is named by the 's id attribute" do @@ -84,10 +84,7 @@ end it 'has an operations property corresponding to ' do - expect(instance.operations).to match_array([{ 'monitor' => { 'interval' => '15', 'timeout' => '10', 'on-fail' => 'standby', 'OCF_CHECK_LEVEL' => '10' } }, - { 'monitor' => { 'interval' => '5', 'timeout' => '10', 'on-fail' => 'standby', 'role' => 'Master' } }, - { 'start' => { 'interval' => '0', 'timeout' => '60' } }, - { 'stop' => { 'interval' => '0', 'timeout' => '40' } }]) + expect(instance.operations).to contain_exactly({ 'monitor' => { 'interval' => '15', 'timeout' => '10', 'on-fail' => 'standby', 'OCF_CHECK_LEVEL' => '10' } }, { 'monitor' => { 'interval' => '5', 'timeout' => '10', 'on-fail' => 'standby', 'role' => 'Master' } }, { 'start' => { 'interval' => '0', 'timeout' => '60' } }, { 'stop' => { 'interval' => '0', 'timeout' => '40' } }) end it 'has a utilization property corresponding to ' do diff --git a/spec/unit/puppet/provider/cs_primitive_pcs_spec.rb b/spec/unit/puppet/provider/cs_primitive_pcs_spec.rb index d3cd6da9..09e76eb6 100644 --- a/spec/unit/puppet/provider/cs_primitive_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_primitive_pcs_spec.rb @@ -46,7 +46,7 @@ end it "is a kind of #{described_class.name}" do - expect(instance).to be_a_kind_of(described_class) + expect(instance).to be_a(described_class) end it "is named by the 's id attribute" do diff --git a/spec/unit/puppet/provider/cs_property_crm_spec.rb b/spec/unit/puppet/provider/cs_property_crm_spec.rb index 3e8b2038..8b8324e8 100644 --- a/spec/unit/puppet/provider/cs_property_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_property_crm_spec.rb @@ -42,7 +42,7 @@ end it "is a kind of #{described_class.name}" do - expect(instance).to be_a_kind_of(described_class) + expect(instance).to be_a(described_class) end it "is named by the 's name attribute" do diff --git a/spec/unit/puppet/provider/cs_property_pcs_spec.rb b/spec/unit/puppet/provider/cs_property_pcs_spec.rb index 2a7e2901..524e073d 100644 --- a/spec/unit/puppet/provider/cs_property_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_property_pcs_spec.rb @@ -37,7 +37,7 @@ end it "is a kind of #{described_class.name}" do - expect(instance).to be_a_kind_of(described_class) + expect(instance).to be_a(described_class) end it "is named by the 's name attribute" do diff --git a/spec/unit/puppet/provider/cs_rsc_defaults_crm_spec.rb b/spec/unit/puppet/provider/cs_rsc_defaults_crm_spec.rb index 71f7b12d..0c70287f 100644 --- a/spec/unit/puppet/provider/cs_rsc_defaults_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_rsc_defaults_crm_spec.rb @@ -39,7 +39,7 @@ end it "is a kind of #{described_class.name}" do - expect(instance).to be_a_kind_of(described_class) + expect(instance).to be_a(described_class) end it "is named by the 's name attribute" do diff --git a/spec/unit/puppet/provider/cs_rsc_defaults_pcs_spec.rb b/spec/unit/puppet/provider/cs_rsc_defaults_pcs_spec.rb index 58433df4..ff27334b 100644 --- a/spec/unit/puppet/provider/cs_rsc_defaults_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_rsc_defaults_pcs_spec.rb @@ -34,7 +34,7 @@ end it "is a kind of #{described_class.name}" do - expect(instance).to be_a_kind_of(described_class) + expect(instance).to be_a(described_class) end it "is named by the 's name attribute" do From 931a55afd6847390ad2600036f053a2c325e57df Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 15 Dec 2023 12:48:05 +0100 Subject: [PATCH 25/39] modulesync 7.2.0 --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- .msync.yml | 2 +- .pmtignore | 1 + Gemfile | 8 +++----- 5 files changed, 7 insertions(+), 8 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/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 24d4b7b87c891dd5f6549f5648da394b361dd201 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 6 Feb 2024 12:29:01 +0100 Subject: [PATCH 26/39] 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 22ecc4931dfd492478e95365fbf14bc9ed2b4110 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 20 Feb 2024 13:16:30 +0100 Subject: [PATCH 27/39] explicitly set pcs_version of Debian systems except 9 to pcs; set pcs_version to 0.10.0 for Debian >=10 --- data/os/Debian.yaml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 data/os/Debian.yaml diff --git a/data/os/Debian.yaml b/data/os/Debian.yaml new file mode 100644 index 00000000..092666ef --- /dev/null +++ b/data/os/Debian.yaml @@ -0,0 +1,3 @@ +--- +corosync::provider: 'pcs' +corosync::pcs_version: '0.10.0' From 713e869d970f79c4e9f60dccf351a0d0eeae75aa Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 20 Feb 2024 13:36:56 +0100 Subject: [PATCH 28/39] remove no longer supported Debian 9 hieradata --- data/os/Debian/9.yaml | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 data/os/Debian/9.yaml diff --git a/data/os/Debian/9.yaml b/data/os/Debian/9.yaml deleted file mode 100644 index 2cdfebbf..00000000 --- a/data/os/Debian/9.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -corosync::provider: 'crm' -corosync::pcs_version: ~ From a063e448ef78f66d3f1fe3f482912a31117bf2d8 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 20 Feb 2024 13:41:04 +0100 Subject: [PATCH 29/39] remove specialcasing for old, no longer supported ubuntu versions (<=16) --- spec/spec_helper_acceptance.rb | 12 ++---------- spec/spec_helper_corosync.rb | 12 ++---------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index cf08b0ea..e91cc1a5 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -17,16 +17,8 @@ default_provider = 'pcs' pcs_version = '0.10.0' when 'Ubuntu' - if fact_on(host, 'os.release.major').to_i > 18 - default_provider = 'pcs' - pcs_version = '0.10.0' - elsif fact_on(host, 'os.release.major').to_i > 16 - default_provider = 'pcs' - pcs_version = '0.9.0' - else - default_provider = 'crm' - pcs_version = '' - end + default_provider = 'pcs' + pcs_version = '0.10.0' end when 'Suse' default_provider = 'crm' diff --git a/spec/spec_helper_corosync.rb b/spec/spec_helper_corosync.rb index 06ea4f78..0109c9e0 100644 --- a/spec/spec_helper_corosync.rb +++ b/spec/spec_helper_corosync.rb @@ -17,16 +17,8 @@ def corosync_stack(facts) corosync_stack = 'pcs' pcs_version = '0.10.0' when 'Ubuntu' - if facts[:os]['release']['major'].to_i > 18 - corosync_stack = 'pcs' - pcs_version = '0.10.0' - elsif facts[:os]['release']['major'].to_i > 16 - corosync_stack = 'pcs' - pcs_version = '0.9.0' - else - corosync_stack = 'crm' - pcs_version = '' - end + corosync_stack = 'pcs' + pcs_version = '0.10.0' end when 'Suse' corosync_stack = 'crm' From 386c18ba30f614c5413ec8fad5fef299d658398c Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 20 Feb 2024 13:51:16 +0100 Subject: [PATCH 30/39] readd special casing for ubuntu 18 provider and pcs version --- spec/spec_helper_acceptance.rb | 6 +++++- spec/spec_helper_corosync.rb | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index e91cc1a5..9e69d362 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -18,7 +18,11 @@ pcs_version = '0.10.0' when 'Ubuntu' default_provider = 'pcs' - pcs_version = '0.10.0' + if facts[:os]['release']['major'].to_i = 18 + pcs_version = '0.9.0' + else + pcs_version = '0.10.0' + end end when 'Suse' default_provider = 'crm' diff --git a/spec/spec_helper_corosync.rb b/spec/spec_helper_corosync.rb index 0109c9e0..84a82e4f 100644 --- a/spec/spec_helper_corosync.rb +++ b/spec/spec_helper_corosync.rb @@ -18,7 +18,11 @@ def corosync_stack(facts) pcs_version = '0.10.0' when 'Ubuntu' corosync_stack = 'pcs' - pcs_version = '0.10.0' + if facts[:os]['release']['major'].to_i = 18 + pcs_version = '0.9.0' + else + pcs_version = '0.10.0' + end end when 'Suse' corosync_stack = 'crm' From cdc5f103a721166421f8deea3c7e9d0bcb3aa291 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 20 Feb 2024 13:55:36 +0100 Subject: [PATCH 31/39] fix rubocop and comparison syntax --- spec/spec_helper_acceptance.rb | 10 +++++----- spec/spec_helper_corosync.rb | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 9e69d362..74972a4f 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -18,11 +18,11 @@ pcs_version = '0.10.0' when 'Ubuntu' default_provider = 'pcs' - if facts[:os]['release']['major'].to_i = 18 - pcs_version = '0.9.0' - else - pcs_version = '0.10.0' - end + pcs_version = if facts[:os]['release']['major'].to_i == 18 + '0.9.0' + else + '0.10.0' + end end when 'Suse' default_provider = 'crm' diff --git a/spec/spec_helper_corosync.rb b/spec/spec_helper_corosync.rb index 84a82e4f..4aaa77e2 100644 --- a/spec/spec_helper_corosync.rb +++ b/spec/spec_helper_corosync.rb @@ -18,11 +18,11 @@ def corosync_stack(facts) pcs_version = '0.10.0' when 'Ubuntu' corosync_stack = 'pcs' - if facts[:os]['release']['major'].to_i = 18 - pcs_version = '0.9.0' - else - pcs_version = '0.10.0' - end + pcs_version = if facts[:os]['release']['major'].to_i == 18 + '0.9.0' + else + '0.10.0' + end end when 'Suse' corosync_stack = 'crm' From 189dd44ec7fb7f63a18af2c3193f0ad49aedfea2 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 20 Feb 2024 14:00:33 +0100 Subject: [PATCH 32/39] revert to previous greater than syntax --- spec/spec_helper_acceptance.rb | 6 +++--- spec/spec_helper_corosync.rb | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 74972a4f..375767a0 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -18,10 +18,10 @@ pcs_version = '0.10.0' when 'Ubuntu' default_provider = 'pcs' - pcs_version = if facts[:os]['release']['major'].to_i == 18 - '0.9.0' - else + pcs_version = if facts[:os]['release']['major'].to_i > 18 '0.10.0' + else + '0.9.0' end end when 'Suse' diff --git a/spec/spec_helper_corosync.rb b/spec/spec_helper_corosync.rb index 4aaa77e2..a726ae86 100644 --- a/spec/spec_helper_corosync.rb +++ b/spec/spec_helper_corosync.rb @@ -18,10 +18,10 @@ def corosync_stack(facts) pcs_version = '0.10.0' when 'Ubuntu' corosync_stack = 'pcs' - pcs_version = if facts[:os]['release']['major'].to_i == 18 - '0.9.0' - else + pcs_version = if facts[:os]['release']['major'].to_i > 18 '0.10.0' + else + '0.9.0' end end when 'Suse' From fddeafbcf83ab560c5631d3747d2fe0af45ac75b Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 20 Feb 2024 14:05:13 +0100 Subject: [PATCH 33/39] use fact_on method --- spec/spec_helper_acceptance.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 375767a0..35ff9d8a 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -18,7 +18,7 @@ pcs_version = '0.10.0' when 'Ubuntu' default_provider = 'pcs' - pcs_version = if facts[:os]['release']['major'].to_i > 18 + pcs_version = if fact_on(host,'os.release.major').to_i > 18 '0.10.0' else '0.9.0' From c249892008a64d2d6bbd1d90a3002e4eed67fa50 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 20 Feb 2024 14:06:57 +0100 Subject: [PATCH 34/39] rubocop autocorrect --- spec/spec_helper_acceptance.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 35ff9d8a..0ee5e434 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -18,7 +18,7 @@ pcs_version = '0.10.0' when 'Ubuntu' default_provider = 'pcs' - pcs_version = if fact_on(host,'os.release.major').to_i > 18 + pcs_version = if fact_on(host, 'os.release.major').to_i > 18 '0.10.0' else '0.9.0' From 720248e9f50c3d67d01eda4b8d35e5527810fc61 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 20 Feb 2024 14:59:57 +0100 Subject: [PATCH 35/39] fix most of the safely autocorrectable cops --- .rubocop_todo.yml | 21 +-------------------- lib/puppet/provider/cs_colocation/pcs.rb | 2 -- lib/puppet/provider/cs_location/pcs.rb | 8 ++++---- lib/puppet/provider/cs_rsc_defaults/pcs.rb | 2 +- 4 files changed, 6 insertions(+), 27 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index eb412042..ee2cd724 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,18 +1,11 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-08-17 21:31:19 UTC using RuboCop version 1.50.2. +# on 2024-02-20 13:57:00 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: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowForAlignment. -Layout/CommentIndentation: - Exclude: - - 'lib/puppet/provider/cs_location/pcs.rb' - # Offense count: 4 # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches. Lint/DuplicateBranch: @@ -21,18 +14,6 @@ Lint/DuplicateBranch: - 'spec/spec_helper_acceptance.rb' - 'spec/spec_helper_corosync.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Lint/RedundantCopDisableDirective: - Exclude: - - 'lib/puppet/provider/cs_colocation/pcs.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Lint/RedundantStringCoercion: - Exclude: - - 'lib/puppet/provider/cs_rsc_defaults/pcs.rb' - # Offense count: 1 # Configuration parameters: CheckForMethodsWithNoSideEffects. Lint/Void: diff --git a/lib/puppet/provider/cs_colocation/pcs.rb b/lib/puppet/provider/cs_colocation/pcs.rb index 21ada493..725c4012 100644 --- a/lib/puppet/provider/cs_colocation/pcs.rb +++ b/lib/puppet/provider/cs_colocation/pcs.rb @@ -42,9 +42,7 @@ def self.instances resource_set_options.each do |o| options[o] = rs.attributes[o] if rs.attributes[o] end - # rubocop:disable Style/ZeroLengthPredicate resource_set['options'] = options if options.keys.size.positive? - # rubocop:enable Style/ZeroLengthPredicate resource_set['primitives'] = [] rs.each_element('resource_ref') do |rr| resource_set['primitives'] << rr.attributes['id'] diff --git a/lib/puppet/provider/cs_location/pcs.rb b/lib/puppet/provider/cs_location/pcs.rb index 33f779d1..00650558 100644 --- a/lib/puppet/provider/cs_location/pcs.rb +++ b/lib/puppet/provider/cs_location/pcs.rb @@ -34,10 +34,10 @@ def self.instances constraints = doc.root.elements['configuration'].elements['constraints'] constraints&.each_element('rsc_location') do |e| - # The node2hash method maps resource locations from XML into hashes. - # The expression key is handled differently because the result must - # not contain the id of the XML node. The crm command can not set the - # expression id so Puppet would try to update the rule at every run. + # The node2hash method maps resource locations from XML into hashes. + # The expression key is handled differently because the result must + # not contain the id of the XML node. The crm command can not set the + # expression id so Puppet would try to update the rule at every run. id, items = node2hash(e, ['expression']).first location_instance = { diff --git a/lib/puppet/provider/cs_rsc_defaults/pcs.rb b/lib/puppet/provider/cs_rsc_defaults/pcs.rb index b04afdcb..a730c3b4 100644 --- a/lib/puppet/provider/cs_rsc_defaults/pcs.rb +++ b/lib/puppet/provider/cs_rsc_defaults/pcs.rb @@ -57,7 +57,7 @@ def create # Unlike create we actually immediately delete the item. def destroy debug('Removing resource default') - cmd = [command(:pcs), 'resource', 'defaults', "#{(@property_hash[:name]).to_s}="] + cmd = [command(:pcs), 'resource', 'defaults', "#{@property_hash[:name]}="] self.class.run_command_in_cib(cmd, @resource[:cib]) @property_hash.clear end From 0b0fb480f4b8ddcf0fb3fd42bb85646ede0494de Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 20 Feb 2024 15:07:34 +0100 Subject: [PATCH 36/39] fix ifunlessmodifier cop --- .rubocop_todo.yml | 6 ------ lib/puppet/provider/cs_primitive/crm.rb | 4 +--- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index ee2cd724..ca7372a1 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -66,12 +66,6 @@ Style/ClassEqualityComparison: - 'lib/puppet/provider/cs_primitive/crm.rb' - 'lib/puppet/provider/cs_primitive/pcs.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Style/IfUnlessModifier: - Exclude: - - 'lib/puppet/provider/cs_primitive/crm.rb' - # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength. diff --git a/lib/puppet/provider/cs_primitive/crm.rb b/lib/puppet/provider/cs_primitive/crm.rb index 308adb0f..d8c966a7 100644 --- a/lib/puppet/provider/cs_primitive/crm.rb +++ b/lib/puppet/provider/cs_primitive/crm.rb @@ -161,9 +161,7 @@ def flush end if @resource && @resource.class.name == :cs_primitive && @resource[:unmanaged_metadata] @resource[:unmanaged_metadata].each do |parameter_name| - if @property_hash[:existing_metadata] && @property_hash[:existing_metadata][parameter_name] - @property_hash[:metadata][parameter_name] = @property_hash[:existing_metadata]['target-role'] - end + @property_hash[:metadata][parameter_name] = @property_hash[:existing_metadata]['target-role'] if @property_hash[:existing_metadata] && @property_hash[:existing_metadata][parameter_name] end end unless @property_hash[:parameters].empty? From 8aea42c75238a1ce9baab069733cc0d11a4c39e5 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 20 Feb 2024 15:25:01 +0100 Subject: [PATCH 37/39] fix beEq cop --- .rubocop_todo.yml | 7 ------- spec/unit/puppet/provider/cs_order_crm_spec.rb | 4 ++-- spec/unit/puppet/provider/cs_order_pcs_spec.rb | 4 ++-- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index ca7372a1..4815cc22 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -39,13 +39,6 @@ Naming/VariableNumber: Exclude: - 'lib/puppet_x/voxpupuli/corosync/provider/pcs.rb' -# Offense count: 4 -# This cop supports unsafe autocorrection (--autocorrect-all). -RSpec/BeEq: - Exclude: - - 'spec/unit/puppet/provider/cs_order_crm_spec.rb' - - 'spec/unit/puppet/provider/cs_order_pcs_spec.rb' - # Offense count: 1 # Configuration parameters: AllowSubject. RSpec/MultipleMemoizedHelpers: diff --git a/spec/unit/puppet/provider/cs_order_crm_spec.rb b/spec/unit/puppet/provider/cs_order_crm_spec.rb index 4dbeea99..71bc541b 100644 --- a/spec/unit/puppet/provider/cs_order_crm_spec.rb +++ b/spec/unit/puppet/provider/cs_order_crm_spec.rb @@ -65,7 +65,7 @@ end it 'has symmetrical set to true' do - expect(instance.symmetrical).to eq(true) + expect(instance.symmetrical).to be(true) end end @@ -87,7 +87,7 @@ end it 'has symmetrical set to false' do - expect(instance.symmetrical).to eq(false) + expect(instance.symmetrical).to be(false) end end end diff --git a/spec/unit/puppet/provider/cs_order_pcs_spec.rb b/spec/unit/puppet/provider/cs_order_pcs_spec.rb index aa6a0b88..347c6793 100644 --- a/spec/unit/puppet/provider/cs_order_pcs_spec.rb +++ b/spec/unit/puppet/provider/cs_order_pcs_spec.rb @@ -58,7 +58,7 @@ end it 'has symmetrical set to true' do - expect(instance.symmetrical).to eq(true) + expect(instance.symmetrical).to be(true) end end @@ -80,7 +80,7 @@ end it 'has symmetrical set to false' do - expect(instance.symmetrical).to eq(false) + expect(instance.symmetrical).to be(false) end end end From 083e28002526885f57e74f4e940503e078294fdf Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 20 Feb 2024 15:28:54 +0100 Subject: [PATCH 38/39] fix safenavigation cop --- .rubocop_todo.yml | 8 -------- lib/puppet/provider/cs_primitive/pcs.rb | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 4815cc22..94105234 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -59,14 +59,6 @@ Style/ClassEqualityComparison: - 'lib/puppet/provider/cs_primitive/crm.rb' - 'lib/puppet/provider/cs_primitive/pcs.rb' -# Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength. -# AllowedMethods: present?, blank?, presence, try, try! -Style/SafeNavigation: - Exclude: - - 'lib/puppet/provider/cs_primitive/pcs.rb' - # Offense count: 5 # This cop supports unsafe autocorrection (--autocorrect-all). Style/SlicingWithRange: diff --git a/lib/puppet/provider/cs_primitive/pcs.rb b/lib/puppet/provider/cs_primitive/pcs.rb index 62b96df3..7e27a1d5 100644 --- a/lib/puppet/provider/cs_primitive/pcs.rb +++ b/lib/puppet/provider/cs_primitive/pcs.rb @@ -269,7 +269,7 @@ def flush if @resource && @resource.class.name == :cs_primitive && @resource[:unmanaged_metadata] @resource[:unmanaged_metadata].each do |parameter_name| @property_hash[:metadata].delete(parameter_name) - @property_hash[:existing_metadata].delete(parameter_name) if @property_hash[:existing_metadata] + @property_hash[:existing_metadata]&.delete(parameter_name) end end From d7fa73df08bf56b00f495fb7338012c1266867cd Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 20 Feb 2024 15:34:48 +0100 Subject: [PATCH 39/39] fix slicingwithrange cop --- .rubocop_todo.yml | 10 ---------- lib/puppet/type/cs_clone.rb | 2 +- lib/puppet/type/cs_colocation.rb | 2 +- lib/puppet/type/cs_group.rb | 2 +- lib/puppet/type/cs_location.rb | 2 +- lib/puppet/type/cs_order.rb | 2 +- 6 files changed, 5 insertions(+), 15 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 94105234..9a195e25 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -58,13 +58,3 @@ Style/ClassEqualityComparison: Exclude: - 'lib/puppet/provider/cs_primitive/crm.rb' - 'lib/puppet/provider/cs_primitive/pcs.rb' - -# Offense count: 5 -# This cop supports unsafe autocorrection (--autocorrect-all). -Style/SlicingWithRange: - Exclude: - - 'lib/puppet/type/cs_clone.rb' - - 'lib/puppet/type/cs_colocation.rb' - - 'lib/puppet/type/cs_group.rb' - - 'lib/puppet/type/cs_location.rb' - - 'lib/puppet/type/cs_order.rb' diff --git a/lib/puppet/type/cs_clone.rb b/lib/puppet/type/cs_clone.rb index 5b89c58d..5cc551e4 100644 --- a/lib/puppet/type/cs_clone.rb +++ b/lib/puppet/type/cs_clone.rb @@ -110,7 +110,7 @@ def unmunge_cs_primitive(name) name = name.split(':')[0] - name = name[3..-1] if name.start_with? 'ms_' + name = name[3..] if name.start_with? 'ms_' name end diff --git a/lib/puppet/type/cs_colocation.rb b/lib/puppet/type/cs_colocation.rb index 2b6fca37..54467600 100644 --- a/lib/puppet/type/cs_colocation.rb +++ b/lib/puppet/type/cs_colocation.rb @@ -106,7 +106,7 @@ def extract_primitives def unmunge_cs_primitive(name) name = name.split(':')[0] - name = name[3..-1] if name.start_with? 'ms_' + name = name[3..] if name.start_with? 'ms_' name end diff --git a/lib/puppet/type/cs_group.rb b/lib/puppet/type/cs_group.rb index 435ca576..a0b86d72 100644 --- a/lib/puppet/type/cs_group.rb +++ b/lib/puppet/type/cs_group.rb @@ -65,7 +65,7 @@ def insync?(is) def unmunge_cs_primitive(name) name = name.split(':')[0] - name = name[3..-1] if name.start_with? 'ms_' + name = name[3..] if name.start_with? 'ms_' name end diff --git a/lib/puppet/type/cs_location.rb b/lib/puppet/type/cs_location.rb index f7a193e0..c9b42aeb 100644 --- a/lib/puppet/type/cs_location.rb +++ b/lib/puppet/type/cs_location.rb @@ -108,7 +108,7 @@ def insync?(is) def unmunge_cs_primitive(name) name = name.split(':')[0] - name = name[3..-1] if name.start_with? 'ms_' + name = name[3..] if name.start_with? 'ms_' name end diff --git a/lib/puppet/type/cs_order.rb b/lib/puppet/type/cs_order.rb index be69dc09..60655d74 100644 --- a/lib/puppet/type/cs_order.rb +++ b/lib/puppet/type/cs_order.rb @@ -113,7 +113,7 @@ def unmunge_cs_resourcename(name) return if name.nil? name = name.split(':')[0] - name = name[3..-1] if name.start_with? 'ms_' + name = name[3..] if name.start_with? 'ms_' name end