summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Sprygada <psprygada@ansible.com>2016-09-09 09:34:12 -0400
committerPeter Sprygada <psprygada@ansible.com>2016-09-09 09:34:12 -0400
commit1dac6edbe4281a3d91087d0986a1458dc542b9c7 (patch)
tree167dce40ab0cfa3780d30d0ae10e021c428c90c0
parent686d79a515970adaa7adbf2866556c2d99c5e4c8 (diff)
downloadansible-1dac6edbe4281a3d91087d0986a1458dc542b9c7.tar.gz
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
-rw-r--r--lib/ansible/module_utils/junos.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/ansible/module_utils/junos.py b/lib/ansible/module_utils/junos.py
index 786e415c48..16f2057866 100644
--- a/lib/ansible/module_utils/junos.py
+++ b/lib/ansible/module_utils/junos.py
@@ -105,8 +105,10 @@ class Netconf(object):
self._connected = True
def disconnect(self):
- if self.device:
+ try:
self.device.close()
+ except AttributeError:
+ pass
self._connected = False
### Command methods ###