Class: Bosh::Director::Core::Templates::JobInstanceRenderer
- Inherits:
-
Object
- Object
- Bosh::Director::Core::Templates::JobInstanceRenderer
- Defined in:
- lib/bosh/director/core/templates/job_instance_renderer.rb
Instance Method Summary collapse
-
#initialize(templates, job_template_loader) ⇒ JobInstanceRenderer
constructor
A new instance of JobInstanceRenderer.
- #render(spec) ⇒ Object
Constructor Details
#initialize(templates, job_template_loader) ⇒ JobInstanceRenderer
Returns a new instance of JobInstanceRenderer.
6 7 8 9 |
# File 'lib/bosh/director/core/templates/job_instance_renderer.rb', line 6 def initialize(templates, job_template_loader) @templates = templates @job_template_loader = job_template_loader end |
Instance Method Details
#render(spec) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/bosh/director/core/templates/job_instance_renderer.rb', line 11 def render(spec) errors = [] rendered_templates = @templates.map do |template| job_template_renderer = job_template_renderers[template.name] begin job_template_renderer.render(spec) rescue Exception => e errors.push e end end if errors.length > 0 = "Unable to render jobs for instance group '#{spec['job']['name']}'. Errors are:" errors.each do |e| = "#{}\n - #{e..gsub(/\n/, "\n ")}" end raise end RenderedJobInstance.new(rendered_templates) end |