Class: Bosh::Director::RenderedJobInstanceHasher
- Defined in:
- lib/bosh/director/rendered_job_instance_hasher.rb
Instance Method Summary collapse
- #configuration_hash ⇒ Object
-
#initialize(job_templates) ⇒ RenderedJobInstanceHasher
constructor
A new instance of RenderedJobInstanceHasher.
- #template_hashes ⇒ Object
Constructor Details
#initialize(job_templates) ⇒ RenderedJobInstanceHasher
Returns a new instance of RenderedJobInstanceHasher.
3 4 5 |
# File 'lib/bosh/director/rendered_job_instance_hasher.rb', line 3 def initialize(job_templates) @job_templates = job_templates end |
Instance Method Details
#configuration_hash ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/bosh/director/rendered_job_instance_hasher.rb', line 7 def configuration_hash instance_digest = Digest::SHA1.new job_templates.sort { |x, y| x.name <=> y.name }.each do |rendered_job_template| bound_templates = '' bound_templates << rendered_job_template.monit rendered_job_template.templates.sort { |x, y| x.src_name <=> y.src_name }.each do |template_file| bound_templates << template_file.contents instance_digest << bound_templates end end instance_digest.hexdigest end |
#template_hashes ⇒ Object
22 23 24 25 26 |
# File 'lib/bosh/director/rendered_job_instance_hasher.rb', line 22 def template_hashes job_templates.reduce({}) do |h, rendered_job_template| h.merge(rendered_job_template.name => rendered_job_template.template_hash) end end |