diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8b466cf..6aaa603 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -232,18 +232,21 @@ simple tests against it after applying the module. You can run this with: ```sh -BEAKER_setfile=debian11-64 bundle exec rake beaker +BEAKER_PUPPET_COLLECTION=puppet7 BEAKER_setfile=debian11-64 bundle exec rake beaker ``` -You can replace the string `debian10` with any common operating system. +You can replace the string `debian11` with any common operating system. The following strings are known to work: -* ubuntu1804 * ubuntu2004 -* debian10 +* ubuntu2204 * debian11 * centos7 * centos8 +* centos9 +* almalinux8 +* almalinux9 +* fedora36 For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests). diff --git a/.msync.yml b/.msync.yml index b929160..dd3e957 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '6.0.0' +modulesync_config_version: '7.0.0' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index e3ead7a..5db81df 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2022-08-03 06:53:06 UTC using RuboCop version 1.22.3. +# on 2023-08-17 21:30:05 UTC using RuboCop version 1.50.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -13,6 +13,16 @@ Lint/ConstantDefinitionInBlock: Exclude: - 'lib/puppet/provider/sshd_config_match/augeas.rb' +# Offense count: 11 +# This cop supports unsafe autocorrection (--autocorrect-all). +RSpec/BeEq: + Exclude: + - 'spec/unit/puppet/provider/ssh_config/augeas_spec.rb' + - 'spec/unit/puppet/provider/sshd_config/augeas_spec.rb' + - 'spec/unit/puppet/provider/sshd_config_match/augeas_spec.rb' + - 'spec/unit/puppet/provider/sshd_config_subsystem/augeas_spec.rb' + - 'spec/unit/puppet/provider/sshkey/augeas_spec.rb' + # Offense count: 10 # Configuration parameters: AssignmentOnly. RSpec/InstanceVariable: @@ -44,8 +54,3 @@ Style/AsciiComments: - 'lib/puppet/type/sshd_config.rb' - 'lib/puppet/type/sshd_config_match.rb' - 'lib/puppet/type/sshd_config_subsystem.rb' - -# Offense count: 1 -Style/MixinUsage: - Exclude: - - 'spec/spec_helper_local.rb' diff --git a/Gemfile b/Gemfile index cc5a9c9..7221ee1 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 @@ -18,7 +18,6 @@ end group :system_tests do gem 'voxpupuli-acceptance', '~> 2.0', :require => false - gem 'puppetlabs_spec_helper', :require => false end group :release do diff --git a/lib/puppet/provider/ssh_config/augeas.rb b/lib/puppet/provider/ssh_config/augeas.rb index 093add8..6ba4589 100644 --- a/lib/puppet/provider/ssh_config/augeas.rb +++ b/lib/puppet/provider/ssh_config/augeas.rb @@ -103,7 +103,7 @@ def self.set_simple_value(aug, base, path, label, value) aug.insert(lastsp, label, false) else # Prefer to create the node next to a commented out entry - commented = aug.match("#{base}/#comment[.=~regexp('#{label}([^a-z\.].*)?')]") + commented = aug.match("#{base}/#comment[.=~regexp('#{label}([^a-z.].*)?')]") aug.insert(commented.first, label, false) unless commented.empty? end aug.set("#{path}[last()]", v) diff --git a/lib/puppet/provider/sshd_config/augeas.rb b/lib/puppet/provider/sshd_config/augeas.rb index 762788e..de3c2f9 100644 --- a/lib/puppet/provider/sshd_config/augeas.rb +++ b/lib/puppet/provider/sshd_config/augeas.rb @@ -94,7 +94,7 @@ def self.set_simple_value(aug, base, path, label, value) aug.insert(lastsp, label, false) else # Prefer to create the node next to a commented out entry - commented = aug.match("#{base}/#comment[.=~regexp('#{label}([^a-z\.].*)?', 'i')]") + commented = aug.match("#{base}/#comment[.=~regexp('#{label}([^a-z.].*)?', 'i')]") if commented.empty? if aug.match("#{base}/Match").empty? # insert as the last line diff --git a/lib/puppet/provider/sshkey/augeas.rb b/lib/puppet/provider/sshkey/augeas.rb index 67973ee..b46e89f 100644 --- a/lib/puppet/provider/sshkey/augeas.rb +++ b/lib/puppet/provider/sshkey/augeas.rb @@ -181,9 +181,7 @@ def host_aliases augopen do |aug| if resource_hashed?(aug) # We cannot know about unmanaged aliases when hashed - resource[:host_aliases].map do |a| - a if self.class.find_resource(aug, a) - end.compact + resource[:host_aliases].select { |a| self.class.find_resource(aug, a) } else aug.match('$resource/alias').map do |a| aug.get(a) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 979fea8..4dcb3ca 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -27,3 +27,4 @@ $LOAD_PATH.unshift(File.join(__dir__, 'fixtures/modules/sshkeys_core/lib')) $LOAD_PATH.unshift(File.join(__dir__, 'fixtures/modules/augeasproviders_ssh/lib')) +Dir['./spec/support/spec/**/*.rb'].sort.each { |f| require f } diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index d3a6e23..2681792 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -5,6 +5,6 @@ require 'voxpupuli/acceptance/spec_helper_acceptance' -configure_beaker +configure_beaker(modules: :metadata) Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f }