diff options
author | Peter Sprygada <psprygada@ansible.com> | 2016-09-09 09:34:12 -0400 |
---|---|---|
committer | Peter Sprygada <psprygada@ansible.com> | 2016-09-09 09:34:12 -0400 |
commit | 1dac6edbe4281a3d91087d0986a1458dc542b9c7 (patch) | |
tree | 167dce40ab0cfa3780d30d0ae10e021c428c90c0 | |
parent | 686d79a515970adaa7adbf2866556c2d99c5e4c8 (diff) | |
download | ansible-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.py | 4 |
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 ### |