class Kitchen::Terraform::InSpecFactory
InSpecFactory
is the class of objects which build InSpec
objects.
Attributes
fail_fast[RW]
hosts[RW]
Public Class Methods
new(fail_fast:, hosts:)
click to toggle source
initialize prepares a new instance of the class
@param fail_fast
[Boolean] a toggle for fail fast or fail slow behaviour. @param hosts [Array<String>] a list of hosts to verify with InSpec
. @return [Kitchen::Terraform::InSpecFactory]
# File lib/kitchen/terraform/inspec_factory.rb, line 58 def initialize(fail_fast:, hosts:) self.fail_fast = fail_fast self.hosts = hosts end
Public Instance Methods
build(options:, profile_locations:)
click to toggle source
build
creates a new instance of an InSpec
object.
@param options [Hash] a mapping of InSpec
options. @param profile_locations [Array<::String>] the locations of the InSpec
profiles which contain the controls to
be executed.
@return [Kitchen::Terraform::InSpec::WithoutHosts, Kitchen::Terraform::InSpec::FailFastWithHosts
,
Kitchen::Terraform::InSpec::FailFastWithoutHosts]
# File lib/kitchen/terraform/inspec_factory.rb, line 32 def build(options:, profile_locations:) if hosts.empty? ::Kitchen::Terraform::InSpec::WithoutHosts.new( options: options, profile_locations: profile_locations, ) elsif fail_fast ::Kitchen::Terraform::InSpec::FailFastWithHosts.new( hosts: hosts, options: options, profile_locations: profile_locations, ) else ::Kitchen::Terraform::InSpec::FailSlowWithHosts.new( hosts: hosts, options: options, profile_locations: profile_locations, ) end end