1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Present clearer messages for connection error

This commit is contained in:
Hiroaki Nakamura 2016-05-12 23:27:53 +09:00 committed by Matt Clay
parent c538f4d7ca
commit ff985a03ae

View file

@ -117,6 +117,7 @@ except ImportError:
else:
HAS_PYLXD = True
from requests.exceptions import ConnectionError
# LXD_ANSIBLE_STATES is a map of states that contain values of methods used
# when a particular state is evoked.
@ -200,6 +201,8 @@ class LxdContainerManagement(object):
return self.client.containers.get(self.container_name)
except NameError:
return None
except ConnectionError:
self.module.fail_json(msg="Cannot connect to lxd server")
@staticmethod
def _container_to_module_state(container):