Fixes alert_generation nil value

This commit is contained in:
Matteo Biscosi 2020-11-30 10:55:12 +01:00 committed by GitHub
parent 747f4675d8
commit 0858d1bb79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -135,10 +135,13 @@ end
--! @param alert_json Host info will be placed in key `host_info` of table `alert_json`
local function addAlertHostInfo(triggered)
if triggered then
-- Add only minimal information to keep the final result as small as possible
alert = json.decode(triggered.alert_json)
alert.alert_generation.host_info = host.getMinInfo()
triggered.alert_json = json.encode(alert)
-- Add only minimal information to keep the final result as small as possible
-- only if the alert_generation is not nil
if alert.alert_generation then
alert.alert_generation.host_info = host.getMinInfo()
triggered.alert_json = json.encode(alert)
end
end
end