apache2-mod-proxy: use deps to handle dependencies (#9612)
* apache2-mod-proxy: use deps to handle dependencies * add changelog frag * fix errorspull/9618/head
parent
bf5c7f8be8
commit
f5cbf5acc7
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- apache2_mod_proxy - use ``deps`` to handle dependencies (https://github.com/ansible-collections/community.general/pull/9612).
|
|
@ -204,20 +204,14 @@ members:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import traceback
|
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
from ansible_collections.community.general.plugins.module_utils import deps
|
||||||
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.urls import fetch_url
|
from ansible.module_utils.urls import fetch_url
|
||||||
from ansible.module_utils.six import iteritems
|
from ansible.module_utils.six import iteritems
|
||||||
|
|
||||||
BEAUTIFUL_SOUP_IMP_ERR = None
|
with deps.declare("BeautifulSoup"):
|
||||||
try:
|
|
||||||
from BeautifulSoup import BeautifulSoup
|
from BeautifulSoup import BeautifulSoup
|
||||||
except ImportError:
|
|
||||||
BEAUTIFUL_SOUP_IMP_ERR = traceback.format_exc()
|
|
||||||
HAS_BEAUTIFULSOUP = False
|
|
||||||
else:
|
|
||||||
HAS_BEAUTIFULSOUP = True
|
|
||||||
|
|
||||||
# balancer member attributes extraction regexp:
|
# balancer member attributes extraction regexp:
|
||||||
EXPRESSION = re.compile(r"(b=([\w\.\-]+)&w=(https?|ajp|wss?|ftp|[sf]cgi)://([\w\.\-]+):?(\d*)([/\w\.\-]*)&?[\w\-\=]*)")
|
EXPRESSION = re.compile(r"(b=([\w\.\-]+)&w=(https?|ajp|wss?|ftp|[sf]cgi)://([\w\.\-]+):?(\d*)([/\w\.\-]*)&?[\w\-\=]*)")
|
||||||
|
@ -381,8 +375,7 @@ def main():
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
|
||||||
if HAS_BEAUTIFULSOUP is False:
|
deps.validate(module)
|
||||||
module.fail_json(msg=missing_required_lib('BeautifulSoup'), exception=BEAUTIFUL_SOUP_IMP_ERR)
|
|
||||||
|
|
||||||
if module.params['state'] is not None:
|
if module.params['state'] is not None:
|
||||||
states = module.params['state']
|
states = module.params['state']
|
||||||
|
|
Loading…
Reference in New Issue