diff options
author | ansibot <ansibot@users.noreply.github.com> | 2018-09-20 00:10:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-20 00:10:29 +0200 |
commit | 534de2df272a8a10c8c119b312b41b6ced6c8a86 (patch) | |
tree | 1fa0b15e93e5138177fb602081bc69bffafcba43 | |
parent | New module: Xfconf-based management of the Xfce 4 DE (#28112) (diff) | |
download | ansible-534de2df272a8a10c8c119b312b41b6ced6c8a86.tar.xz ansible-534de2df272a8a10c8c119b312b41b6ced6c8a86.zip |
Fixing but on version check when the "Apache/2.4.x (Distro)" regex is not met (#27457)
-rw-r--r-- | lib/ansible/modules/web_infrastructure/apache2_mod_proxy.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/ansible/modules/web_infrastructure/apache2_mod_proxy.py b/lib/ansible/modules/web_infrastructure/apache2_mod_proxy.py index 8ccebd8111..60dcf20e3c 100644 --- a/lib/ansible/modules/web_infrastructure/apache2_mod_proxy.py +++ b/lib/ansible/modules/web_infrastructure/apache2_mod_proxy.py @@ -201,7 +201,7 @@ else: # balancer member attributes extraction regexp: EXPRESSION = r"(b=([\w\.\-]+)&w=(https?|ajp|wss?|ftp|[sf]cgi)://([\w\.\-]+):?(\d*)([/\w\.\-]*)&?[\w\-\=]*)" # Apache2 server version extraction regexp: -APACHE_VERSION_EXPRESSION = r"Server Version: Apache/([\d.]+) \(([\w]+)\)" +APACHE_VERSION_EXPRESSION = r"SERVER VERSION: APACHE/([\d.]+)" def regexp_extraction(string, _regexp, groups=1): @@ -317,10 +317,13 @@ class Balancer(object): self.module.fail_json(msg="Could not get balancer page! HTTP status response: " + str(page[1]['status'])) else: content = page[0].read() - apache_version = regexp_extraction(content, APACHE_VERSION_EXPRESSION, 1) - if not re.search(pattern=r"2\.4\.[\d]*", string=apache_version): - self.module.fail_json(msg="This module only acts on an Apache2 2.4+ instance, current Apache2 version: " + str(apache_version)) - return content + apache_version = regexp_extraction(content.upper(), APACHE_VERSION_EXPRESSION, 1) + if apache_version: + if not re.search(pattern=r"2\.4\.[\d]*", string=apache_version): + self.module.fail_json(msg="This module only acts on an Apache2 2.4+ instance, current Apache2 version: " + str(apache_version)) + return content + else: + self.module.fail_json(msg="Could not get the Apache server version from the balancer-manager") def get_balancer_members(self): """ Returns members of the balancer as a generator object for later iteration.""" |