Skip to content

Commit

Permalink
Use core's disconnect hook
Browse files Browse the repository at this point in the history
Support for disconnecting after an operation is now in the core, so
there is no need to copy-paste the whole with_provider_connection
function anymore.
  • Loading branch information
Tadej Borovšak committed Sep 14, 2018
1 parent d2e651e commit 9fabaec
Showing 1 changed file with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,10 @@ def ovirt_services(args = {})
end
end

def with_provider_connection(options = {})
raise "no block given" unless block_given?
_log.info("Connecting through #{self.class.name}: [#{name}]")
begin
connection = connect(options)
yield connection
ensure
begin
self.class.disconnect(connection)
rescue => error
_log.error("Error while disconnecting #{error}")
nil
end
end
def disconnect(connection)
self.class.disconnect(connection)
rescue StandardError => error
_log.error("Error while disconnecting #{error}")
end

def verify_credentials_for_rhevm(options = {})
Expand Down

0 comments on commit 9fabaec

Please sign in to comment.