bosh-template 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bosh/template/evaluation_context.rb +42 -33
- data/lib/bosh/template/test/job.rb +3 -1
- data/lib/bosh/template/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85722b0330f29047967d4ca4720f426ae91bb189
|
4
|
+
data.tar.gz: 8e2c8efbda1cc38181caa059aeed914af9e633f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e98e351adac155ec9972e51b440680c19a3e4c703c270c2dfccd7ad597e5117fcabf8c2688a2bf08694d47d36155d6fd8e5f9a06e6b06f27beaf120b9281aa6
|
7
|
+
data.tar.gz: 8a4ad0c89aa5d22e7666ffc6a20a8aa066b01197855a1b89e8fb1b47b1f9a3f5fc7b81dcd85c9232342362735c534bd28792a121c2a335aaca4f5d5aba7bc4eb
|
@@ -95,34 +95,6 @@ module Bosh
|
|
95
95
|
raise UnknownProperty.new(names)
|
96
96
|
end
|
97
97
|
|
98
|
-
def link(name)
|
99
|
-
link_spec = lookup_property(@links, name)
|
100
|
-
raise UnknownLink.new(name) if link_spec.nil?
|
101
|
-
|
102
|
-
if link_spec.has_key?('instances')
|
103
|
-
link_instances = link_spec['instances'].map do |instance_link_spec|
|
104
|
-
EvaluationLinkInstance.new(instance_link_spec['name'], instance_link_spec['index'], instance_link_spec['id'], instance_link_spec['az'], instance_link_spec['address'], instance_link_spec['properties'], instance_link_spec['bootstrap'])
|
105
|
-
end
|
106
|
-
|
107
|
-
if link_spec.has_key?('address')
|
108
|
-
encoder_to_inject = ManualLinkDnsEncoder.new(link_spec['address'])
|
109
|
-
else
|
110
|
-
encoder_to_inject = @dns_encoder
|
111
|
-
end
|
112
|
-
|
113
|
-
return EvaluationLink.new(
|
114
|
-
link_instances,
|
115
|
-
link_spec['properties'],
|
116
|
-
link_spec['instance_group'],
|
117
|
-
link_spec['default_network'],
|
118
|
-
link_spec['deployment_name'],
|
119
|
-
link_spec['domain'],
|
120
|
-
encoder_to_inject,
|
121
|
-
)
|
122
|
-
end
|
123
|
-
raise UnknownLink.new(name)
|
124
|
-
end
|
125
|
-
|
126
98
|
# Run a block of code if all given properties are defined
|
127
99
|
# @param [Array<String>] names Property names
|
128
100
|
# @yield [Object] property values
|
@@ -137,6 +109,17 @@ module Bosh
|
|
137
109
|
InactiveElseBlock.new
|
138
110
|
end
|
139
111
|
|
112
|
+
def link(name)
|
113
|
+
link_spec = lookup_property(@links, name)
|
114
|
+
raise UnknownLink.new(name) if link_spec.nil?
|
115
|
+
|
116
|
+
if link_spec.has_key?('instances')
|
117
|
+
return create_evaluation_link(link_spec)
|
118
|
+
end
|
119
|
+
|
120
|
+
raise UnknownLink.new(name)
|
121
|
+
end
|
122
|
+
|
140
123
|
# Run a block of code if the link given exists
|
141
124
|
# @param [String] name of the link
|
142
125
|
# @yield [Object] link, which is an array of instances
|
@@ -145,17 +128,43 @@ module Bosh
|
|
145
128
|
if link_spec.nil? || !link_spec.has_key?('instances')
|
146
129
|
return ActiveElseBlock.new(self)
|
147
130
|
else
|
148
|
-
|
149
|
-
EvaluationLinkInstance.new(instance_link_spec['name'], instance_link_spec['index'], instance_link_spec['id'], instance_link_spec['az'], instance_link_spec['address'], instance_link_spec['properties'], instance_link_spec['bootstrap'])
|
150
|
-
end
|
151
|
-
|
152
|
-
yield EvaluationLink.new(link_instances, link_spec['properties'], link_spec['instance_group'], link_spec['default_network'], link_spec['deployment_name'], link_spec['root_domain'], @dns_encoder)
|
131
|
+
yield create_evaluation_link(link_spec)
|
153
132
|
InactiveElseBlock.new
|
154
133
|
end
|
155
134
|
end
|
156
135
|
|
157
136
|
private
|
158
137
|
|
138
|
+
def create_evaluation_link(link_spec)
|
139
|
+
link_instances = link_spec['instances'].map do |instance_link_spec|
|
140
|
+
EvaluationLinkInstance.new(
|
141
|
+
instance_link_spec['name'],
|
142
|
+
instance_link_spec['index'],
|
143
|
+
instance_link_spec['id'],
|
144
|
+
instance_link_spec['az'],
|
145
|
+
instance_link_spec['address'],
|
146
|
+
instance_link_spec['properties'],
|
147
|
+
instance_link_spec['bootstrap'],
|
148
|
+
)
|
149
|
+
end
|
150
|
+
|
151
|
+
if link_spec.has_key?('address')
|
152
|
+
encoder_to_inject = ManualLinkDnsEncoder.new(link_spec['address'])
|
153
|
+
else
|
154
|
+
encoder_to_inject = @dns_encoder
|
155
|
+
end
|
156
|
+
|
157
|
+
return EvaluationLink.new(
|
158
|
+
link_instances,
|
159
|
+
link_spec['properties'],
|
160
|
+
link_spec['instance_group'],
|
161
|
+
link_spec['default_network'],
|
162
|
+
link_spec['deployment_name'],
|
163
|
+
link_spec['domain'],
|
164
|
+
encoder_to_inject,
|
165
|
+
)
|
166
|
+
end
|
167
|
+
|
159
168
|
# @return [Object] Object representation where all hashes are unrolled
|
160
169
|
# into OpenStruct objects. This exists mostly for backward
|
161
170
|
# compatibility, as it doesn't provide good error reporting.
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
1
3
|
module Bosh::Template::Test
|
2
4
|
class Job
|
3
5
|
def initialize(release_path, name)
|
@@ -17,4 +19,4 @@ module Bosh::Template::Test
|
|
17
19
|
raise "Template for rendered path filename not found: #{rendered_file_name}. Possible values are: [#{@templates.values.join(', ')}]"
|
18
20
|
end
|
19
21
|
end
|
20
|
-
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh-template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pivotal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: semi_semantic
|
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
72
|
version: '0'
|
73
73
|
requirements: []
|
74
74
|
rubyforge_project:
|
75
|
-
rubygems_version: 2.
|
75
|
+
rubygems_version: 2.6.13
|
76
76
|
signing_key:
|
77
77
|
specification_version: 4
|
78
78
|
summary: Renders bosh templates
|