Disallow empty/integer object names
This PR sets the required flag for object names to prevent objects with "" or null names from being created.
fixes #9097
Please just make sure
object CheckCommand "cc" { }
object Host "h" {
check_command = "cc"
vars.x = [ "y" ]
}
apply Service "" for (x in host.vars.x) {
check_command = "cc"
}
keeps working. (At least it does with 3bee85ba8.)
Is that check obsolete now (there are different code branches that set
name, so that's not the case necessarily)? Only doing the check there (moving the check out of theif (nc)) would mean that this wouldn't have an effect on templates.
What if we would generate the name from the NameComposer after the expression validation? So, the check would be performed after the first try ... catch! We would then not have to check for emptiness.
By the way, the current state of the current PR still accepts this:
Do you want me to fix this now as well or are you sticking to the below statement?
At the moment, I'm leaning towards doing just 148f5b8, this on its own seems to fix (more testing needed, but looking good so far) the empty object name issue, the part that's actually causing issues here.
or are you sticking to the below statement?
At the moment, I'm leaning towards doing just 148f5b8, this on its own seems to fix (more testing needed, but looking good so far) the empty object name issue, the part that's actually causing issues here.
That one.