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.
-
#runtime_config_hash ⇒ Object
readonly
Returns the value of attribute runtime_config_hash.
Class Method Summary collapse
Instance Method Summary collapse
- #diff(other_manifest, redact) ⇒ Object
-
#initialize(manifest_hash, cloud_config_hash, runtime_config_hash) ⇒ Manifest
constructor
A new instance of Manifest.
- #resolve_aliases ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(manifest_hash, cloud_config_hash, runtime_config_hash) ⇒ Manifest
Returns a new instance of Manifest.
14 15 16 17 18 |
# File 'lib/bosh/director/manifest/manifest.rb', line 14 def initialize(manifest_hash, cloud_config_hash, runtime_config_hash) @manifest_hash = manifest_hash @cloud_config_hash = cloud_config_hash @runtime_config_hash = runtime_config_hash end |
Instance Attribute Details
#cloud_config_hash ⇒ Object (readonly)
Returns the value of attribute cloud_config_hash.
12 13 14 |
# File 'lib/bosh/director/manifest/manifest.rb', line 12 def cloud_config_hash @cloud_config_hash end |
#manifest_hash ⇒ Object (readonly)
Returns the value of attribute manifest_hash.
12 13 14 |
# File 'lib/bosh/director/manifest/manifest.rb', line 12 def manifest_hash @manifest_hash end |
#runtime_config_hash ⇒ Object (readonly)
Returns the value of attribute runtime_config_hash.
12 13 14 |
# File 'lib/bosh/director/manifest/manifest.rb', line 12 def runtime_config_hash @runtime_config_hash end |
Class Method Details
.load_from_text(manifest_text, cloud_config, runtime_config) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/bosh/director/manifest/manifest.rb', line 5 def self.load_from_text(manifest_text, cloud_config, runtime_config) cloud_config_hash = cloud_config.nil? ? nil : cloud_config.manifest runtime_config_hash = runtime_config.nil? ? nil : runtime_config.manifest manifest_hash = manifest_text.nil? ? {} : Psych.load(manifest_text) new(manifest_hash, cloud_config_hash, runtime_config_hash) end |
Instance Method Details
#diff(other_manifest, redact) ⇒ Object
35 36 37 |
# File 'lib/bosh/director/manifest/manifest.rb', line 35 def diff(other_manifest, redact) Changeset.new(to_hash, other_manifest.to_hash).diff(redact).order end |
#resolve_aliases ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/bosh/director/manifest/manifest.rb', line 20 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
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/bosh/director/manifest/manifest.rb', line 39 def to_hash hash = @manifest_hash.merge(@cloud_config_hash || {}) hash.merge(@runtime_config_hash || {}) do |key, old, new| if key == 'releases' if old && new old.to_set.merge(new.to_set).to_a else old.nil? ? new : old end else new end end end |