Class: Vcloud::Launcher::Preamble
- Inherits:
-
Object
- Object
- Vcloud::Launcher::Preamble
- Defined in:
- lib/vcloud/launcher/preamble.rb
Defined Under Namespace
Classes: MissingConfigurationError, MissingTemplateError
Instance Attribute Summary collapse
-
#preamble_vars ⇒ Object
readonly
Returns the value of attribute preamble_vars.
-
#script_path ⇒ Object
readonly
Returns the value of attribute script_path.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(vapp_name, vm_config) ⇒ Preamble
constructor
A new instance of Preamble.
- #interpolated_preamble ⇒ Object
Constructor Details
#initialize(vapp_name, vm_config) ⇒ Preamble
Returns a new instance of Preamble.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/vcloud/launcher/preamble.rb', line 11 def initialize(vapp_name, vm_config) @vapp_name = vapp_name bootstrap_config = vm_config[:bootstrap] raise MissingConfigurationError if bootstrap_config.nil? @script_path = bootstrap_config.fetch(:script_path, nil) raise MissingTemplateError unless @script_path # Missing vars is acceptable - noop template. @preamble_vars = bootstrap_config.fetch(:vars, {}) extra_disks = vm_config.fetch(:extra_disks, {}) @preamble_vars.merge!(extra_disks: extra_disks) @script_post_processor = bootstrap_config.fetch(:script_post_processor, nil) end |
Instance Attribute Details
#preamble_vars ⇒ Object (readonly)
Returns the value of attribute preamble_vars.
9 10 11 |
# File 'lib/vcloud/launcher/preamble.rb', line 9 def preamble_vars @preamble_vars end |
#script_path ⇒ Object (readonly)
Returns the value of attribute script_path.
9 10 11 |
# File 'lib/vcloud/launcher/preamble.rb', line 9 def script_path @script_path end |
Instance Method Details
#generate ⇒ Object
29 30 31 |
# File 'lib/vcloud/launcher/preamble.rb', line 29 def generate @script_post_processor ? post_process_erb_output : interpolated_preamble end |
#interpolated_preamble ⇒ Object
33 34 35 |
# File 'lib/vcloud/launcher/preamble.rb', line 33 def interpolated_preamble @interpolated_preamble = interpolate_erb_file end |