Class: Kitchen::Pulumi::SystemAttrsResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/kitchen/pulumi/system_attrs_resolver.rb

Overview

SystemAttrsResolver is the class of objects which resolve for systems the attrs which are contained in outputs.

Instance Method Summary collapse

Instance Method Details

#resolve(attrs_outputs_keys:, attrs_outputs_values:, system:) ⇒ Object

resolve resolves the attrs.

Parameters:

  • attrs_outputs_keys (::Array<::String>)

    the names of the InSpec attributes.

  • attrs_outputs_values (::Array<::String>)

    the names of the Pulumi outputs.

  • system (::Kitchen::Pulumi::System)

    the system.

Raises:


20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/kitchen/pulumi/system_attrs_resolver.rb', line 20

def resolve(attrs_outputs_keys:, attrs_outputs_values:, system:)
  system.add_attrs(attrs: @inputs.merge(
    @outputs.merge(
      attrs_outputs_keys.lazy.map(&:to_s).zip(
        @outputs.fetch_values(*attrs_outputs_values),
      ).to_h,
    ),
  ))

  self
rescue ::KeyError => e
  raise ::Kitchen::Pulumi::Error, "Resolving attrs failed\n#{e}"
end