Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message for serializing objects with recursive references #6427

Merged
merged 1 commit into from Aug 3, 2018

Conversation

gunnarbeutner
Copy link
Contributor

This improves error reporting somewhat for the issue reported in #6409.

@gunnarbeutner gunnarbeutner added bug Something isn't working area/configuration DSL, parser, compiler, error handling core/crash Shouldn't happen, requires attention labels Jul 5, 2018
@dnsmichi dnsmichi added this to the 2.10.0 milestone Jul 9, 2018
@dnsmichi dnsmichi self-requested a review July 26, 2018 08:02
@dnsmichi
Copy link
Contributor

This needs two things:

  • the exception needs to be handled by upper levels, supressing the stacktrace (should be a config error)
  • more context e.g. attribute name affected, etc.

@gunnarbeutner
Copy link
Contributor Author

How about this?:

gunnar@abyss ~ $ icinga2 daemon -C
[2018-08-02 11:05:45 +0200] information/cli: Icinga application loader (version: v2.9.1-50-gb661adeda; debug)
[2018-08-02 11:05:45 +0200] information/cli: Loading configuration file(s).
[2018-08-02 11:05:45 +0200] information/ConfigItem: Committing config item(s).
[2018-08-02 11:05:45 +0200] information/ApiListener: My API identity: abyss.beutner.name
[2018-08-02 11:05:45 +0200] critical/config: Error: Validation failed for object 'test' of type 'Host'; Attribute 'vars' -> 'x' -> 'y' -> 'z': Circular references are not allowed
Location: in /Users/gunnar/i2/etc/icinga2/conf.d/test.conf: 1:0-1:17
/Users/gunnar/i2/etc/icinga2/conf.d/test.conf(1): object Host "test" {
                                                  ^^^^^^^^^^^^^^^^^^
/Users/gunnar/i2/etc/icinga2/conf.d/test.conf(2):   import "generic-host"
/Users/gunnar/i2/etc/icinga2/conf.d/test.conf(3):   vars.x.y.z = vars

[2018-08-02 11:05:45 +0200] critical/config: 1 error
gunnar@abyss ~ $

@dnsmichi
Copy link
Contributor

dnsmichi commented Aug 2, 2018

Awesome, thanks :)

@dnsmichi
Copy link
Contributor

dnsmichi commented Aug 3, 2018

mbmif /usr/local/icinga2/etc/icinga2 (master *) # icinga2 daemon -C
[2018-08-03 11:02:37 +0200] information/cli: Icinga application loader (version: v2.9.1-50-g56cf64f59; debug)
[2018-08-03 11:02:37 +0200] information/cli: Loading configuration file(s).
[2018-08-03 11:02:37 +0200] information/ConfigItem: Committing config item(s).
[2018-08-03 11:02:37 +0200] information/ApiListener: My API identity: mbmif.int.netways.de
[2018-08-03 11:02:37 +0200] critical/config: Error: Validation failed for object 'selfref' of type 'Host'; Attribute 'vars' -> 'x' -> 'y' -> 'z': Circular references are not allowed
Location: in /usr/local/icinga2/etc/icinga2/tests/selfreference.conf: 1:0-1:20
/usr/local/icinga2/etc/icinga2/tests/selfreference.conf(1): object Host "selfref" {
                                                            ^^^^^^^^^^^^^^^^^^^^^
/usr/local/icinga2/etc/icinga2/tests/selfreference.conf(2):   check_command = "dummy"
/usr/local/icinga2/etc/icinga2/tests/selfreference.conf(3):

[2018-08-03 11:02:37 +0200] critical/config: 1 error

@dnsmichi dnsmichi merged commit 3349242 into Icinga:master Aug 3, 2018
@gunnarbeutner gunnarbeutner deleted the fix/recursive-serialize branch August 3, 2018 17:44
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 core/crash Shouldn't happen, requires attention
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants