Class: Kitchen::Terraform::InSpecOptionsFactory
- Inherits:
-
Object
- Object
- Kitchen::Terraform::InSpecOptionsFactory
- Defined in:
- lib/kitchen/terraform/inspec_options_factory.rb
Overview
InSpecOptionsMapper is the class of objects which build Inspec options.
Class Method Summary collapse
-
.inputs_key ⇒ Symbol
#inputs_key provides a key for InSpec profile inputs which depends on the version of InSpec.
Instance Method Summary collapse
-
#build(attributes:, system_configuration_attributes:) ⇒ Hash
#build creates a mapping of InSpec options.
-
#initialize(outputs:) ⇒ Kitchen::Terraform::InSpecOptionsFactory
constructor
#initialize prepares a new instance of the class.
Constructor Details
#initialize(outputs:) ⇒ Kitchen::Terraform::InSpecOptionsFactory
#initialize prepares a new instance of the class.
58 59 60 61 62 |
# File 'lib/kitchen/terraform/inspec_options_factory.rb', line 58 def initialize(outputs:) self. = { "distinct_exit" => false } self.system_bastion_host_resolver = ::Kitchen::Terraform::SystemBastionHostResolver.new outputs: outputs self.system_inspec_map = ::Kitchen::Terraform::SYSTEM_INSPEC_MAP.dup end |
Class Method Details
.inputs_key ⇒ Symbol
#inputs_key provides a key for InSpec profile inputs which depends on the version of InSpec.
30 31 32 33 34 35 36 |
# File 'lib/kitchen/terraform/inspec_options_factory.rb', line 30 def inputs_key if ::Gem::Requirement.new("< 4.3.2").satisfied_by? ::Gem::Version.new ::Inspec::VERSION :attributes else :inputs end end |
Instance Method Details
#build(attributes:, system_configuration_attributes:) ⇒ Hash
#build creates a mapping of InSpec options. Most key-value pairs are derived from the configuration attributes of a system; some key-value pairs are hard-coded.
46 47 48 49 50 51 52 |
# File 'lib/kitchen/terraform/inspec_options_factory.rb', line 46 def build(attributes:, system_configuration_attributes:) map_system_to_inspec system_configuration_attributes: system_configuration_attributes .store self.class.inputs_key, attributes resolve_bastion_host system_configuration_attributes: system_configuration_attributes end |