Werk #6063

ComponentCore & Setup
TitleSpecial agents: Remove unreplaced macros from special agent command lines
Date2018-05-09 13:28:18
Check_MK EditionCheck_MK Raw Edition (CRE)
Check_MK Version1.4.0p32,1.6.0i1,1.5.0b3
Level1 - Trivial Change
ClassBug Fix
CompatibilityCompatible - no manual interaction needed

In previous versions the command lines of special agent calls like e.g. custom data source programs could contain unreplaced macros in the format $_HOST_MACRO$ which were later inpterpreted as shell variables. In case there was no such variable in the shell environment, the trailing $ was left on the command line as single character.

This could lead to some broken command line calls. We now do the replacement as usual. After replacing all known macros, the command line is searched for left over $...$ macros and remove the whole macro from the command line. This should make optional macro handling a lot easier.