Undefined behavior when processing multiple use statements

Scott Sanders ssanders at taximagic.com
Mon Oct 25 17:55:39 CEST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nagios clearly defines how it handles multiple inheritance when more
than one named object is included by 'use'. However, it does not
clearly define what happens when multiple use statements are present
in the object.

The definitions:

define host {
    host_name  host001
    use        env-dev,class-server,role-webserver
}

define host {
    host_name  host002
    use        env-dev
    use        class-server
    use        role-webserver
}

The two hosts appear to be identical, however the host templates are
inherited in different orders. Host001 will include the templates
env-dev, class-server, and role-webserver and will apply them in order
such that the env-dev template has precedence over the class-server,
and class-server will have precedence over role-webserver. However,
host002, applies precedence in the opposite order. Each use statement
seems to be evaluated independent of the others, in descending order.
This results in a precedence order of role-webserver, class-server,
env-dev.

I'm unsure if this is intentional or not, and the documentation does
not address objects containing multiple use statements. In my mind, it
makes sense for Nagios to treat the two definitions above as identical
since they appear syntactically identical. I expect Nagios to collect
all use statements and concatenate their values, then loop over the
comma separated values applying the templates as they are found.
Changing this behavior will affect backwards compatibility, but only
for an undocumented feature. I propose that this configuration syntax
is either documented as it currently exists, forbidden during the
runtime configuration check, or fixed to reflect the expected behavior.

Comments?

- -- 
Scott Sanders <ssanders at taximagic.com>
Systems Administrator
TaxiMagic (http://taximagic.com)
office: 703-579-6818
mobile: 803-767-0060
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (FreeBSD)

iQIcBAEBAgAGBQJMxah7AAoJEKCo2w/R6rlNlAAP/2s9qCZO/khdhlwnUWaYlBSp
51mK+S3e/fJdrEMEUfoOhrFC27XXgx1nngx4n0hOqCGEAhhVYl4P4zMRQ0I4uDXj
mxc1nuETChv+Lqz2mUdZh5mnbraFPLLq0b6zP1au6ZXSdotPBE6UFZlasslxPh55
neK25xxLSOXmP3IQw+bWMo28edY0vvnQOpUORNU7QZwZSd7YlgGcx8kQljpOlCJk
AC0OTo2WNxim3Tr01+mYNqDtpkaviq0zw1L4InB6QHHJmxh5jmhf18fl4krIISz+
zGY4WKYlqqfchtDUZH9bXtZSUL3c6U4I52fMsqQY6YRCFHcKNastLQkBN2sBXcaj
FPpDvHaW610MzSB1PfaASvQ2D9Ww8xEb7MU2yURPnm/wVjdjQUfYJfGzJhCJzz9y
cgBGm+HF9oNQAnNmNbBNL8d1R+7WolPtWc0IdPlwKh6SJJadnjAmQUQw1MVVEZFG
peA5h1WMo44jcMnL/t7ipx1HXmRwxPR0RD/8A4yKD272SULj9mKYWVvaIoVQRSXs
KW0DQQsnCbqtItVQWW4hJEGvjlk6KAeT9QKScLK55eapOsf8koqQRjRwCQD75pvA
VaAjjrLRcx/mD/Xmr2LA2l32H5hm6SuSnV2odkSrp0S0ETC7iyoTf8tMkZhEYzJ7
pJXhr/fZPVmIv39lKumK
=tKLw
-----END PGP SIGNATURE-----


------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev




More information about the Developers mailing list