Skip to content

Commit

Permalink
fix(eos): handle netmiko close (#1736)
Browse files Browse the repository at this point in the history
Resolves #1735
  • Loading branch information
bewing committed Aug 23, 2022
1 parent 029a38b commit d297056
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions napalm/eos/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
# third party libs
import pyeapi
from pyeapi.eapilib import ConnectionError, EapiConnection
from netmiko import ConfigInvalidException
from netmiko import BaseConnection, ConfigInvalidException

# NAPALM base
import napalm.base.helpers
Expand Down Expand Up @@ -231,7 +231,9 @@ def open(self):
def close(self):
"""Implementation of NAPALM method close."""
self.discard_config()
if hasattr(self.device.connection, "close") and callable(
if isinstance(self.device, BaseConnection):
self._netmiko_close()
elif hasattr(self.device.connection, "close") and callable(
self.device.connection.close
):
self.device.connection.close()
Expand Down

0 comments on commit d297056

Please sign in to comment.