Class: Bosh::Director::Manifest
- Defined in:
- lib/bosh/director/manifest/manifest.rb
Instance Attribute Summary collapse
-
#cloud_config_hash ⇒ Object
readonly
Returns the value of attribute cloud_config_hash.
-
#manifest_hash ⇒ Object
readonly
Returns the value of attribute manifest_hash.
Class Method Summary collapse
Instance Method Summary collapse
- #diff(other_manifest) ⇒ Object
-
#initialize(manifest_hash, cloud_config_hash) ⇒ Manifest
constructor
A new instance of Manifest.
- #resolve_aliases ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(manifest_hash, cloud_config_hash) ⇒ Manifest
11 12 13 14 |
# File 'lib/bosh/director/manifest/manifest.rb', line 11 def initialize(manifest_hash, cloud_config_hash) @manifest_hash = manifest_hash @cloud_config_hash = cloud_config_hash end |
Instance Attribute Details
#cloud_config_hash ⇒ Object (readonly)
Returns the value of attribute cloud_config_hash.
9 10 11 |
# File 'lib/bosh/director/manifest/manifest.rb', line 9 def cloud_config_hash @cloud_config_hash end |
#manifest_hash ⇒ Object (readonly)
Returns the value of attribute manifest_hash.
9 10 11 |
# File 'lib/bosh/director/manifest/manifest.rb', line 9 def manifest_hash @manifest_hash end |
Class Method Details
.load_from_text(manifest_text, cloud_config) ⇒ Object
3 4 5 6 7 |
# File 'lib/bosh/director/manifest/manifest.rb', line 3 def self.load_from_text(manifest_text, cloud_config) cloud_config_hash = cloud_config.nil? ? nil : cloud_config.manifest manifest_hash = manifest_text.nil? ? {} : Psych.load(manifest_text) new(manifest_hash, cloud_config_hash) end |
Instance Method Details
#diff(other_manifest) ⇒ Object
31 32 33 |
# File 'lib/bosh/director/manifest/manifest.rb', line 31 def diff(other_manifest) Changeset.new(to_hash, other_manifest.to_hash).diff.order.redact_properties end |
#resolve_aliases ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/bosh/director/manifest/manifest.rb', line 16 def resolve_aliases hashed = to_hash hashed['resource_pools'].to_a.each do |rp| rp['stemcell']['version'] = resolve_stemcell_version(rp['stemcell']) end hashed['stemcells'].to_a.each do |stemcell| stemcell['version'] = resolve_stemcell_version(stemcell) end hashed['releases'].to_a.each do |release| release['version'] = resolve_release_version(release) end end |
#to_hash ⇒ Object
35 36 37 |
# File 'lib/bosh/director/manifest/manifest.rb', line 35 def to_hash @manifest_hash.merge(@cloud_config_hash || {}) end |