From 9354132cb53881fab0f1ccad052ca3d2412a7fc4 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 12 May 2023 11:31:54 +0200 Subject: [PATCH 1/9] 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 a4b006918..b929160c9 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 55efc4ecb..aa5e47ebc 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 gem 'bcrypt', :require => false gem 'webmock', :require => false end @@ -18,21 +18,22 @@ group :development do end group :system_tests do - gem 'voxpupuli-acceptance', '~> 1.0', :require => false + gem 'voxpupuli-acceptance', '~> 2.0', :require => false gem 'bcrypt', :require => false gem 'rspec-retry', :require => false gem 'simp-beaker-helpers', :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 9b722f96414e4f86803e0413a658842ba94932cb Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 17 Aug 2023 15:03:55 +0200 Subject: [PATCH 2/9] modulesync 7.0.0 --- .github/CONTRIBUTING.md | 11 +++++++---- .msync.yml | 2 +- Gemfile | 2 +- spec/spec_helper.rb | 1 + spec/spec_helper_acceptance.rb | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8b466cfb9..6aaa603ff 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 b929160c9..dd3e95722 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 aa5e47ebc..c3471b157 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 cf64ebcc9..78acf179a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -21,3 +21,4 @@ add_custom_fact name.to_sym, value end end +Dir['./spec/support/spec/**/*.rb'].sort.each { |f| require f } diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index d3a6e23cf..2681792ea 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 } From ecd7dab442935930bcf168fb6747283e8e7a84dd Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 15 Dec 2023 13:11:40 +0100 Subject: [PATCH 3/9] 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 8a0779116..b66d8ca74 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 15f172134..55324aa62 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 dd3e95722..f8183449f 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 58a040887..10b983069 100644 --- a/.pmtignore +++ b/.pmtignore @@ -35,3 +35,4 @@ /.yardoc/ /.yardopts /Dockerfile +/HISTORY.md diff --git a/Gemfile b/Gemfile index c3471b157..0eb27d05f 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 gem 'bcrypt', :require => false gem 'webmock', :require => false end @@ -18,16 +18,14 @@ group :development do end group :system_tests do - gem 'voxpupuli-acceptance', '~> 2.0', :require => false + gem 'voxpupuli-acceptance', '~> 3.0', :require => false gem 'bcrypt', :require => false gem 'rspec-retry', :require => false gem 'simp-beaker-helpers', :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 a97451c8422f6f95e54e2d4d077caec8abf9b437 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 30 Jan 2024 17:00:49 +0100 Subject: [PATCH 4/9] save rubocop autofixes --- lib/puppet/parser/functions/concat_merge.rb | 2 +- lib/puppet/parser/functions/deep_implode.rb | 2 +- lib/puppet/parser/functions/es_plugin_name.rb | 2 +- lib/puppet/provider/elastic_plugin.rb | 2 +- lib/puppet/type/elasticsearch_ilm_policy.rb | 2 +- lib/puppet/type/elasticsearch_slm_policy.rb | 2 +- .../acceptance/tests/datadir_shared_examples.rb | 2 +- .../acceptance/tests/security_shared_examples.rb | 2 +- .../provider/elasticsearch_rest_shared_examples.rb | 2 +- spec/spec_utilities.rb | 2 +- spec/support/acceptance/elastic.rb | 10 +++++----- .../provider/elasticsearch_plugin/shared_examples.rb | 8 ++++---- 12 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/puppet/parser/functions/concat_merge.rb b/lib/puppet/parser/functions/concat_merge.rb index 27b20c799..b98d4fdea 100644 --- a/lib/puppet/parser/functions/concat_merge.rb +++ b/lib/puppet/parser/functions/concat_merge.rb @@ -5,7 +5,7 @@ module Puppet::Parser::Functions newfunction( :concat_merge, type: :rvalue, - doc: <<-'ENDHEREDOC') do |args| + doc: <<-ENDHEREDOC) do |args| Merges two or more hashes together concatenating duplicate keys with array values and returns the resulting hash. diff --git a/lib/puppet/parser/functions/deep_implode.rb b/lib/puppet/parser/functions/deep_implode.rb index 92dce02b6..4ff332530 100644 --- a/lib/puppet/parser/functions/deep_implode.rb +++ b/lib/puppet/parser/functions/deep_implode.rb @@ -9,7 +9,7 @@ module Puppet::Parser::Functions newfunction( :deep_implode, type: :rvalue, - doc: <<-'ENDHEREDOC') do |args| + doc: <<-ENDHEREDOC) do |args| Recursively flattens all keys of a hash into a dot-notated hash, deeply merging duplicate key values by natively combining them and returns the resulting hash. diff --git a/lib/puppet/parser/functions/es_plugin_name.rb b/lib/puppet/parser/functions/es_plugin_name.rb index 33813e240..9dec433d2 100644 --- a/lib/puppet/parser/functions/es_plugin_name.rb +++ b/lib/puppet/parser/functions/es_plugin_name.rb @@ -9,7 +9,7 @@ module Puppet::Parser::Functions newfunction( :es_plugin_name, type: :rvalue, - doc: <<-'ENDHEREDOC') do |args| + doc: <<-ENDHEREDOC) do |args| Given a string, return the best guess at what the directory name will be for the given plugin. Any arguments past the first will be fallbacks (using the same logic) should the first fail. diff --git a/lib/puppet/provider/elastic_plugin.rb b/lib/puppet/provider/elastic_plugin.rb index 2ddf9f283..a8b8e3f9a 100644 --- a/lib/puppet/provider/elastic_plugin.rb +++ b/lib/puppet/provider/elastic_plugin.rb @@ -151,7 +151,7 @@ def with_environment(&block) env_vars['ES_JAVA_OPTS'] = env_vars['ES_JAVA_OPTS'].join(' ') env_vars.each do |env_var, value| - saved_vars[env_var] = ENV[env_var] + saved_vars[env_var] = ENV.fetch(env_var, nil) ENV[env_var] = value end diff --git a/lib/puppet/type/elasticsearch_ilm_policy.rb b/lib/puppet/type/elasticsearch_ilm_policy.rb index dd53e41d5..554a982aa 100644 --- a/lib/puppet/type/elasticsearch_ilm_policy.rb +++ b/lib/puppet/type/elasticsearch_ilm_policy.rb @@ -29,7 +29,7 @@ end def insync?(value) - Puppet_X::Elastic.deep_implode(value) == \ + Puppet_X::Elastic.deep_implode(value) == Puppet_X::Elastic.deep_implode(should) end diff --git a/lib/puppet/type/elasticsearch_slm_policy.rb b/lib/puppet/type/elasticsearch_slm_policy.rb index 3db2aedd0..ebb3271da 100644 --- a/lib/puppet/type/elasticsearch_slm_policy.rb +++ b/lib/puppet/type/elasticsearch_slm_policy.rb @@ -29,7 +29,7 @@ end def insync?(value) - Puppet_X::Elastic.deep_implode(value) == \ + Puppet_X::Elastic.deep_implode(value) == Puppet_X::Elastic.deep_implode(should) end diff --git a/spec/helpers/acceptance/tests/datadir_shared_examples.rb b/spec/helpers/acceptance/tests/datadir_shared_examples.rb index dec576565..c88a71159 100644 --- a/spec/helpers/acceptance/tests/datadir_shared_examples.rb +++ b/spec/helpers/acceptance/tests/datadir_shared_examples.rb @@ -34,7 +34,7 @@ json = JSON.parse(subject.stdout)['nodes'].values.first expect( json['settings']['path']['data'] - ).to(datapaths.one? && v[:elasticsearch_major_version] <= 2 ? eq(datapaths.first) : contain_exactly(*datapaths)) + ).to(datapaths.one? && v[:elasticsearch_major_version] <= 2 ? eq(datapaths.first) : match_array(datapaths)) end end end diff --git a/spec/helpers/acceptance/tests/security_shared_examples.rb b/spec/helpers/acceptance/tests/security_shared_examples.rb index ba880c96d..e28621ba1 100644 --- a/spec/helpers/acceptance/tests/security_shared_examples.rb +++ b/spec/helpers/acceptance/tests/security_shared_examples.rb @@ -66,7 +66,7 @@ end shared_examples 'security acceptance tests' do |es_config| - describe 'security plugin operations', if: vault_available?, then_purge: true, with_license: true, with_certificates: true do + describe 'security plugin operations', if: vault_available?, then_purge: true, with_certificates: true, with_license: true do rand_string = -> { [*('a'..'z')].sample(8).join } admin_user = rand_string.call diff --git a/spec/helpers/unit/provider/elasticsearch_rest_shared_examples.rb b/spec/helpers/unit/provider/elasticsearch_rest_shared_examples.rb index baef78205..22440fb31 100644 --- a/spec/helpers/unit/provider/elasticsearch_rest_shared_examples.rb +++ b/spec/helpers/unit/provider/elasticsearch_rest_shared_examples.rb @@ -47,7 +47,7 @@ expect(described_class.instances.map do |provider| provider.instance_variable_get(:@property_hash) - end).to contain_exactly(*instance) + end).to match_array(instance) end end diff --git a/spec/spec_utilities.rb b/spec/spec_utilities.rb index daaeb7687..a376615d9 100644 --- a/spec/spec_utilities.rb +++ b/spec/spec_utilities.rb @@ -77,7 +77,7 @@ def get(url, file_path) found = true end end - File.open(file_path, 'w+') { |fh| fh.write res.body } + File.write(file_path, res.body) end def fetch_archives(archives) diff --git a/spec/support/acceptance/elastic.rb b/spec/support/acceptance/elastic.rb index 676cea2e5..58bf054a6 100644 --- a/spec/support/acceptance/elastic.rb +++ b/spec/support/acceptance/elastic.rb @@ -110,14 +110,14 @@ class { 'elasticsearch': end c.before :context, :with_license do - Vault.address = ENV['VAULT_ADDR'] + Vault.address = ENV.fetch('VAULT_ADDR', nil) if ENV['CI'] - Vault.auth.approle(ENV['VAULT_APPROLE_ROLE_ID'], ENV['VAULT_APPROLE_SECRET_ID']) + Vault.auth.approle(ENV.fetch('VAULT_APPROLE_ROLE_ID', nil), ENV.fetch('VAULT_APPROLE_SECRET_ID', nil)) else - Vault.auth.token(ENV['VAULT_TOKEN']) + Vault.auth.token(ENV.fetch('VAULT_TOKEN', nil)) end licenses = Vault.with_retries(Vault::HTTPConnectionError) do - Vault.logical.read(ENV['VAULT_PATH']) + Vault.logical.read(ENV.fetch('VAULT_PATH', nil)) end.data raise 'No license found!' unless licenses @@ -195,7 +195,7 @@ class { 'elasticsearch': end c.before :suite do - fetch_archives(derive_artifact_urls_for(ENV['ELASTICSEARCH_VERSION'])) + fetch_archives(derive_artifact_urls_for(ENV.fetch('ELASTICSEARCH_VERSION', nil))) # Use the Java class once before the suite of tests unless shell('command -v java', accept_all_exit_codes: true).exit_code.zero? diff --git a/spec/unit/provider/elasticsearch_plugin/shared_examples.rb b/spec/unit/provider/elasticsearch_plugin/shared_examples.rb index 605386088..e5681c259 100644 --- a/spec/unit/provider/elasticsearch_plugin/shared_examples.rb +++ b/spec/unit/provider/elasticsearch_plugin/shared_examples.rb @@ -130,7 +130,7 @@ it 'sets the ES_PATH_CONF env var' do resource[:configdir] = '/etc/elasticsearch' expect(provider.with_environment do - ENV['ES_PATH_CONF'] + ENV.fetch('ES_PATH_CONF', nil) end).to eq('/etc/elasticsearch') end end @@ -140,7 +140,7 @@ it 'uses authentication credentials' do resource[:java_opts] = ['-Des.plugins.staging=4a2ffaf5'] expect(provider.with_environment do - ENV['ES_JAVA_OPTS'] + ENV.fetch('ES_JAVA_OPTS', nil) end).to eq('-Des.plugins.staging=4a2ffaf5') end end @@ -149,7 +149,7 @@ it 'sets the JAVA_HOME env var' do resource[:java_home] = '/opt/foo' expect(provider.with_environment do - ENV['JAVA_HOME'] + ENV.fetch('JAVA_HOME', nil) end).to eq('/opt/foo') end end @@ -159,7 +159,7 @@ it 'defaults to the elasticsearch bundled JDK' do resource[:java_home] = '' expect(provider.with_environment do - ENV['JAVA_HOME'] + ENV.fetch('JAVA_HOME', nil) end).to eq(elasticsearch_java_home) end end From d7a851dc27ae1600d198ebd9fe1b13b6db70a90a Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 6 Feb 2024 12:30:15 +0100 Subject: [PATCH 5/9] 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 b66d8ca74..7216724fd 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 f8183449f..f46ee025e 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 6cbd7e0f6a7f556b36523abe2e4917f17f838292 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Sun, 11 Feb 2024 17:23:23 +0100 Subject: [PATCH 6/9] rubocop autocorrects and ignores --- .rubocop.yml | 2 ++ .rubocop_todo.yml | 20 +++++++++++++++++++ .../type/elasticsearch_component_template.rb | 2 +- .../type/elasticsearch_index_template.rb | 2 +- lib/puppet/type/elasticsearch_license.rb | 4 ++-- lib/puppet/type/elasticsearch_template.rb | 2 +- spec/spec_utilities.rb | 8 ++++---- spec/support/acceptance/elastic.rb | 4 ++-- 8 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 .rubocop_todo.yml diff --git a/.rubocop.yml b/.rubocop.yml index 53ac18982..ea22bff86 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 000000000..84e799fad --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,20 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2024-02-11 16:22:05 UTC using RuboCop version 1.50.2. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 32 +# Configuration parameters: Max. +RSpec/IndexedLet: + Exclude: + - 'spec/unit/provider/elasticsearch_component_template/ruby_spec.rb' + - 'spec/unit/provider/elasticsearch_ilm_policy/ruby_spec.rb' + - 'spec/unit/provider/elasticsearch_index/ruby_spec.rb' + - 'spec/unit/provider/elasticsearch_index_template/ruby_spec.rb' + - 'spec/unit/provider/elasticsearch_pipeline/ruby_spec.rb' + - 'spec/unit/provider/elasticsearch_slm_policy/ruby_spec.rb' + - 'spec/unit/provider/elasticsearch_snapshot_repository/ruby_spec.rb' + - 'spec/unit/provider/elasticsearch_template/ruby_spec.rb' diff --git a/lib/puppet/type/elasticsearch_component_template.rb b/lib/puppet/type/elasticsearch_component_template.rb index 7e946a1bc..f8fc45723 100644 --- a/lib/puppet/type/elasticsearch_component_template.rb +++ b/lib/puppet/type/elasticsearch_component_template.rb @@ -48,7 +48,7 @@ def insync?(value) val['template']['settings']['index'] = {} unless val['template']['settings'].key? 'index' (val['template']['settings'].keys - ['index']).each do |setting| new_key = if setting.start_with? 'index.' - setting[6..-1] + setting[6..] else setting end diff --git a/lib/puppet/type/elasticsearch_index_template.rb b/lib/puppet/type/elasticsearch_index_template.rb index 31502d52b..e2bc8cf03 100644 --- a/lib/puppet/type/elasticsearch_index_template.rb +++ b/lib/puppet/type/elasticsearch_index_template.rb @@ -54,7 +54,7 @@ def insync?(value) val['template']['settings']['index'] = {} unless val['template']['settings'].key? 'index' (val['template']['settings'].keys - ['index']).each do |setting| new_key = if setting.start_with? 'index.' - setting[6..-1] + setting[6..] else setting end diff --git a/lib/puppet/type/elasticsearch_license.rb b/lib/puppet/type/elasticsearch_license.rb index 0e43f305e..85551bf8d 100644 --- a/lib/puppet/type/elasticsearch_license.rb +++ b/lib/puppet/type/elasticsearch_license.rb @@ -31,9 +31,9 @@ def insync?(value) def should_to_s(newvalue) newvalue.transform_values do |license_data| if license_data.is_a? Hash - license_data.map do |field, value| + license_data.to_h do |field, value| [field, field == 'signature' ? '[redacted]' : value] - end.to_h + end else v end diff --git a/lib/puppet/type/elasticsearch_template.rb b/lib/puppet/type/elasticsearch_template.rb index bc37b591a..6fd715fb5 100644 --- a/lib/puppet/type/elasticsearch_template.rb +++ b/lib/puppet/type/elasticsearch_template.rb @@ -50,7 +50,7 @@ val['settings']['index'] = {} unless val['settings'].key? 'index' (val['settings'].keys - ['index']).each do |setting| new_key = if setting.start_with? 'index.' - setting[6..-1] + setting[6..] else setting end diff --git a/spec/spec_utilities.rb b/spec/spec_utilities.rb index a376615d9..c1456cb98 100644 --- a/spec/spec_utilities.rb +++ b/spec/spec_utilities.rb @@ -40,7 +40,7 @@ def derive_artifact_urls_for(full_version, plugins = ['analysis-icu']) end def derive_full_package_url(full_version, extensions = %w[deb rpm]) - extensions.map do |ext| + extensions.to_h do |ext| url = if full_version.start_with? '6' "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-#{full_version}.#{ext}" elsif ext == 'deb' @@ -49,14 +49,14 @@ def derive_full_package_url(full_version, extensions = %w[deb rpm]) "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-#{full_version}-x86_64.#{ext}" end [url, File.basename(url)] - end.to_h + end end def derive_plugin_urls_for(full_version, plugins = ['analysis-icu']) - plugins.map do |plugin| + plugins.to_h do |plugin| url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/#{plugin}/#{plugin}-#{full_version}.zip" [url, File.join('plugins', File.basename(url))] - end.to_h + end end def artifact(file, fixture_path = []) diff --git a/spec/support/acceptance/elastic.rb b/spec/support/acceptance/elastic.rb index 58bf054a6..b64674ab0 100644 --- a/spec/support/acceptance/elastic.rb +++ b/spec/support/acceptance/elastic.rb @@ -54,7 +54,7 @@ v[:elasticsearch_plugins] = Dir[ artifact("*#{v[:elasticsearch_full_version]}.zip", ['plugins']) - ].map do |plugin| + ].to_h do |plugin| plugin_filename = File.basename(plugin) plugin_name = plugin_filename.match(%r{^(?.+)-#{v[:elasticsearch_full_version]}.zip})[:name] [ @@ -64,7 +64,7 @@ url: derive_plugin_urls_for(v[:elasticsearch_full_version], [plugin_name]).keys.first, }, ] - end.to_h + end v[:oss] = !ENV['OSS_PACKAGE'].nil? and ENV['OSS_PACKAGE'] == 'true' v[:cluster_name] = SecureRandom.hex(10) From 7c4fd1e0e04a2fcec2859f1fce44a4965917e317 Mon Sep 17 00:00:00 2001 From: Hugo Haakseth Date: Tue, 20 Feb 2024 16:18:19 +0100 Subject: [PATCH 7/9] puppetlabs/stdlib: Allow 9.x --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 4357d6690..c02e18c0d 100644 --- a/metadata.json +++ b/metadata.json @@ -22,7 +22,7 @@ }, { "name": "puppetlabs/stdlib", - "version_requirement": ">= 4.13.0 < 9.0.0" + "version_requirement": ">= 4.13.0 < 10.0.0" } ], "operatingsystem_support": [ From cfebd3e19273635651cb4831cd0527e04cf20fdd Mon Sep 17 00:00:00 2001 From: Hugo Haakseth Date: Tue, 20 Feb 2024 16:19:04 +0100 Subject: [PATCH 8/9] remove old puppet install helper --- spec/support/acceptance/elastic.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/support/acceptance/elastic.rb b/spec/support/acceptance/elastic.rb index b64674ab0..809711317 100644 --- a/spec/support/acceptance/elastic.rb +++ b/spec/support/acceptance/elastic.rb @@ -19,8 +19,6 @@ ENV['ELASTICSEARCH_VERSION'] = '7.10.1' ENV.delete('BEAKER_debug') -run_puppet_install_helper('agent') unless ENV['BEAKER_provision'] == 'no' - RSpec.configure do |c| # General-purpose spec-global variables c.add_setting :v, default: {} From 72812afe15c39f54bdf38c99e5993c1a9e5dc7b7 Mon Sep 17 00:00:00 2001 From: Hugo Haakseth Date: Tue, 20 Feb 2024 16:21:36 +0100 Subject: [PATCH 9/9] fix acceptance tests --- .../acceptance/tests/component_template_shared_examples.rb | 6 +++--- spec/helpers/acceptance/tests/ilm_policy_shared_examples.rb | 6 +++--- .../acceptance/tests/index_template_shared_examples.rb | 6 +++--- .../helpers/acceptance/tests/package_url_shared_examples.rb | 4 ++-- spec/helpers/acceptance/tests/plugin_shared_examples.rb | 4 ++-- spec/helpers/acceptance/tests/slm_policy_shared_examples.rb | 6 +++--- spec/helpers/acceptance/tests/template_shared_examples.rb | 6 +++--- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/spec/helpers/acceptance/tests/component_template_shared_examples.rb b/spec/helpers/acceptance/tests/component_template_shared_examples.rb index ee5d20f2b..63b443ad4 100644 --- a/spec/helpers/acceptance/tests/component_template_shared_examples.rb +++ b/spec/helpers/acceptance/tests/component_template_shared_examples.rb @@ -57,17 +57,17 @@ shared_examples 'component template operations' do |es_config, component_template| describe 'template resources' do before :all do # rubocop:disable RSpec/BeforeAfterAll - shell "mkdir -p #{default['distmoduledir']}/another/files" + shell "mkdir -p #{default.puppet['codedir']}/modules/another/files" create_remote_file( default, - "#{default['distmoduledir']}/another/files/good.json", + "#{default.puppet['codedir']}/modules/another/files/good.json", JSON.dump(component_template) ) create_remote_file( default, - "#{default['distmoduledir']}/another/files/bad.json", + "#{default.puppet['codedir']}/modules/another/files/bad.json", JSON.dump(component_template)[0..-5] ) end diff --git a/spec/helpers/acceptance/tests/ilm_policy_shared_examples.rb b/spec/helpers/acceptance/tests/ilm_policy_shared_examples.rb index 192f62472..2b8657b68 100644 --- a/spec/helpers/acceptance/tests/ilm_policy_shared_examples.rb +++ b/spec/helpers/acceptance/tests/ilm_policy_shared_examples.rb @@ -57,17 +57,17 @@ shared_examples 'ILM policy operations' do |es_config, ilm_policy| describe 'policy resources' do before :all do # rubocop:disable RSpec/BeforeAfterAll - shell "mkdir -p #{default['distmoduledir']}/another/files" + shell "mkdir -p #{default.puppet['codedir']}/modules/another/files" create_remote_file( default, - "#{default['distmoduledir']}/another/files/good.json", + "#{default.puppet['codedir']}/modules/another/files/good.json", JSON.dump(ilm_policy) ) create_remote_file( default, - "#{default['distmoduledir']}/another/files/bad.json", + "#{default.puppet['codedir']}/modules/another/files/bad.json", JSON.dump(ilm_policy)[0..-5] ) end diff --git a/spec/helpers/acceptance/tests/index_template_shared_examples.rb b/spec/helpers/acceptance/tests/index_template_shared_examples.rb index 9c8672f8f..c748a30c8 100644 --- a/spec/helpers/acceptance/tests/index_template_shared_examples.rb +++ b/spec/helpers/acceptance/tests/index_template_shared_examples.rb @@ -57,17 +57,17 @@ shared_examples 'index template operations' do |es_config, index_template| describe 'template resources' do before :all do # rubocop:disable RSpec/BeforeAfterAll - shell "mkdir -p #{default['distmoduledir']}/another/files" + shell "mkdir -p #{default.puppet['codedir']}/modules/another/files" create_remote_file( default, - "#{default['distmoduledir']}/another/files/good.json", + "#{default.puppet['codedir']}/modules/another/files/good.json", JSON.dump(index_template) ) create_remote_file( default, - "#{default['distmoduledir']}/another/files/bad.json", + "#{default.puppet['codedir']}/modules/another/files/bad.json", JSON.dump(index_template)[0..-5] ) end diff --git a/spec/helpers/acceptance/tests/package_url_shared_examples.rb b/spec/helpers/acceptance/tests/package_url_shared_examples.rb index 823e17939..841701a19 100644 --- a/spec/helpers/acceptance/tests/package_url_shared_examples.rb +++ b/spec/helpers/acceptance/tests/package_url_shared_examples.rb @@ -53,11 +53,11 @@ context 'via puppet paths', :with_cleanup do before :all do # rubocop:disable RSpec/BeforeAfterAll - shell "mkdir -p #{default['distmoduledir']}/another/files" + shell "mkdir -p #{default.puppet['codedir']}/modules/another/files" scp_to default, v[:elasticsearch_package][:path], - "#{default['distmoduledir']}/another/files/#{v[:elasticsearch_package][:filename]}" + "#{default.puppet['codedir']}/modules/another/files/#{v[:elasticsearch_package][:filename]}" end let(:manifest_class_parameters) do diff --git a/spec/helpers/acceptance/tests/plugin_shared_examples.rb b/spec/helpers/acceptance/tests/plugin_shared_examples.rb index c81bf1870..f1decf27e 100644 --- a/spec/helpers/acceptance/tests/plugin_shared_examples.rb +++ b/spec/helpers/acceptance/tests/plugin_shared_examples.rb @@ -8,7 +8,7 @@ shared_examples 'plugin acceptance tests' do |es_config, plugins| describe 'elasticsearch::plugin' do before :all do # rubocop:disable RSpec/BeforeAfterAll - shell "mkdir -p #{default['distmoduledir']}/another/files" + shell "mkdir -p #{default.puppet['codedir']}/modules/another/files" end describe 'invalid plugins', :with_cleanup do @@ -53,7 +53,7 @@ scp_to( default, meta[:path], - "#{default['distmoduledir']}/another/files/#{plugin}.zip" + "#{default.puppet['codedir']}/modules/another/files/#{plugin}.zip" ) end diff --git a/spec/helpers/acceptance/tests/slm_policy_shared_examples.rb b/spec/helpers/acceptance/tests/slm_policy_shared_examples.rb index 4ded73c77..0c9ec71ed 100644 --- a/spec/helpers/acceptance/tests/slm_policy_shared_examples.rb +++ b/spec/helpers/acceptance/tests/slm_policy_shared_examples.rb @@ -61,17 +61,17 @@ shared_examples 'SLM policy operations' do |es_config, slm_policy| describe 'policy resources' do before :all do # rubocop:disable RSpec/BeforeAfterAll - shell "mkdir -p #{default['distmoduledir']}/another/files" + shell "mkdir -p #{default.puppet['codedir']}/modules/another/files" create_remote_file( default, - "#{default['distmoduledir']}/another/files/good.json", + "#{default.puppet['codedir']}/modules/another/files/good.json", JSON.dump(slm_policy) ) create_remote_file( default, - "#{default['distmoduledir']}/another/files/bad.json", + "#{default.puppet['codedir']}/modules/another/files/bad.json", JSON.dump(slm_policy)[0..-5] ) end diff --git a/spec/helpers/acceptance/tests/template_shared_examples.rb b/spec/helpers/acceptance/tests/template_shared_examples.rb index d6c5a5200..778d9239b 100644 --- a/spec/helpers/acceptance/tests/template_shared_examples.rb +++ b/spec/helpers/acceptance/tests/template_shared_examples.rb @@ -57,17 +57,17 @@ shared_examples 'template operations' do |es_config, template| describe 'template resources' do before :all do # rubocop:disable RSpec/BeforeAfterAll - shell "mkdir -p #{default['distmoduledir']}/another/files" + shell "mkdir -p #{default.puppet['codedir']}/modules/another/files" create_remote_file( default, - "#{default['distmoduledir']}/another/files/good.json", + "#{default.puppet['codedir']}/modules/another/files/good.json", JSON.dump(template) ) create_remote_file( default, - "#{default['distmoduledir']}/another/files/bad.json", + "#{default.puppet['codedir']}/modules/another/files/bad.json", JSON.dump(template)[0..-5] ) end