mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Changed output of haproxy commands to be more close to old behavior - except now it's a nested dictionary of {backend_name: server_list}.
This commit is contained in:
parent
3c88927f10
commit
730126958f
@ -91,12 +91,14 @@ def enable_server(name, backend, socket='/var/run/haproxy.sock'):
|
|||||||
else:
|
else:
|
||||||
backends = [backend]
|
backends = [backend]
|
||||||
|
|
||||||
|
results = {}
|
||||||
for backend in backends:
|
for backend in backends:
|
||||||
ha_conn = _get_conn(socket)
|
ha_conn = _get_conn(socket)
|
||||||
ha_cmd = haproxy.cmds.enableServer(server=name, backend=backend)
|
ha_cmd = haproxy.cmds.enableServer(server=name, backend=backend)
|
||||||
ha_conn.sendCmd(ha_cmd)
|
ha_conn.sendCmd(ha_cmd)
|
||||||
|
results[backend] = list_servers(backend, socket=socket)
|
||||||
|
|
||||||
return backends
|
return results
|
||||||
|
|
||||||
|
|
||||||
def disable_server(name, backend, socket='/var/run/haproxy.sock'):
|
def disable_server(name, backend, socket='/var/run/haproxy.sock'):
|
||||||
@ -124,12 +126,14 @@ def disable_server(name, backend, socket='/var/run/haproxy.sock'):
|
|||||||
else:
|
else:
|
||||||
backends = [backend]
|
backends = [backend]
|
||||||
|
|
||||||
|
results = {}
|
||||||
for backend in backends:
|
for backend in backends:
|
||||||
ha_conn = _get_conn(socket)
|
ha_conn = _get_conn(socket)
|
||||||
ha_cmd = haproxy.cmds.disableServer(server=name, backend=backend)
|
ha_cmd = haproxy.cmds.disableServer(server=name, backend=backend)
|
||||||
ha_conn.sendCmd(ha_cmd)
|
ha_conn.sendCmd(ha_cmd)
|
||||||
|
results[backend] = list_servers(backend, socket=socket)
|
||||||
|
|
||||||
return backends
|
return results
|
||||||
|
|
||||||
|
|
||||||
def get_weight(name, backend, socket='/var/run/haproxy.sock'):
|
def get_weight(name, backend, socket='/var/run/haproxy.sock'):
|
||||||
|
Loading…
Reference in New Issue
Block a user