Skip to content
This repository was archived by the owner on Oct 12, 2021. It is now read-only.

Commit 12f8a95

Browse files
author
caleb miles
committed
Pull availability zone information from BOSH job spec.
Falls back to reading zone property from deployment manifest. [#121080065] Signed-off-by: nino khodabandeh <ninok@hpe.com>
1 parent a8d10c8 commit 12f8a95

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

jobs/doppler/templates/doppler.json.erb

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
<% require 'json' %>
1+
<%
2+
3+
# try and set these properties from a BOSH 2.0 spec object
4+
job_name = spec.job
5+
instance_zone = spec.az
6+
if job_name.nil?
7+
job_name = name
8+
end
9+
10+
11+
if instance_zone.nil?
12+
instance_zone = p("doppler.zone")
13+
end
14+
15+
%>
216
{
317
"EtcdUrls": [<%= p("loggregator.etcd.machines").map{|addr| "\"http://#{addr}:4001\""}.join(",") %>],
418
"EtcdMaxConcurrentRequests": 10,
@@ -15,9 +29,9 @@
1529
},
1630
<% end %>
1731
"OutgoingPort": <%= p("doppler.outgoing_port") %>,
18-
"Zone": "<%= p("doppler.zone") %>",
19-
"JobName": "<%= name %>",
2032
"Index": <%= spec.index %>,
33+
"Zone": "<%= instance_zone %>",
34+
"JobName": "<%= job_name %>",
2135
"MaxRetainedLogMessages": <%= p("doppler.maxRetainedLogMessages") %>,
2236
"SharedSecret": "<%= p("doppler_endpoint.shared_secret") %>",
2337
"ContainerMetricTTLSeconds": <%= p("doppler.container_metric_ttl_seconds") %>,

jobs/metron_agent/templates/metron_agent.json.erb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,23 @@
55
end
66

77
useTLS = protocols.include? "tls"
8+
9+
10+
# try and set these properties from a BOSH 2.0 spec object
11+
job_name = spec.job
12+
instance_zone = spec.az
13+
if job_name.nil?
14+
job_name = name
15+
end
16+
if instance_zone.nil?
17+
instance_zone = p("metron_agent.zone")
18+
end
819
%>
920

1021
{
1122
"Index": <%= spec.index %>,
12-
"Job": "<%= name %>",
13-
"Zone": "<%= p("metron_agent.zone") %>",
23+
"Job": "<%= job_name %>",
24+
"Zone": "<%= instance_zone %>",
1425
"Deployment": "<%= p("metron_agent.deployment") %>",
1526

1627
"EtcdUrls": [<%= p("loggregator.etcd.machines").map{|addr| "\"http://#{addr}:4001\""}.join(",")%>],

0 commit comments

Comments
 (0)