Skip to content

Commit

Permalink
Adjust route options behaviour for manifest push
Browse files Browse the repository at this point in the history
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
  • Loading branch information
a18e committed Nov 19, 2024
1 parent d5e369c commit 33d7efb
Show file tree
Hide file tree
Showing 3 changed files with 202 additions and 93 deletions.
6 changes: 5 additions & 1 deletion app/actions/route_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ def update(route:, message:)
Route.db.transaction do
if message.requested?(:options)
route.options = if message.options.nil?
nil
route.options
elsif route.options.nil?
message.options
else
route.options.merge(message.options)
end
end

# remove nil values from options
route.options = route.options.compact if route.options

route.save
MetadataUpdate.update(route, message)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/cloud_controller/app_manifest/manifest_route.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def self.parse(route, options=nil)

if options
attrs[:options] = {}
attrs[:options][:lb_algo] = options[:'loadbalancing-algorithm'] if options[:'loadbalancing-algorithm']
attrs[:options][:lb_algo] = options[:'loadbalancing-algorithm'] if options.key?(:'loadbalancing-algorithm')
end

ManifestRoute.new(attrs)
Expand Down
Loading

0 comments on commit 33d7efb

Please sign in to comment.