Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Drop Ruby 2.6 and Fix Transport Bugs (#501)
Browse files Browse the repository at this point in the history
* Clarify deprecated config messages

* Ensure deprecated_config is defined for doctor

* Fix "logical or" precedence

* Fix Ruby 2.6 bug

* Drop support for Ruby 2.6

---------

Co-authored-by: Aaron Lane <2400330-aaron-lane@users.noreply.gitlab.com>
  • Loading branch information
aaron-lane and Aaron Lane authored Mar 11, 2023
1 parent baa176c commit 8043771
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 15 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:
fail-fast: false
matrix:
ruby-version:
- '2.6'
- '2.7'
- '3.0'
- '3.1'
Expand Down Expand Up @@ -63,7 +62,6 @@ jobs:
fail-fast: false
matrix:
ruby-version:
- '2.6'
- '2.7'
- '3.0'
- '3.1'
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ and this project adheres to
- `command_timeout`
- `root_module_directory`
- Dropped support for Inspec < 4.25.1
- Dropped support for Ruby 2.6 which reach end of life on 2022-04-12.

## [6.1.0] - 2022-01-22

Expand Down
2 changes: 1 addition & 1 deletion gems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@

source "https://rubygems.org/"

ruby ">= 2.6"
ruby ">= 2.7"

gemspec
2 changes: 1 addition & 1 deletion kitchen-terraform.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ require "rubygems"
specification.add_runtime_dependency "test-kitchen", ">= 2.1", "< 4.0"
specification.add_runtime_dependency "tty-which", "~> 0.5.0"
specification.cert_chain = ["certs/gem-public_cert.pem"]
specification.required_ruby_version = [">= 2.6", "< 4.0"]
specification.required_ruby_version = [">= 2.7", "< 4.0"]
specification.requirements = ["Terraform >= v0.11.4, < v2.0.0"]
specification.signing_key = "certs/gem-private_key.pem" if $PROGRAM_NAME =~ /gem\z/
end
16 changes: 6 additions & 10 deletions lib/kitchen/driver/terraform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,12 @@ class Terraform < ::Kitchen::Driver::Base
include ::Kitchen::Terraform::ConfigAttribute::BackendConfigurations

include ::Kitchen::Terraform::ConfigAttribute::Client
deprecate_config_for :client, "driver.client is deprecated; use transport.client instead"
deprecate_config_for :client, "use transport.client instead"

include ::Kitchen::Terraform::ConfigAttribute::Color

include ::Kitchen::Terraform::ConfigAttribute::CommandTimeout
deprecate_config_for(
:command_timeout,
"driver.command_timeout is deprecated; use transport.command_timeout instead"
)
deprecate_config_for :command_timeout, "use transport.command_timeout instead"

include ::Kitchen::Terraform::ConfigAttribute::Lock

Expand All @@ -171,10 +168,7 @@ class Terraform < ::Kitchen::Driver::Base
include ::Kitchen::Terraform::ConfigAttribute::PluginDirectory

include ::Kitchen::Terraform::ConfigAttribute::RootModuleDirectory
deprecate_config_for(
:root_module_directory,
"driver.root_module_directory is deprecated; use transport.root_module_directory instead"
)
deprecate_config_for :root_module_directory, "use transport.root_module_directory instead"

include ::Kitchen::Terraform::ConfigAttribute::VariableFiles

Expand Down Expand Up @@ -254,6 +248,8 @@ def doctor(state)
def finalize_config!(instance)
super

self.deprecated_config ||= {}

transport = instance.transport

self.transport = if ::Kitchen::Transport::Terraform == transport.class
Expand All @@ -276,7 +272,7 @@ def initialize(config = {})

private

attr_accessor :action_failed
attr_accessor :action_failed, :deprecated_config
attr_writer :transport
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/kitchen/terraform/transport/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def init_options(options)

self.client = options.delete :client
self.command_timeout = options.delete :command_timeout
self.environment = options.delete(:environment) or {}
self.environment = options.delete(:environment) || {}
self.root_module_directory = options.delete :root_module_directory
end
end
Expand Down

0 comments on commit 8043771

Please sign in to comment.