From 3e01fab20fda2fda4e54f96880aba41a3b3256bf Mon Sep 17 00:00:00 2001 From: Gavin Didrichsen Date: Thu, 13 Jun 2024 13:15:19 +0100 Subject: [PATCH 1/4] Revert "(maint) Exclude breaking rubocop versions" --- Gemfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Gemfile b/Gemfile index 9b1c501..bd40968 100644 --- a/Gemfile +++ b/Gemfile @@ -11,8 +11,6 @@ group :test do gem 'rubocop', '~> 1.50.0' gem 'rubocop-rspec', '~> 2.19' gem 'rubocop-performance', '~> 1.16' - gem 'rubocop-factory_bot', '!= 2.26.0', require: false - gem 'rubocop-rspec_rails', '!= 2.29.0', require: false gem 'simplecov' gem 'simplecov-console' From 2a15213e992ae17d4db6a7a7d0d82d2ca014ac3a Mon Sep 17 00:00:00 2001 From: Gavin Didrichsen Date: Thu, 13 Jun 2024 13:16:10 +0100 Subject: [PATCH 2/4] Update rubocop gems --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index bd40968..59e43e2 100644 --- a/Gemfile +++ b/Gemfile @@ -8,8 +8,8 @@ group :test do gem 'rspec-collection_matchers', '~> 1.0' gem 'rspec-its', '~> 1.0' - gem 'rubocop', '~> 1.50.0' - gem 'rubocop-rspec', '~> 2.19' + gem 'rubocop', '~> 1.64.0' + gem 'rubocop-rspec', '~> 3.0' gem 'rubocop-performance', '~> 1.16' gem 'simplecov' From b5aae01a3c2612a8a9387f6b6aba69d59a5f495a Mon Sep 17 00:00:00 2001 From: Gavin Didrichsen Date: Thu, 20 Jun 2024 12:24:43 +0100 Subject: [PATCH 3/4] Fix version typo for OracleLinux Signed-off-by: Gavin Didrichsen --- exe/matrix.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 exe/matrix.json diff --git a/exe/matrix.json b/exe/matrix.json old mode 100644 new mode 100755 index 4038eeb..3a1f7d7 --- a/exe/matrix.json +++ b/exe/matrix.json @@ -70,7 +70,7 @@ "OracleLinux": { "7": { "x86_64": "litmusimage/oraclelinux:7" }, "8": { "x86_64": "litmusimage/oraclelinux:8" }, - "8": { "x86_64": "litmusimage/oraclelinux:9" } + "9": { "x86_64": "litmusimage/oraclelinux:9" } }, "Scientific": { "7": { "x86_64": "litmusimage/scientificlinux:7" } From d1f606e672db2e0c71cdd0b5be0dbe1cb22fc727 Mon Sep 17 00:00:00 2001 From: Gavin Didrichsen Date: Thu, 20 Jun 2024 12:25:29 +0100 Subject: [PATCH 4/4] Fix rubocop warnings Signed-off-by: Gavin Didrichsen --- exe/matrix_from_metadata_v3 | 2 +- lib/puppet_litmus/inventory_manipulation.rb | 8 ++------ lib/puppet_litmus/rake_helper.rb | 11 ++++------- puppet_litmus.gemspec | 2 +- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/exe/matrix_from_metadata_v3 b/exe/matrix_from_metadata_v3 index 970a603..dbd2f6c 100755 --- a/exe/matrix_from_metadata_v3 +++ b/exe/matrix_from_metadata_v3 @@ -191,7 +191,7 @@ begin # union regexp option values %w[platform arch].each do |c| - ["#{c}_exclude".to_sym, "#{c}_include".to_sym].each do |k| + [:"#{c}_exclude", :"#{c}_include"].each do |k| options[k] = if options[k].empty? nil else diff --git a/lib/puppet_litmus/inventory_manipulation.rb b/lib/puppet_litmus/inventory_manipulation.rb index fbea416..3a49692 100644 --- a/lib/puppet_litmus/inventory_manipulation.rb +++ b/lib/puppet_litmus/inventory_manipulation.rb @@ -10,11 +10,7 @@ module PuppetLitmus::InventoryManipulation # @return [Hash] hash of the litmus_inventory.yaml file. def inventory_hash_from_inventory_file(inventory_full_path = nil) require 'yaml' - inventory_full_path = if inventory_full_path.nil? - "#{Dir.pwd}/spec/fixtures/litmus_inventory.yaml" - else - inventory_full_path - end + inventory_full_path = "#{Dir.pwd}/spec/fixtures/litmus_inventory.yaml" if inventory_full_path.nil? raise "There is no inventory file at '#{inventory_full_path}'." unless File.exist?(inventory_full_path) YAML.load_file(inventory_full_path) @@ -103,7 +99,7 @@ def nodes_with_role(role, inventory) output_collector = [] targets_in_inventory(inventory) do |target| vars = target['vars'] - roles = [(vars['role'] || vars['roles'])].flatten + roles = [vars['role'] || vars['roles']].flatten roles = roles.map(&:downcase) output_collector << target['uri'] if roles.include? role.downcase end diff --git a/lib/puppet_litmus/rake_helper.rb b/lib/puppet_litmus/rake_helper.rb index 2a0d97c..35ee5f5 100644 --- a/lib/puppet_litmus/rake_helper.rb +++ b/lib/puppet_litmus/rake_helper.rb @@ -83,12 +83,9 @@ def provision_list(provision_hash, key) inventory_vars = provision_hash[key]['vars'] # Splat the params into environment variables to pass to the provision task but only in this runspace provision_hash[key]['params']&.each { |k, value| ENV[k.upcase] = value.to_s } - results = [] - - provision_hash[key]['images'].each do |image| - results << provision(provisioner, image, inventory_vars) + provision_hash[key]['images'].map do |image| + provision(provisioner, image, inventory_vars) end - results end def tear_down_nodes(targets, inventory_hash) @@ -160,11 +157,11 @@ def install_agent(collection, targets, inventory_hash) def configure_path(inventory_hash) results = [] # fix the path on ssh_nodes - unless inventory_hash['groups'].select { |group| group['name'] == 'ssh_nodes' && !group['targets'].empty? }.empty? + unless inventory_hash['groups'].none? { |group| group['name'] == 'ssh_nodes' && !group['targets'].empty? } results << run_command('echo PATH="$PATH:/opt/puppetlabs/puppet/bin" > /etc/environment', 'ssh_nodes', config: nil, inventory: inventory_hash) end - unless inventory_hash['groups'].select { |group| group['name'] == 'winrm_nodes' && !group['targets'].empty? }.empty? + unless inventory_hash['groups'].none? { |group| group['name'] == 'winrm_nodes' && !group['targets'].empty? } results << run_command('[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Program Files\Puppet Labs\Puppet\bin;C:\Program Files (x86)\Puppet Labs\Puppet\bin", "Machine")', 'winrm_nodes', config: nil, inventory: inventory_hash) end diff --git a/puppet_litmus.gemspec b/puppet_litmus.gemspec index c9638ea..ad729a0 100644 --- a/puppet_litmus.gemspec +++ b/puppet_litmus.gemspec @@ -26,7 +26,7 @@ Gem::Specification.new do |spec| spec.summary = 'Providing a simple command line tool for puppet content creators, to enable simple and complex test deployments.' spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0') spec.add_runtime_dependency 'bolt', '~> 3.0' - spec.add_runtime_dependency 'docker-api', '>= 1.34', '< 3.0.0' + spec.add_runtime_dependency 'docker-api', '>= 1.34', '< 3.0.0' spec.add_runtime_dependency 'parallel' spec.add_runtime_dependency 'puppet-modulebuilder', '>= 0.3.0' spec.add_runtime_dependency 'retryable', '~> 3.0'