Class: Bosh::Director::DeploymentPlan::TemplateSpec
- Defined in:
- lib/bosh/director/deployment_plan/instance_spec.rb
Instance Method Summary collapse
-
#initialize(full_spec) ⇒ TemplateSpec
constructor
A new instance of TemplateSpec.
- #spec ⇒ Object
Constructor Details
#initialize(full_spec) ⇒ TemplateSpec
Returns a new instance of TemplateSpec.
100 101 102 103 |
# File 'lib/bosh/director/deployment_plan/instance_spec.rb', line 100 def initialize(full_spec) @full_spec = full_spec @dns_manager = DnsManagerProvider.create end |
Instance Method Details
#spec ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/bosh/director/deployment_plan/instance_spec.rb', line 105 def spec keys = [ 'deployment', 'job', 'index', 'bootstrap', 'name', 'id', 'az', 'networks', 'properties', 'properties_need_filtering', 'dns_domain_name', 'links', 'persistent_disk', 'address' ] template_hash = @full_spec.select {|k,v| keys.include?(k) } networks_hash = template_hash['networks'] modified_networks_hash = networks_hash.each_pair do |network_name, network_settings| if @full_spec['job'] != nil settings_with_dns = network_settings.merge({'dns_record_name' => @dns_manager.dns_record_name(@full_spec['index'], @full_spec['job']['name'], network_name, @full_spec['deployment'])}) networks_hash[network_name] = settings_with_dns end if network_settings['type'] == 'dynamic' # Templates may get rendered before we know dynamic IPs from the Agent. # Use valid IPs so that templates don't have to write conditionals around nil values. networks_hash[network_name]['ip'] ||= '127.0.0.1' networks_hash[network_name]['netmask'] ||= '127.0.0.1' networks_hash[network_name]['gateway'] ||= '127.0.0.1' end end template_hash.merge({ 'resource_pool' => @full_spec['vm_type']['name'], 'networks' => modified_networks_hash }) end |