From ba99e44b423f64227b94e0f201c4c340a989dc11 Mon Sep 17 00:00:00 2001 From: n0trax Date: Sun, 1 Oct 2017 13:19:34 +0200 Subject: [PATCH] Catch AttributeError if regex is not found. (#30990) --- lib/ansible/modules/web_infrastructure/apache2_module.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/web_infrastructure/apache2_module.py b/lib/ansible/modules/web_infrastructure/apache2_module.py index 45b7b0a3853..5baa26dfe35 100644 --- a/lib/ansible/modules/web_infrastructure/apache2_module.py +++ b/lib/ansible/modules/web_infrastructure/apache2_module.py @@ -166,8 +166,11 @@ def create_apache_identifier(name): for search, reexpr in re_workarounds: if search in name: - rematch = re.search(reexpr, name) - return rematch.group(1) + '_module' + try: + rematch = re.search(reexpr, name) + return rematch.group(1) + '_module' + except AttributeError: + pass return name + '_module'