From 473086ec519a0eb7d18b20a58d84975393d3b03f Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Mon, 2 Dec 2024 18:55:52 -0800 Subject: [PATCH 1/5] Require Ruby 3.1 or later Ruby 3 went EOL in April Signed-off-by: Tim Smith --- .rubocop.yml | 3 ++- kitchen-dokken.gemspec | 2 +- lib/kitchen/driver/dokken.rb | 2 +- lib/kitchen/transport/dokken.rb | 10 +++++----- test/cookbooks/dokken_test/recipes/default.rb | 16 ++++++++-------- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 9909d8e..ea9207d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,8 +1,9 @@ --- require: - - chefstyle + - cookstyle/chefstyle AllCops: + TargetRubyVersion: 3.1 Include: - "**/*.rb" Exclude: diff --git a/kitchen-dokken.gemspec b/kitchen-dokken.gemspec index 3e6fd07..25b3122 100644 --- a/kitchen-dokken.gemspec +++ b/kitchen-dokken.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |spec| spec.files = %w{LICENSE kitchen-dokken.gemspec Gemfile Rakefile} + Dir.glob("lib/**/*") spec.require_paths = ["lib"] - spec.required_ruby_version = ">= 2.7" + spec.required_ruby_version = ">= 3.1" spec.add_dependency "docker-api", ">= 1.33", "< 3" spec.add_dependency "lockfile", "~> 2.1" diff --git a/lib/kitchen/driver/dokken.rb b/lib/kitchen/driver/dokken.rb index bafdb69..63d39d5 100644 --- a/lib/kitchen/driver/dokken.rb +++ b/lib/kitchen/driver/dokken.rb @@ -465,7 +465,7 @@ def docker_config_creds next if v["auth"].nil? username, password = Base64.decode64(v["auth"]).split(":") - @docker_config_creds[k] = { serveraddress: k, username: username, password: password } + @docker_config_creds[k] = { serveraddress: k, username:, password: } end end diff --git a/lib/kitchen/transport/dokken.rb b/lib/kitchen/transport/dokken.rb index 9e0b75e..f2d8f93 100644 --- a/lib/kitchen/transport/dokken.rb +++ b/lib/kitchen/transport/dokken.rb @@ -165,11 +165,11 @@ def upload(locals, remote) debug "Rsync is not installed. Falling back to SCP." locals.each do |local| Net::SCP.upload!(ssh_ip, - "root", - local, - remote, - recursive: true, - ssh: { port: ssh_port, keys: ["#{tmpdir}/id_rsa"] }) + "root", + local, + remote, + recursive: true, + ssh: { port: ssh_port, keys: ["#{tmpdir}/id_rsa"] }) end end end diff --git a/test/cookbooks/dokken_test/recipes/default.rb b/test/cookbooks/dokken_test/recipes/default.rb index 34a90c3..527dcd5 100644 --- a/test/cookbooks/dokken_test/recipes/default.rb +++ b/test/cookbooks/dokken_test/recipes/default.rb @@ -57,9 +57,9 @@ user "notroot" live_stream true environment "PATH" => "/usr/bin:/usr/local/bin:/home/notroot/bin", - "HOME" => "/home/notroot", - "DOCKER_HOST" => "tcp://127.0.0.1:2375", - "CHEF_LICENSE" => "accept-no-persist" + "HOME" => "/home/notroot", + "DOCKER_HOST" => "tcp://127.0.0.1:2375", + "CHEF_LICENSE" => "accept-no-persist" action :run end @@ -69,8 +69,8 @@ user "notroot" live_stream true environment "PATH" => "/usr/bin:/usr/local/bin:/home/notroot/bin", - "HOME" => "/home/notroot", - "DOCKER_HOST" => "tcp://127.0.0.1:2375" + "HOME" => "/home/notroot", + "DOCKER_HOST" => "tcp://127.0.0.1:2375" action :run end @@ -87,8 +87,8 @@ user "notroot" live_stream true environment "PATH" => "/usr/bin:/usr/local/bin:/home/notroot/bin", - "HOME" => "/home/notroot", - "DOCKER_HOST" => "tcp://127.0.0.1:2375", - "CHEF_LICENSE" => "accept-no-persist" + "HOME" => "/home/notroot", + "DOCKER_HOST" => "tcp://127.0.0.1:2375", + "CHEF_LICENSE" => "accept-no-persist" action :run end From fc56ef8c20fec76993ac2d1c705f43f91935b6f9 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Mon, 2 Dec 2024 19:16:23 -0800 Subject: [PATCH 2/5] Switch to cookstyle fully Signed-off-by: Tim Smith --- Gemfile | 4 ++-- Rakefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index b7f5109..3b1c034 100644 --- a/Gemfile +++ b/Gemfile @@ -14,6 +14,6 @@ group :development do gem "pry-byebug" end -group :chefstyle do - gem "chefstyle", "2.2.3" +group :linting do + gem "cookstyle", "7.32.8" end diff --git a/Rakefile b/Rakefile index 062d545..31eb4c4 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,5 @@ require "bundler/gem_tasks" -require "chefstyle" +require "cookstyle/chefstyle" require "rubocop/rake_task" RuboCop::RakeTask.new(:style) do |task| From 4134738dad6510b28ef6ed37606e77be52bb36cd Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Mon, 2 Dec 2024 19:17:35 -0800 Subject: [PATCH 3/5] Remove pry-byebug Signed-off-by: Tim Smith --- Gemfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Gemfile b/Gemfile index 3b1c034..8eb5922 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,5 @@ source "https://rubygems.org" -# Specify your gem's dependencies in kitchen-dokken.gemspec gemspec group :test do @@ -11,7 +10,6 @@ end group :development do gem "pry" - gem "pry-byebug" end group :linting do From 5c53ca6aaa21ab15ba192e2533308c99bfba4ec3 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Mon, 2 Dec 2024 19:19:25 -0800 Subject: [PATCH 4/5] Error on missing cookstyle Signed-off-by: Tim Smith --- Rakefile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Rakefile b/Rakefile index 31eb4c4..d541a04 100644 --- a/Rakefile +++ b/Rakefile @@ -1,9 +1,13 @@ require "bundler/gem_tasks" -require "cookstyle/chefstyle" -require "rubocop/rake_task" -RuboCop::RakeTask.new(:style) do |task| - task.options += ["--display-cop-names", "--no-color"] +begin + require "cookstyle/chefstyle" + require "rubocop/rake_task" + RuboCop::RakeTask.new(:style) do |task| + task.options += ["--display-cop-names", "--no-color"] + end +rescue LoadError + puts "cookstyle/chefstyle is not available. (sudo) gem install cookstyle to do style checking." end task default: %i{style} From 1b2eb672963cfcd88a60c24b59f8a032a9f0978e Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Mon, 2 Dec 2024 19:19:45 -0800 Subject: [PATCH 5/5] Add codeowners file Signed-off-by: Tim Smith --- CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 CODEOWNERS diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..b7175b0 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +@test-kitchen/maintainers