I have an array “a” that I want to loop over and create TimePeriod objects from:
for (s in a) {
object TimePeriod "tp-" + s {
includes = [ "24x7" ]
excludes = [ "no-tp" + s ]
display_name = "Downtime in " + s
prefer_includes = false
}
}
The error I’m getting is this:
critical/config: Error: Error while evaluating expression: Tried to access undefined script variable 's' Location: in timeperiods.conf: 56:34-56:37 timeperiods.conf(54): display_name = "Downtime in " + s timeperiods.conf(55): includes = [ "24x7" ] timeperiods.conf(56): excludes = [ "no-tp-" + s ] ^^^^ timeperiods.conf(57): prefer_includes = false timeperiods.conf(58): }
So “s” is known in the object name but not inside the object definition block. Is this expected? Could I solve it with namespaces somehow?