Class: Kitchen::Terraform::VerifyVersion
- Inherits:
-
Object
- Object
- Kitchen::Terraform::VerifyVersion
- Defined in:
- lib/kitchen/terraform/verify_version.rb
Overview
VerifyVersion is the class of objects which verify the version of the Terraform client against a version requirement.
Instance Method Summary collapse
-
#call(version:) ⇒ self
#call invokes the verification.
-
#initialize(config:, logger:, version_requirement:) ⇒ Kitchen::Terraform::VerifyVersion
constructor
#initialize prepares a new instance of the class.
Constructor Details
#initialize(config:, logger:, version_requirement:) ⇒ Kitchen::Terraform::VerifyVersion
#initialize prepares a new instance of the class.
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/kitchen/terraform/verify_version.rb', line 51 def initialize(config:, logger:, version_requirement:) self. = "Finished verifying the Terraform client version." self.logger = logger self.rescue_strategy = ::Kitchen::Terraform::VerifyVersionRescueStrategyFactory.new( verify_version: config.fetch(:verify_version), ).build logger: logger self. = "Verifying the Terraform client version is in the supported interval of " \ "#{version_requirement}..." self.version_verifier = ::Kitchen::Terraform::VersionVerifier.new version_requirement: version_requirement end |
Instance Method Details
#call(version:) ⇒ self
#call invokes the verification.
33 34 35 36 37 38 39 40 41 |
# File 'lib/kitchen/terraform/verify_version.rb', line 33 def call(version:) logger.warn version_verifier.verify version: version logger.warn rescue ::Kitchen::Terraform::UnsupportedClientVersionError rescue_strategy.call self end |