mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
Reload host pools when changing pools in v2/set/pool/members.lua
This commit is contained in:
parent
ef881b43f1
commit
55d4334423
1 changed files with 7 additions and 0 deletions
|
|
@ -44,6 +44,7 @@ sendHTTPContentTypeHeader('application/json')
|
|||
--]]
|
||||
|
||||
local rc = rest_utils.consts.success.ok
|
||||
local host_pools_changed = false
|
||||
|
||||
-- Instantiate host pools
|
||||
local s = host_pools:create()
|
||||
|
|
@ -84,6 +85,7 @@ for member, info in pairs(_POST["associations"] or {}) do
|
|||
|
||||
if connectivity == "pass" then
|
||||
if s:bind_member(member, pool_id) == true then
|
||||
host_pools_changed = true
|
||||
local current_interface = interface.getId() or -1 -- System Interface
|
||||
res["associations"][member]["status"] = "OK"
|
||||
interface.select(tostring(interface.getFirstInterfaceId()))
|
||||
|
|
@ -98,6 +100,7 @@ for member, info in pairs(_POST["associations"] or {}) do
|
|||
local terminate_cause = info["terminateCause"] or 3 -- Lost service
|
||||
local current_interface = interface.getId() or -1 -- System Interface
|
||||
s:bind_member(member, host_pools.DEFAULT_POOL_ID)
|
||||
host_pools_changed = true
|
||||
res["associations"][member]["status"] = "OK"
|
||||
interface.select(tostring(interface.getFirstInterfaceId()))
|
||||
local mac_info = interface.getMacInfo(member)
|
||||
|
|
@ -111,5 +114,9 @@ for member, info in pairs(_POST["associations"] or {}) do
|
|||
::continue::
|
||||
end
|
||||
|
||||
if host_pools_changed then
|
||||
ntop.reloadHostPools()
|
||||
end
|
||||
|
||||
rest_utils.answer(rc, res)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue