Class: Kitchen::Terraform::OutputsReader
- Inherits:
-
Object
- Object
- Kitchen::Terraform::OutputsReader
- Defined in:
- lib/kitchen/terraform/outputs_reader.rb
Overview
OutputsReader is the class of objects which read Terraform output variables.
Instance Method Summary collapse
-
#initialize(connection:) ⇒ Kitchen::Terraform::OutputsReader
constructor
#initialize prepares a new instance of the class.
-
#read(command:) {|json_outputs| ... } ⇒ self
#read reads the output variables.
Constructor Details
#initialize(connection:) ⇒ Kitchen::Terraform::OutputsReader
#initialize prepares a new instance of the class.
47 48 49 50 |
# File 'lib/kitchen/terraform/outputs_reader.rb', line 47 def initialize(connection:) self.connection = connection self.no_outputs_defined = /no\\ outputs\\ defined/ end |
Instance Method Details
#read(command:) {|json_outputs| ... } ⇒ self
#read reads the output variables.
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/kitchen/terraform/outputs_reader.rb', line 29 def read(command:) json_outputs = "{}" begin json_outputs = connection.execute command rescue ::Kitchen::StandardError => error no_outputs_defined.match ::Regexp.escape error.original.to_s or raise ::Kitchen::TransientFailure, error. end yield json_outputs: json_outputs self end |