From 85871da03dbfaa6bfa32456c7a7aff0257adc4d2 Mon Sep 17 00:00:00 2001 From: Pilou Date: Fri, 15 Dec 2017 23:06:11 +0100 Subject: [PATCH] consul_acl: fix broken import (#33729) --- lib/ansible/modules/clustering/consul_acl.py | 10 +++++++++- test/sanity/import/skip.txt | 1 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/clustering/consul_acl.py b/lib/ansible/modules/clustering/consul_acl.py index 446e80ee27..0415d2a628 100644 --- a/lib/ansible/modules/clustering/consul_acl.py +++ b/lib/ansible/modules/clustering/consul_acl.py @@ -175,8 +175,13 @@ try: except ImportError: pyhcl_installed = False +try: + from requests.exceptions import ConnectionError + has_requests = True +except ImportError: + has_requests = False + from collections import defaultdict -from requests.exceptions import ConnectionError from ansible.module_utils.basic import to_text, AnsibleModule @@ -607,6 +612,9 @@ def check_dependencies(): raise ImportError("pyhcl required for this module. " "See: https://pypi.python.org/pypi/pyhcl") + if not has_requests: + raise ImportError("requests required for this module. See https://pypi.python.org/pypi/requests") + def main(): """ diff --git a/test/sanity/import/skip.txt b/test/sanity/import/skip.txt index ee33e58233..cc3f7a0978 100644 --- a/test/sanity/import/skip.txt +++ b/test/sanity/import/skip.txt @@ -11,7 +11,6 @@ lib/ansible/modules/cloud/webfaction/webfaction_db.py lib/ansible/modules/cloud/webfaction/webfaction_domain.py lib/ansible/modules/cloud/webfaction/webfaction_mailbox.py lib/ansible/modules/cloud/webfaction/webfaction_site.py -lib/ansible/modules/clustering/consul_acl.py lib/ansible/modules/network/cloudengine/ce_file_copy.py lib/ansible/modules/network/ios/ios_static_route.py lib/ansible/modules/network/lenovo/cnos_backup.py