diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index ecaef1c..ca0a7bb 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 - 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..452d8bf 100644 --- a/Gemfile +++ b/Gemfile @@ -11,16 +11,22 @@ 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", ">= 17.0" + gem "knife" else - gem "chef", ">= 16.0" + gem "chef-zero", "~> 15" + gem "chef", "~> 18" + 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.1.1" + gem "chefstyle", "2.2.2" end 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 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