From 1ed8ed766cfb4e5301ac39f5f8025e973fc41b52 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Tue, 9 Apr 2019 14:06:53 +0530 Subject: [PATCH] hpilo: Handle connection error in hpilo_facts (#53952) Signed-off-by: Abhijeet Kasurde --- lib/ansible/modules/remote_management/hpilo/hpilo_facts.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/remote_management/hpilo/hpilo_facts.py b/lib/ansible/modules/remote_management/hpilo/hpilo_facts.py index 64c3f0227a..cbc520ebb7 100644 --- a/lib/ansible/modules/remote_management/hpilo/hpilo_facts.py +++ b/lib/ansible/modules/remote_management/hpilo/hpilo_facts.py @@ -132,6 +132,7 @@ except ImportError: HAS_HPILO = False from ansible.module_utils.basic import AnsibleModule, missing_required_lib +from ansible.module_utils._text import to_native # Suppress warnings from hpilo @@ -178,7 +179,11 @@ def main(): } # TODO: Count number of CPUs, DIMMs and total memory - data = ilo.get_host_data() + try: + data = ilo.get_host_data() + except hpilo.IloCommunicationError as e: + module.fail_json(msg=to_native(e)) + for entry in data: if 'type' not in entry: continue