Module: StackMaster::SparkleFormation::UserDataFile

Defined in:
lib/stack_master/sparkle_formation/user_data_file.rb

Instance Method Summary collapse

Instance Method Details

#_user_data_file(file_name, vars = {}) ⇒ Object Also known as: user_data_file!



80
81
82
83
84
85
86
87
88
# File 'lib/stack_master/sparkle_formation/user_data_file.rb', line 80

def _user_data_file(file_name, vars = {})
  file_path = File.join(::SparkleFormation.sparkle_path, 'user_data', file_name)
  template = File.read(file_path)
  template_context = TemplateContext.build(vars)
  compiled_template = SfEruby.new(template).evaluate(template_context)
  base64!(join!(CloudFormationLineFormatter.format(compiled_template)))
rescue Errno::ENOENT => e
  Kernel.raise UserDataFileNotFound, "Could not find user data file at path: #{file_path}"
end