nconf/development — pull request #7 by Tontonitch (2012-01-13 00:32:51+00:00)
Title: Feature to force contact_groups append instead of overwrite

Feature to force contact_groups append instead of overwrite

I needed to have some contact_group inheritances between host-templates / service-templates, which don't overwrite the contact_group defined on the host/service.

For that, I've written a patch that add an option in the nconf.php file:
a new variable FORCE_CONTACTGROUPS_APPEND can be set to globally change the way that contactgroups are added when inherited
0: overwrite existing contact groups. this is the default and actual behaviour
1: append to existing contact groups (add the '+' prefix)

Note that currently the default behaviour changes for host and service depending on the SUPERADMIN_GROUPS definition (if prefixed by a '+' or not).

So, when the FORCE_CONTACTGROUPS_APPEND option is set to 1, a character '+' will be added in front of the contact_groups lists when writing the following classes to nagios cfg files:
host
service
advanced-service
host-template
service-template

For exemple, it is now possible to have multiple templates on the same host, and contact_groups on that host will be the sum of every contact_groups (every linked templates + host).

That would be great to have in future release of NConf something more flexible.
For exemple, a radio button below every contact_group selector. Something similar to what is already implemented when multimodifying contactgroups of some services.
selecting 'overwrite' would trigger the actual behaviour.
selecting 'append' would add a '+' to the contactgroup list, which indicates that a '+' character will be added in front of the contact_group list when written in the nagios cfg file.

Related forum topic:
http://forum.nconf.org/viewtopic.php?f=20&t=867