naparuba/shinken — pull request #972 by geektophe (2013-08-14 14:16:52+00:00)
Title: Added macro expansion to business rules.

This patch adds macro expansion to business rules, as of standard service checks.

To support macro modulation, business rules are re-evaluated on each
service scheduling loop, and checked for error to detect erroneous macro
substitution.

It is possible to define business rules with variable thresholds, depending on the
time. For instance, we may accept that more machines or services are dead in
a cluster during the night, because it is less loaded.

**Examples**

- On an host which has a custom macro `_XOF` set with a value of `1`, a `bp_rule`
looking like `$_HOSTXOF$ of: test_host_01,srv1 & test_host_02,srv2` would
be exactly equivalent to `1 of: test_host_01,srv1 & test_host_02,srv2`
- If this macro was modulated to a value of `2`, the next check would evaluate the
`bp_rule` exactly as if it was `2 of: test_host_01,srv1 & test_host_02,srv2`.
- If this macro was modulated to `fake` (a silly value), the business rule would
become invalid. In this situation, the check is set an **UNKNOWN** state, and
the error is reported in the check output.

**Caution**

The patch does not update dependencies registered by the `create_business_rules_dependencies`
method. As business rules are reevaluated from `bp_rule` string on each check, **values set in
macro modulation should never change the dependency tree**.

Also added the ability to force a service scheduling without setting its status nor
return value in `ShinkenTest` class. Used to force business rules processing in tests.