From c7e11b1ee914dfc9a303e37f0b9b212b9948ed57 Mon Sep 17 00:00:00 2001 From: nikhil2611 Date: Thu, 20 Apr 2023 11:53:42 +0530 Subject: [PATCH 1/9] updated ruby version and verify pipeline Signed-off-by: nikhil2611 --- .expeditor/verify.pipeline.yml | 12 +++--------- Gemfile | 2 +- knife-cloud.gemspec | 4 ++-- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index ecaef1c..7f8b8a5 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify.pipeline.yml @@ -10,20 +10,13 @@ expeditor: timeout_in_minutes: 30 steps: -- label: run-specs-ruby-2.6 +- label: run-specs-ruby-3.1 command: - .expeditor/run_linux_tests.sh rake expeditor: executor: docker: - image: ruby:2.6-buster -- label: run-specs-ruby-2.7 - command: - - .expeditor/run_linux_tests.sh rake - expeditor: - executor: - docker: - image: ruby:2.7-buster + image: ruby:3.1-buster - label: run-specs-windows command: - bundle config --local path vendor/bundle @@ -34,3 +27,4 @@ steps: executor: docker: host_os: windows + image: rubydistros/windows-2019:3.1 diff --git a/Gemfile b/Gemfile index 8133c8b..7eb7426 100644 --- a/Gemfile +++ b/Gemfile @@ -16,7 +16,7 @@ group :test do gem "chef-zero", "~> 15" gem "chef", "~> 15" else - gem "chef", ">= 16.0" + gem "chef", ">= 18.0" end gem "rspec-expectations" gem "rspec-mocks" diff --git a/knife-cloud.gemspec b/knife-cloud.gemspec index ead5be6..efad150 100644 --- a/knife-cloud.gemspec +++ b/knife-cloud.gemspec @@ -14,9 +14,9 @@ Gem::Specification.new do |s| s.files = %w{LICENSE} + Dir.glob("lib/**/*") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.require_paths = %w{lib} - s.required_ruby_version = ">= 2.6" + s.required_ruby_version = ">= 3.1" - s.add_dependency "chef", ">= 15.11" + s.add_dependency "chef", ">= 18.0" s.add_dependency "mixlib-shellout" s.add_dependency "excon", ">= 0.50" # excon 0.50 renamed the errors class and required updating rescues end From 0455342e53a6bda18dbdaa538a9a1a1ee28a9e4b Mon Sep 17 00:00:00 2001 From: nikhil2611 Date: Thu, 20 Apr 2023 12:07:58 +0530 Subject: [PATCH 2/9] added knife dependency Signed-off-by: nikhil2611 --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index 7eb7426..81cf393 100644 --- a/Gemfile +++ b/Gemfile @@ -17,6 +17,7 @@ group :test do gem "chef", "~> 15" else gem "chef", ">= 18.0" + gem "knife" end gem "rspec-expectations" gem "rspec-mocks" From 6d98e6a1a1a2617ecc7ff1b34aa5803da46f0047 Mon Sep 17 00:00:00 2001 From: nikhil2611 Date: Wed, 11 Oct 2023 17:22:03 +0530 Subject: [PATCH 3/9] updated ruby verify pipeline image Signed-off-by: nikhil2611 --- .expeditor/verify.pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index 7f8b8a5..ca0a7bb 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify.pipeline.yml @@ -16,7 +16,7 @@ steps: expeditor: executor: docker: - image: ruby:3.1-buster + image: ruby:3.1 - label: run-specs-windows command: - bundle config --local path vendor/bundle From 6fa97feee85d6c7626f7623f0ecf75b029b2cb8b Mon Sep 17 00:00:00 2001 From: nikhil2611 Date: Sun, 22 Oct 2023 18:10:43 +0530 Subject: [PATCH 4/9] updated the Gemfile Signed-off-by: nikhil2611 --- Gemfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 81cf393..915f014 100644 --- a/Gemfile +++ b/Gemfile @@ -11,10 +11,14 @@ end group :test do gem "rake" - gem "rspec-core" + gem "rspec-core", '~> 3.9' if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.7") gem "chef-zero", "~> 15" gem "chef", "~> 15" + elsif Gem::Version.new(RUBY_VERSION) > Gem::Version.new("3.1") + gem "chef-zero", "~> 15" + gem "chef", "~> 18" + gem "knife" else gem "chef", ">= 18.0" gem "knife" From 410c85dfea51072c7058df4bf7345fdf0fdae00a Mon Sep 17 00:00:00 2001 From: nikhil2611 Date: Sun, 22 Oct 2023 23:24:08 +0530 Subject: [PATCH 5/9] updated pipeline and gemfile Signed-off-by: nikhil2611 --- .expeditor/verify.pipeline.yml | 1 - Gemfile | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index ca0a7bb..c43eace 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify.pipeline.yml @@ -27,4 +27,3 @@ steps: executor: docker: host_os: windows - image: rubydistros/windows-2019:3.1 diff --git a/Gemfile b/Gemfile index 915f014..62c4e53 100644 --- a/Gemfile +++ b/Gemfile @@ -27,5 +27,5 @@ group :test do gem "rspec-mocks" gem "rspec_junit_formatter" gem "fog-core" - gem "chefstyle", "2.1.1" + gem "chefstyle", "2.2.2" end From 1a9229d977916bea2d69f723326a896b0d2899e9 Mon Sep 17 00:00:00 2001 From: nikhil2611 Date: Sun, 22 Oct 2023 23:37:03 +0530 Subject: [PATCH 6/9] updated rspec-mocks version Signed-off-by: nikhil2611 --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 62c4e53..6a9cd19 100644 --- a/Gemfile +++ b/Gemfile @@ -24,7 +24,7 @@ group :test do gem "knife" end gem "rspec-expectations" - gem "rspec-mocks" + gem "rspec-mocks", "3.9.0" gem "rspec_junit_formatter" gem "fog-core" gem "chefstyle", "2.2.2" From 194fab16cf50c5e473844722bee771f294d1216d Mon Sep 17 00:00:00 2001 From: nikhil2611 Date: Sun, 22 Oct 2023 23:43:49 +0530 Subject: [PATCH 7/9] rspec-mocks chefstyle fix Signed-off-by: nikhil2611 --- Gemfile | 2 +- lib/chef/knife/cloud/fog/service.rb | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index 6a9cd19..70f55d7 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ end group :test do gem "rake" - gem "rspec-core", '~> 3.9' + gem "rspec-core", "~> 3.9" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.7") gem "chef-zero", "~> 15" gem "chef", "~> 15" diff --git a/lib/chef/knife/cloud/fog/service.rb b/lib/chef/knife/cloud/fog/service.rb index c5e7d54..7429489 100644 --- a/lib/chef/knife/cloud/fog/service.rb +++ b/lib/chef/knife/cloud/fog/service.rb @@ -108,16 +108,16 @@ def delete_server(server_name) %w{servers images networks}.each do |resource_type| define_method("list_#{resource_type}") do - begin - case resource_type - when "networks" - network.method(resource_type).call.all - else - connection.method(resource_type).call.all - end - rescue Excon::Error::BadRequest => e - handle_excon_exception(CloudExceptions::CloudAPIException, e) + + case resource_type + when "networks" + network.method(resource_type).call.all + else + connection.method(resource_type).call.all end + rescue Excon::Error::BadRequest => e + handle_excon_exception(CloudExceptions::CloudAPIException, e) + end end From a392044359507cec2178614a261b64cb19592c4f Mon Sep 17 00:00:00 2001 From: nikhil2611 Date: Sun, 22 Oct 2023 23:45:01 +0530 Subject: [PATCH 8/9] added win image Signed-off-by: nikhil2611 --- .expeditor/verify.pipeline.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index c43eace..ca0a7bb 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify.pipeline.yml @@ -27,3 +27,4 @@ steps: executor: docker: host_os: windows + image: rubydistros/windows-2019:3.1 From 47d897afeabc68d76298d74300cef6bfe8f91459 Mon Sep 17 00:00:00 2001 From: nikhil2611 Date: Mon, 23 Oct 2023 11:51:04 +0530 Subject: [PATCH 9/9] updated Gemfile Signed-off-by: nikhil2611 --- Gemfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 70f55d7..452d8bf 100644 --- a/Gemfile +++ b/Gemfile @@ -15,12 +15,13 @@ group :test do if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.7") gem "chef-zero", "~> 15" gem "chef", "~> 15" - elsif Gem::Version.new(RUBY_VERSION) > Gem::Version.new("3.1") + elsif Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.1") gem "chef-zero", "~> 15" - gem "chef", "~> 18" + gem "chef", ">= 17.0" gem "knife" else - gem "chef", ">= 18.0" + gem "chef-zero", "~> 15" + gem "chef", "~> 18" gem "knife" end gem "rspec-expectations"