Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
### Changed
- Refactored models: Use `keep_lines` and `reject_lines` in aosw, arubainstant, asa, efos, firelinuxos, fsos, ironware, mlnxos and perle to (@robertcheramy)
- Refactor SSH and SCP into a common class SSHBase. Fixes #3597 (@robertcheramy)
- SSH#disconnect directly calls @ssh.close, as #close waits for the channels to be closed anyway. This might have side effects, please open an issue if you observe a regression. (@robertcheramy)
- Modified models to support store mode on significant changes: ios, fortios, perle (@robertcheramy)

### Fixed
Expand Down
15 changes: 15 additions & 0 deletions lib/oxidized/input/ssh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,21 @@ def pty_options(hash)

private

# We need a specific disconnect for SSH in shell mode, see issue #3725
def disconnect
disconnect_cli
# if disconnect does not disconnect us, give up after timeout
Timeout.timeout(@node.timeout) { @ssh.loop }
rescue Errno::ECONNRESET, Net::SSH::Disconnect, IOError => e
logger.debug 'The other side closed the connection while ' \
"disconnecting, raising #{e.class} with #{e.message}"
rescue Timeout::Error
logger.debug "#{@node.name} timed out while disconnecting"
ensure
@log.close if Oxidized.config.input.debug?
(@ssh.close rescue true) unless @ssh.closed? # rubocop:disable Style/RedundantParentheses
end

def shell_open(ssh)
@ses = ssh.open_channel do |ch|
ch.on_data do |_ch, data|
Expand Down
5 changes: 0 additions & 5 deletions spec/model/model_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,6 @@ def loop(*)
end
end

def close
# Wait for the channels
loop
end

def closed?
false
end
Expand Down