Fix check-services which failed when services reduced to 0 (#1212)

This commit is contained in:
Tim Wilkinson 2024-05-21 21:02:47 -07:00 committed by GitHub
parent d92876dccf
commit 2509ebdf3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 2 deletions

View File

@ -112,11 +112,19 @@ if nhosts or not_empty(chosts) then
do
hosts[i] = host.ip .. " " .. host.host
end
cursor:set("olsrd", "nameservice", "hosts", hosts)
if #hosts > 0 then
cursor:set("olsrd", "nameservice", "hosts", hosts)
else
cursor:delete("olsrd", "nameservice", "hosts")
end
change = true
end
if nservices or not_empty(cservices) then
cursor:set("olsrd", "nameservice", "service", services)
if #services > 0 then
cursor:set("olsrd", "nameservice", "service", services)
else
cursor:delete("olsrd", "nameservice", "service")
end
change = true
end