naemon / naemon-core

Networks, Applications and Event Monitor
http://www.naemon.io/
GNU General Public License v2.0
153 stars 63 forks source link

checkconfig bails out on warnings #68

Closed sni closed 10 years ago

sni commented 10 years ago

While the v0.8.0 exits with rc 0 when there are only warnings, the current head exists witht rc 1 which breaks all kind of things like init scripts etc...

HEAD:

.../naemon-core/naemon/naemon -pv .../naemon/naemon.cfg
Warning: Duplicate definition found for service 'PING' on host 'child' (config file '.../etc/naemon/conf.d/test.cfg', starting on line 509)
   Error processing object config files!

***> One or more problems was encountered while processing the config files...

Expected behaviour:

.../naemon-core/naemon/naemon -pv .../naemon/naemon.cfg
...
Total Warnings: 9
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check

git-bisect returns the following commits which likely introduced this behaviour. I think especcially the last one is interesting: The first bad commit could be any of: 1b039a5d043f10bb943b76ac96ea9655756439b0 916c8bccedc13f8aa55f4be15365a242a8494da1 f38eb33d91bbfc97f0b47bf733fd0b9478b7603c ff5af754c50bae8ab512a5dd17f53738010223b1 4252ca0248f0cb66fea19d3fac660a512d3ec2a9 9945dc5486b679dd22d0e4c492bee617bd6d346e 9a87f92aa701c58676bfda59429509c55b24f14a

sni commented 10 years ago

a few more tests revealed that only specific warnings bail out. For example the "Warning: Duplicate definition found for service" seems to be handled as error now, while "Warning: failure_prediction_enabled is obsoleted" or missing contacts pass through as warnings.

pengi commented 10 years ago

The reason can be found here: https://github.com/naemon/naemon-core/commit/9a87f92aa701c58676bfda59429509c55b24f14a#diff-9861904ad65243ff380c9c73888fadcdL3144

And it seems to be a bug earlier, since the intention of the old code was ERROR, but instead of returning the result, it returned OK, always. (And as far as I can see, stopped processing hostgroup services, if it was a hostgroup service)

There might be a problem with hostgroup services having the with the same name with this patch however, and that the expected behaviour would be to overwrite services.

pengi commented 10 years ago

This looks like it's fixed. Can someone confirm?

sni commented 10 years ago

Confirmed. Its fixed now. Thanks