Pep8 fixes for ha_proxy module (#24090)

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/24118/head
Abhijeet Kasurde 8 years ago committed by Matt Martz
parent 3d4523f231
commit ca7616b4a1

@ -187,10 +187,12 @@ ACTION_CHOICES = ['enabled', 'disabled']
WAIT_RETRIES = 25 WAIT_RETRIES = 25
WAIT_INTERVAL = 5 WAIT_INTERVAL = 5
###################################################################### ######################################################################
class TimeoutException(Exception): class TimeoutException(Exception):
pass pass
class HAProxy(object): class HAProxy(object):
""" """
Used for communicating with HAProxy through its local UNIX socket interface. Used for communicating with HAProxy through its local UNIX socket interface.
@ -237,7 +239,6 @@ class HAProxy(object):
self.client.close() self.client.close()
return result return result
def capture_command_output(self, cmd, output): def capture_command_output(self, cmd, output):
""" """
Capture the output for a command Capture the output for a command
@ -249,7 +250,6 @@ class HAProxy(object):
self.command_results['output'] = [] self.command_results['output'] = []
self.command_results['output'].append(output) self.command_results['output'].append(output)
def discover_all_backends(self): def discover_all_backends(self):
""" """
Discover all entries with svname = 'BACKEND' and return a list of their corresponding Discover all entries with svname = 'BACKEND' and return a list of their corresponding
@ -259,7 +259,6 @@ class HAProxy(object):
r = csv.DictReader(data.splitlines()) r = csv.DictReader(data.splitlines())
return tuple(map(lambda d: d['pxname'], filter(lambda d: d['svname'] == 'BACKEND', r))) return tuple(map(lambda d: d['pxname'], filter(lambda d: d['svname'] == 'BACKEND', r)))
def execute_for_backends(self, cmd, pxname, svname, wait_for_status=None): def execute_for_backends(self, cmd, pxname, svname, wait_for_status=None):
""" """
Run some command on the specified backends. If no backends are provided they will Run some command on the specified backends. If no backends are provided they will
@ -282,7 +281,6 @@ class HAProxy(object):
if self.wait: if self.wait:
self.wait_until_status(backend, svname, wait_for_status) self.wait_until_status(backend, svname, wait_for_status)
def get_state_for(self, pxname, svname): def get_state_for(self, pxname, svname):
""" """
Find the state of specific services. When pxname is not set, get all backends for a specific host. Find the state of specific services. When pxname is not set, get all backends for a specific host.
@ -298,7 +296,6 @@ class HAProxy(object):
) )
return state or None return state or None
def wait_until_status(self, pxname, svname, status): def wait_until_status(self, pxname, svname, status):
""" """
Wait for a service to reach the specified status. Try RETRIES times Wait for a service to reach the specified status. Try RETRIES times
@ -317,7 +314,6 @@ class HAProxy(object):
self.module.fail_json(msg="server %s/%s not status '%s' after %d retries. Aborting." % (pxname, svname, status, self.wait_retries)) self.module.fail_json(msg="server %s/%s not status '%s' after %d retries. Aborting." % (pxname, svname, status, self.wait_retries))
def enabled(self, host, backend, weight): def enabled(self, host, backend, weight):
""" """
Enabled action, marks server to UP and checks are re-enabled, Enabled action, marks server to UP and checks are re-enabled,
@ -329,7 +325,6 @@ class HAProxy(object):
cmd += "; set weight $pxname/$svname %s" % weight cmd += "; set weight $pxname/$svname %s" % weight
self.execute_for_backends(cmd, backend, host, 'UP') self.execute_for_backends(cmd, backend, host, 'UP')
def disabled(self, host, backend, shutdown_sessions): def disabled(self, host, backend, shutdown_sessions):
""" """
Disabled action, marks server to DOWN for maintenance. In this mode, no more checks will be Disabled action, marks server to DOWN for maintenance. In this mode, no more checks will be
@ -341,7 +336,6 @@ class HAProxy(object):
cmd += "; shutdown sessions server $pxname/$svname" cmd += "; shutdown sessions server $pxname/$svname"
self.execute_for_backends(cmd, backend, host, 'MAINT') self.execute_for_backends(cmd, backend, host, 'MAINT')
def act(self): def act(self):
""" """
Figure out what you want to do from ansible, and then do it. Figure out what you want to do from ansible, and then do it.
@ -396,7 +390,7 @@ def main():
ansible_haproxy.act() ansible_haproxy.act()
# import module snippets # import module snippets
from ansible.module_utils.basic import * from ansible.module_utils.basic import AnsibleModule
if __name__ == '__main__': if __name__ == '__main__':
main() main()

@ -498,7 +498,6 @@ lib/ansible/modules/network/f5/bigip_gtm_wide_ip.py
lib/ansible/modules/network/f5/bigip_virtual_server.py lib/ansible/modules/network/f5/bigip_virtual_server.py
lib/ansible/modules/network/fortios/fortios_config.py lib/ansible/modules/network/fortios/fortios_config.py
lib/ansible/modules/network/fortios/fortios_ipv4_policy.py lib/ansible/modules/network/fortios/fortios_ipv4_policy.py
lib/ansible/modules/net_tools/haproxy.py
lib/ansible/modules/network/illumos/dladm_iptun.py lib/ansible/modules/network/illumos/dladm_iptun.py
lib/ansible/modules/network/illumos/dladm_linkprop.py lib/ansible/modules/network/illumos/dladm_linkprop.py
lib/ansible/modules/network/ios/_ios_template.py lib/ansible/modules/network/ios/_ios_template.py

Loading…
Cancel
Save