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

Commit

Permalink
Merge pull request #6442 from Miciah/bug-1406251-routing-daemon-f5-tr…
Browse files Browse the repository at this point in the history
…y-harder-to-delete-client-ssl-profile

Merged by openshift-bot
  • Loading branch information
OpenShift Bot authored Dec 20, 2016
2 parents 694c7e8 + c2c403f commit e77b165
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 8 deletions.
28 changes: 20 additions & 8 deletions routing-daemon/lib/openshift/routing/models/f5-icontrol-rest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -370,17 +370,29 @@ def add_ssl pool_name, alias_str, ssl_cert, private_key
end

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

@logger.debug("LTM deleting removing #{URI.escape(alias_str)}-ssl-profile")
delete(resource: "/mgmt/tm/ltm/profile/client-ssl/#{URI.escape(alias_str)}-ssl-profile")
@exceptions.try do
@logger.debug("LTM removing #{URI.escape(alias_str)}-ssl-profile client-ssl from #{@https_vserver}")
delete(resource: "/mgmt/tm/ltm/virtual/#{@https_vserver}/profiles/#{URI.escape(alias_str)}-ssl-profile")
end

@exceptions.try do
@logger.debug("LTM deleting removing #{URI.escape(alias_str)}-ssl-profile")
delete(resource: "/mgmt/tm/ltm/profile/client-ssl/#{URI.escape(alias_str)}-ssl-profile")
end

@logger.debug("LTM removing #{alias_str}-https-key")
delete(resource: "/mgmt/tm/sys/file/ssl-key/#{URI.escape(alias_str)}-https-key.key")
@exceptions.try do
@logger.debug("LTM removing #{alias_str}-https-key")
delete(resource: "/mgmt/tm/sys/file/ssl-key/#{URI.escape(alias_str)}-https-key.key")
end

@exceptions.try do
@logger.debug("LTM removing #{alias_str}-https-cert")
delete(resource: "/mgmt/tm/sys/file/ssl-cert/#{URI.escape(alias_str)}-https-cert.crt")
end

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

def get_pool_certificates pool_name
Expand Down
21 changes: 21 additions & 0 deletions routing-daemon/lib/openshift/routing/models/load_balancer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@ module OpenShift

class LBModelException < StandardError; end

class LBModelExceptionCollector
def initialize
@exceptions = []
end

def try
yield
rescue LBModelException => e
@exceptions << e
end

def to_s
"got #{@exceptions.length} LBModelException exceptions: " +
@exceptions.map {|e| e.message}.join('; ')
end

def done
raise LBModelException.new self.to_s unless @exceptions.empty?
end
end

# == Abstract routing model class
#
# Presents direct access to a load balancer. This is an abstract class.
Expand Down

0 comments on commit e77b165

Please sign in to comment.