def set_weight(name, backend, weight=0, socket='/var/run/haproxy.sock'):
 ha_conn = _get_conn(socket)
 ha_cmd = haproxy.cmds.getWeight(server=name, backend=backend, weight=weight)
 ha_conn.sendCmd(ha_cmd)
 return get_weight(name, backend, socket=socket)

def set_weight ( name , backend , weight = 0 , socket = '/var/run/haproxy.sock' ) : ha_conn = _get_conn ( socket ) ha_cmd = haproxy . cmds . getWeight ( server = name , backend = backend , weight = weight ) ha_conn . sendCmd ( ha_cmd ) return get_weight ( name , backend , socket = socket )
set server weight name server name backend haproxy backend weight server weight socket haproxy stats socket cli example: .