diff --git a/app/models/ext_management_system.rb b/app/models/ext_management_system.rb index f7c2322a32d7..ea48a457bae3 100644 --- a/app/models/ext_management_system.rb +++ b/app/models/ext_management_system.rb @@ -402,7 +402,13 @@ def emstype_description def with_provider_connection(options = {}) raise _("no block given") unless block_given? _log.info("Connecting through #{self.class.name}: [#{name}]") - yield connect(options) + connection = connect(options) + yield connection + ensure + disconnect(connection) if connection + end + + def disconnect(_connection) end def self.refresh_all_ems_timer