Class: Bosh::Director::DeploymentPlan::Template
- Defined in:
- lib/bosh/director/deployment_plan/template.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#package_models ⇒ Object
readonly
Returns the value of attribute package_models.
-
#release ⇒ Object
readonly
Returns the value of attribute release.
Instance Method Summary collapse
- #bind_existing_model(model) ⇒ Object
-
#bind_models ⇒ void
Looks up template model and its package models in DB.
- #blobstore_id ⇒ String
-
#download_blob ⇒ String
Downloads template blob to a given path.
-
#initialize(release, name) ⇒ Template
constructor
A new instance of Template.
- #logs ⇒ Array
- #properties ⇒ Hash
-
#provided_links ⇒ Object
return [Array].
-
#required_links ⇒ Object
return [Array].
- #sha1 ⇒ String
- #version ⇒ String
Constructor Details
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
8 9 10 |
# File 'lib/bosh/director/deployment_plan/template.rb', line 8 def model @model end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/bosh/director/deployment_plan/template.rb', line 5 def name @name end |
#package_models ⇒ Object (readonly)
Returns the value of attribute package_models.
9 10 11 |
# File 'lib/bosh/director/deployment_plan/template.rb', line 9 def package_models @package_models end |
#release ⇒ Object (readonly)
Returns the value of attribute release.
6 7 8 |
# File 'lib/bosh/director/deployment_plan/template.rb', line 6 def release @release end |
Instance Method Details
#bind_existing_model(model) ⇒ Object
35 36 37 |
# File 'lib/bosh/director/deployment_plan/template.rb', line 35 def bind_existing_model(model) @model = model end |
#bind_models ⇒ void
This method returns an undefined value.
Looks up template model and its package models in DB
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/bosh/director/deployment_plan/template.rb', line 23 def bind_models @model = @release.get_template_model_by_name(@name) if @model.nil? raise DeploymentUnknownTemplate, "Can't find template `#{@name}'" end @package_models = @model.package_names.map do |name| @release.get_package_model_by_name(name) end end |
#blobstore_id ⇒ String
69 70 71 |
# File 'lib/bosh/director/deployment_plan/template.rb', line 69 def blobstore_id present_model.blobstore_id end |
#download_blob ⇒ String
Downloads template blob to a given path
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/bosh/director/deployment_plan/template.rb', line 41 def download_blob uuid = SecureRandom.uuid path = File.join(Dir.tmpdir, "template-#{uuid}") @logger.debug("Downloading template `#{@name}' (#{blobstore_id})...") t1 = Time.now File.open(path, "w") do |f| App.instance.blobstores.blobstore.get(blobstore_id, f) end @logger.debug("Template `#{@name}' downloaded to #{path} " + "(took #{Time.now - t1}s)") path end |
#logs ⇒ Array
74 75 76 |
# File 'lib/bosh/director/deployment_plan/template.rb', line 74 def logs present_model.logs end |
#properties ⇒ Hash
79 80 81 |
# File 'lib/bosh/director/deployment_plan/template.rb', line 79 def properties present_model.properties end |
#provided_links ⇒ Object
return [Array]
89 90 91 |
# File 'lib/bosh/director/deployment_plan/template.rb', line 89 def provided_links present_model.provides.to_a.map { |l| TemplateLink.parse(l) } end |
#required_links ⇒ Object
return [Array]
84 85 86 |
# File 'lib/bosh/director/deployment_plan/template.rb', line 84 def required_links present_model.requires.to_a.map { |l| TemplateLink.parse(l) } end |
#sha1 ⇒ String
64 65 66 |
# File 'lib/bosh/director/deployment_plan/template.rb', line 64 def sha1 present_model.sha1 end |
#version ⇒ String
59 60 61 |
# File 'lib/bosh/director/deployment_plan/template.rb', line 59 def version present_model.version end |