Skip to content

Commit 33d7efb

Browse files
committed
Adjust route options behaviour for manifest push
Overwrite behaviour for route options is now fixed and tested: Existing options are not modified if options is nil, {} or not provided A single option (e.g. loadbalancing-algorithm) can be removed by setting its value to nil
1 parent d5e369c commit 33d7efb

File tree

3 files changed

+202
-93
lines changed

3 files changed

+202
-93
lines changed

app/actions/route_update.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ def update(route:, message:)
44
Route.db.transaction do
55
if message.requested?(:options)
66
route.options = if message.options.nil?
7-
nil
7+
route.options
88
elsif route.options.nil?
99
message.options
1010
else
1111
route.options.merge(message.options)
1212
end
1313
end
14+
15+
# remove nil values from options
16+
route.options = route.options.compact if route.options
17+
1418
route.save
1519
MetadataUpdate.update(route, message)
1620
end

lib/cloud_controller/app_manifest/manifest_route.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def self.parse(route, options=nil)
1919

2020
if options
2121
attrs[:options] = {}
22-
attrs[:options][:lb_algo] = options[:'loadbalancing-algorithm'] if options[:'loadbalancing-algorithm']
22+
attrs[:options][:lb_algo] = options[:'loadbalancing-algorithm'] if options.key?(:'loadbalancing-algorithm')
2323
end
2424

2525
ManifestRoute.new(attrs)

0 commit comments

Comments
 (0)