Skip to content

Conversation

@yhabteab
Copy link
Member

Just came across this weird behavior. Even though the class compiler generated a proper validator for the ranges field, no one cared to actually call it from within the overridden method, resulting in some weird errors bing displayed instead.

Before

[2025-11-14 16:51:28 +0100] critical/config: Error: Operator + cannot be applied to values of type 'String' and 'Array'
[2025-11-14 16:51:28 +0100] critical/config: 1 error
[2025-11-14 16:51:28 +0100] critical/cli: Config validation failed. Re-run with 'icinga2 daemon -C' after fixing the config.

After

[2025-11-14 16:37:57 +0100] critical/config: Error: Validation failed for object '24x7' of type 'TimePeriod'; Attribute 'ranges' -> 'monday': Invalid type.
Location: in icinga2.conf: 253:5-255:5
icinga2.conf(251):     import "legacy-timeperiod"
icinga2.conf(252):
icinga2.conf(253):     ranges = {
                       ^^^^^^^^^^
icinga2.conf(254):         "monday" = []
                   ^^^^^^^^^^^^^^^^^^^^^
icinga2.conf(255):     }
                   ^^^^^
icinga2.conf(256): }
icinga2.conf(257):
[2025-11-14 16:37:57 +0100] critical/config: 1 error
[2025-11-14 16:37:57 +0100] critical/cli: Config validation failed. Re-run with 'icinga2 daemon -C' after fixing the config.

@yhabteab yhabteab added this to the 2.16.0 milestone Nov 14, 2025
@yhabteab yhabteab added bug Something isn't working area/configuration DSL, parser, compiler, error handling labels Nov 14, 2025
@cla-bot cla-bot bot added the cla/signed label Nov 14, 2025
Copy link
Contributor

@jschmidt-icinga jschmidt-icinga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

@yhabteab yhabteab merged commit 9e6df06 into master Nov 17, 2025
25 checks passed
@yhabteab yhabteab deleted the fix-timeperiod-ranges-validation branch November 17, 2025 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/configuration DSL, parser, compiler, error handling bug Something isn't working cla/signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants