def disable_server(name, backend, socket='/var/run/haproxy.sock'):
 if (backend == '*'):
  backends = show_backends(socket=socket).split('\n')
 else:
  backends = [backend]
 results = {}
 for backend in backends:
  ha_conn = _get_conn(socket)
  ha_cmd = haproxy.cmds.disableServer(server=name, backend=backend)
  ha_conn.sendCmd(ha_cmd)
  results[backend] = list_servers(backend, socket=socket)
 return results

def disable_server ( name , backend , socket = '/var/run/haproxy.sock' ) : if ( backend == '*' ) : backends = show_backends ( socket = socket ) . split ( '\n' ) else : backends = [ backend ] results = { } for backend in backends : ha_conn = _get_conn ( socket ) ha_cmd = haproxy . cmds . disableServer ( server = name , backend = backend ) ha_conn . sendCmd ( ha_cmd ) results [ backend ] = list_servers ( backend , socket = socket ) return results
disable server .