minor update to catch expection if trying close a non existent session

This will prevent the junos shared module from throwing an exception if
the session is trying to be closed when it doesn't exist
This commit is contained in:
Peter Sprygada 2016-09-09 09:34:12 -04:00
parent 686d79a515
commit 1dac6edbe4

View file

@ -105,8 +105,10 @@ class Netconf(object):
self._connected = True self._connected = True
def disconnect(self): def disconnect(self):
if self.device: try:
self.device.close() self.device.close()
except AttributeError:
pass
self._connected = False self._connected = False
### Command methods ### ### Command methods ###