From 492d777ad7fdef4e634034bad73761b8817ffbef Mon Sep 17 00:00:00 2001 From: Pilou Date: Wed, 13 Dec 2017 14:54:38 +0100 Subject: [PATCH] imc_rest: fail when requirement is missing (#33750) --- lib/ansible/modules/remote_management/imc/imc_rest.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/ansible/modules/remote_management/imc/imc_rest.py b/lib/ansible/modules/remote_management/imc/imc_rest.py index c687848365b..128b6da1000 100644 --- a/lib/ansible/modules/remote_management/imc/imc_rest.py +++ b/lib/ansible/modules/remote_management/imc/imc_rest.py @@ -333,6 +333,12 @@ def main(): mutually_exclusive=[['content', 'path']], ) + if not HAS_LXML_ETREE: + module.fail_json(msg='module requires the lxml Python library installed on the managed host') + + if not HAS_XMLJSON_COBRA: + module.fail_json(msg='module requires the xmljson (>= 0.1.8) Python library installed on the managed host') + hostname = module.params['hostname'] username = module.params['username'] password = module.params['password']