Skip to content
This repository was archived by the owner on Aug 29, 2018. It is now read-only.

Commit e77b165

Browse files
author
OpenShift Bot
authored
Merge pull request #6442 from Miciah/bug-1406251-routing-daemon-f5-try-harder-to-delete-client-ssl-profile
Merged by openshift-bot
2 parents 694c7e8 + c2c403f commit e77b165

File tree

2 files changed

+41
-8
lines changed

2 files changed

+41
-8
lines changed

routing-daemon/lib/openshift/routing/models/f5-icontrol-rest.rb

+20-8
Original file line numberDiff line numberDiff line change
@@ -370,17 +370,29 @@ def add_ssl pool_name, alias_str, ssl_cert, private_key
370370
end
371371

372372
def remove_ssl pool_name, alias_str
373-
@logger.debug("LTM removing #{URI.escape(alias_str)}-ssl-profile client-ssl from #{@https_vserver}")
374-
delete(resource: "/mgmt/tm/ltm/virtual/#{@https_vserver}/profiles/#{URI.escape(alias_str)}-ssl-profile")
373+
@exceptions = LBModelExceptionCollector.new
375374

376-
@logger.debug("LTM deleting removing #{URI.escape(alias_str)}-ssl-profile")
377-
delete(resource: "/mgmt/tm/ltm/profile/client-ssl/#{URI.escape(alias_str)}-ssl-profile")
375+
@exceptions.try do
376+
@logger.debug("LTM removing #{URI.escape(alias_str)}-ssl-profile client-ssl from #{@https_vserver}")
377+
delete(resource: "/mgmt/tm/ltm/virtual/#{@https_vserver}/profiles/#{URI.escape(alias_str)}-ssl-profile")
378+
end
379+
380+
@exceptions.try do
381+
@logger.debug("LTM deleting removing #{URI.escape(alias_str)}-ssl-profile")
382+
delete(resource: "/mgmt/tm/ltm/profile/client-ssl/#{URI.escape(alias_str)}-ssl-profile")
383+
end
378384

379-
@logger.debug("LTM removing #{alias_str}-https-key")
380-
delete(resource: "/mgmt/tm/sys/file/ssl-key/#{URI.escape(alias_str)}-https-key.key")
385+
@exceptions.try do
386+
@logger.debug("LTM removing #{alias_str}-https-key")
387+
delete(resource: "/mgmt/tm/sys/file/ssl-key/#{URI.escape(alias_str)}-https-key.key")
388+
end
389+
390+
@exceptions.try do
391+
@logger.debug("LTM removing #{alias_str}-https-cert")
392+
delete(resource: "/mgmt/tm/sys/file/ssl-cert/#{URI.escape(alias_str)}-https-cert.crt")
393+
end
381394

382-
@logger.debug("LTM removing #{alias_str}-https-cert")
383-
delete(resource: "/mgmt/tm/sys/file/ssl-cert/#{URI.escape(alias_str)}-https-cert.crt")
395+
@exceptions.done
384396
end
385397

386398
def get_pool_certificates pool_name

routing-daemon/lib/openshift/routing/models/load_balancer.rb

+21
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,27 @@ module OpenShift
22

33
class LBModelException < StandardError; end
44

5+
class LBModelExceptionCollector
6+
def initialize
7+
@exceptions = []
8+
end
9+
10+
def try
11+
yield
12+
rescue LBModelException => e
13+
@exceptions << e
14+
end
15+
16+
def to_s
17+
"got #{@exceptions.length} LBModelException exceptions: " +
18+
@exceptions.map {|e| e.message}.join('; ')
19+
end
20+
21+
def done
22+
raise LBModelException.new self.to_s unless @exceptions.empty?
23+
end
24+
end
25+
526
# == Abstract routing model class
627
#
728
# Presents direct access to a load balancer. This is an abstract class.

0 commit comments

Comments
 (0)