Class: Kitchen::Terraform::VersionVerifier

Inherits:
Object
  • Object
show all
Defined in:
lib/kitchen/terraform/version_verifier.rb

Overview

VersionVerifier is the class of objects which verify a Terraform client version against a requirement.

Instance Method Summary collapse

Constructor Details

#initialize(version_requirement:) ⇒ Kitchen::Terraform::VersionVerifier

#initialize prepares a new instance of the class.

Parameters:

  • version_requirement (Gem::Requirement)

    the requirement for version support.



39
40
41
42
43
# File 'lib/kitchen/terraform/version_verifier.rb', line 39

def initialize(version_requirement:)
  self.version_verifier_strategy_factory = ::Kitchen::Terraform::VersionVerifierStrategyFactory.new(
    version_requirement: version_requirement,
  )
end

Instance Method Details

#verify(version:) ⇒ self

#verify verifies a version against the requirement.

Parameters:

  • version (Gem::Version)

    the Terraform client version.

Returns:

  • (self)

Raises:

  • (Kitchen::TransientFailure)

    if running the command fails.

  • (Kitchen::UserError)

    if the version is unsupported.



29
30
31
32
33
# File 'lib/kitchen/terraform/version_verifier.rb', line 29

def verify(version:)
  version_verifier_strategy_factory.build(version: version).call

  self
end