mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 07:59:35 +00:00
Initial support for configsets targets
This commit is contained in:
parent
17f86d162b
commit
528cfe3221
4 changed files with 62 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
|||
require "lua_utils"
|
||||
local json = require("dkjson")
|
||||
local user_scripts = require("user_scripts")
|
||||
local http_lint = require("http_lint")
|
||||
|
||||
local action = _POST["action"]
|
||||
local subdir = _POST["subdir"] or "host"
|
||||
|
|
@ -69,6 +70,31 @@ elseif(action == "clone") then
|
|||
|
||||
if not success then
|
||||
result.error = err
|
||||
else
|
||||
result.config_id = err
|
||||
end
|
||||
elseif(action == "set_targets") then
|
||||
local targets = _POST["confset_targets"]
|
||||
|
||||
if(targets == nil) then
|
||||
traceError(TRACE_ERROR, TRACE_CONSOLE, "Missing 'confset_targets' parameter")
|
||||
return
|
||||
end
|
||||
|
||||
local targets = http_lint.parseConfsetTargets(subdir, targets)
|
||||
|
||||
if(targets ~= nil) then
|
||||
-- Validation ok
|
||||
local success, err = user_scripts.setConfigsetTargets(subdir, confid, targets)
|
||||
result.success = success
|
||||
|
||||
if not success then
|
||||
result.error = err
|
||||
end
|
||||
else
|
||||
-- Validation error
|
||||
result.success = false
|
||||
result.error = "Validation error"
|
||||
end
|
||||
else
|
||||
traceError(TRACE_ERROR, TRACE_CONSOLE, "Unknown action '".. action .. "'")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue