Merge pull request #264 from draios/mergable-lists

Mergable lists
This commit is contained in:
Mark Stemm
2017-08-10 11:08:36 -07:00
committed by GitHub
5 changed files with 65 additions and 1 deletions

View File

@@ -222,7 +222,24 @@ function load_rules(rules_content, rules_mgr, verbose, all_events, extra, replac
end
end
state.lists_by_name[v['list']] = v
-- Possibly append to an existing list
append = false
if v['append'] then
append = v['append']
end
if append then
if state.lists_by_name[v['list']] == nil then
error ("List " ..v['list'].. " has 'append' key but no list by that name already exists")
end
for i, elem in ipairs(v['items']) do
table.insert(state.lists_by_name[v['list']]['items'], elem)
end
else
state.lists_by_name[v['list']] = v
end
elseif (v['rule']) then