Pep8 fixes for apache2 module (#24185)

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/24204/head
Abhijeet Kasurde 8 years ago committed by René Moser
parent 4e4fc9cb4c
commit 9d9e9a79e2

@ -219,6 +219,7 @@ EXPRESSION = r"(b=([\w\.\-]+)&w=(https?|ajp|wss?|ftp|[sf]cgi)://([\w\.\-]+):?(\d
# Apache2 server version extraction regexp: # Apache2 server version extraction regexp:
APACHE_VERSION_EXPRESSION = r"Server Version: Apache/([\d.]+) \(([\w]+)\)" APACHE_VERSION_EXPRESSION = r"Server Version: Apache/([\d.]+) \(([\w]+)\)"
def regexp_extraction(string, _regexp, groups=1): def regexp_extraction(string, _regexp, groups=1):
""" Returns the capture group (default=1) specified in the regexp, applied to the string """ """ Returns the capture group (default=1) specified in the regexp, applied to the string """
regexp_search = re.search(string=str(string), pattern=str(_regexp)) regexp_search = re.search(string=str(string), pattern=str(_regexp))
@ -227,6 +228,7 @@ def regexp_extraction(string, _regexp, groups=1):
return str(regexp_search.group(groups)) return str(regexp_search.group(groups))
return None return None
class BalancerMember(object): class BalancerMember(object):
""" Apache 2.4 mod_proxy LB balancer member. """ Apache 2.4 mod_proxy LB balancer member.
attributes: attributes:
@ -315,6 +317,7 @@ class BalancerMember(object):
class Balancer(object): class Balancer(object):
""" Apache httpd 2.4 mod_proxy balancer object""" """ Apache httpd 2.4 mod_proxy balancer object"""
def __init__(self, host, suffix, module, members=None, tls=False): def __init__(self, host, suffix, module, members=None, tls=False):
if tls: if tls:
self.base_url = str(str('https://') + str(host)) self.base_url = str(str('https://') + str(host))
@ -359,6 +362,7 @@ class Balancer(object):
members = property(get_balancer_members) members = property(get_balancer_members)
def main(): def main():
""" Initiates module.""" """ Initiates module."""
module = AnsibleModule( module = AnsibleModule(

@ -104,6 +104,7 @@ stderr:
import re import re
def _run_threaded(module): def _run_threaded(module):
control_binary = _get_ctl_binary(module) control_binary = _get_ctl_binary(module)
@ -111,6 +112,7 @@ def _run_threaded(module):
return bool(re.search(r'threaded:[ ]*yes', stdout)) return bool(re.search(r'threaded:[ ]*yes', stdout))
def _get_ctl_binary(module): def _get_ctl_binary(module):
for command in ['apache2ctl', 'apachectl']: for command in ['apache2ctl', 'apachectl']:
ctl_binary = module.get_bin_path(command) ctl_binary = module.get_bin_path(command)
@ -122,6 +124,7 @@ def _get_ctl_binary(module):
" At least one apache control binary is necessary." " At least one apache control binary is necessary."
) )
def _module_is_enabled(module): def _module_is_enabled(module):
control_binary = _get_ctl_binary(module) control_binary = _get_ctl_binary(module)
name = module.params['name'] name = module.params['name']
@ -146,6 +149,7 @@ def _module_is_enabled(module):
searchstring = ' ' + create_apache_identifier(name) searchstring = ' ' + create_apache_identifier(name)
return searchstring in stdout return searchstring in stdout
def create_apache_identifier(name): def create_apache_identifier(name):
""" """
By convention if a module is loaded via name, it appears in apache2ctl -M as By convention if a module is loaded via name, it appears in apache2ctl -M as
@ -215,6 +219,7 @@ def _set_state(module, state):
result=success_msg, result=success_msg,
warnings=module.warnings) warnings=module.warnings)
def main(): def main():
module = AnsibleModule( module = AnsibleModule(
argument_spec=dict( argument_spec=dict(

@ -770,8 +770,6 @@ lib/ansible/modules/web_infrastructure/ansible_tower/tower_project.py
lib/ansible/modules/web_infrastructure/ansible_tower/tower_role.py lib/ansible/modules/web_infrastructure/ansible_tower/tower_role.py
lib/ansible/modules/web_infrastructure/ansible_tower/tower_team.py lib/ansible/modules/web_infrastructure/ansible_tower/tower_team.py
lib/ansible/modules/web_infrastructure/ansible_tower/tower_user.py lib/ansible/modules/web_infrastructure/ansible_tower/tower_user.py
lib/ansible/modules/web_infrastructure/apache2_mod_proxy.py
lib/ansible/modules/web_infrastructure/apache2_module.py
lib/ansible/modules/web_infrastructure/deploy_helper.py lib/ansible/modules/web_infrastructure/deploy_helper.py
lib/ansible/modules/web_infrastructure/django_manage.py lib/ansible/modules/web_infrastructure/django_manage.py
lib/ansible/modules/web_infrastructure/ejabberd_user.py lib/ansible/modules/web_infrastructure/ejabberd_user.py

Loading…
Cancel
Save