]> granicus.if.org Git - icinga2/commitdiff
Fix macros requiring last check result.
authorMichael Friedrich <michael.friedrich@netways.de>
Mon, 4 Nov 2013 08:28:23 +0000 (09:28 +0100)
committerMichael Friedrich <michael.friedrich@netways.de>
Mon, 4 Nov 2013 08:28:23 +0000 (09:28 +0100)
Fixes #4981

lib/icinga/pluginchecktask.cpp
lib/icinga/plugineventtask.cpp

index 1df4a3abcce80129a65cc0335c3c439b4a1c79e3..dbb2241756883b6e4b8ce36b28ad5df33eb3a8ec 100644 (file)
@@ -46,7 +46,7 @@ Dictionary::Ptr PluginCheckTask::ScriptFunc(const Service::Ptr& service)
        resolvers.push_back(commandObj);
        resolvers.push_back(IcingaApplication::GetInstance());
 
-       Value command = MacroProcessor::ResolveMacros(raw_command, resolvers, Dictionary::Ptr(), Utility::EscapeShellCmd, commandObj->GetEscapeMacros());
+       Value command = MacroProcessor::ResolveMacros(raw_command, resolvers, service->GetLastCheckResult(), Utility::EscapeShellCmd, commandObj->GetEscapeMacros());
 
        Dictionary::Ptr envMacros = boost::make_shared<Dictionary>();
 
@@ -56,7 +56,7 @@ Dictionary::Ptr PluginCheckTask::ScriptFunc(const Service::Ptr& service)
                BOOST_FOREACH(const String& macro, export_macros) {
                        String value;
 
-                       if (!MacroProcessor::ResolveMacro(macro, resolvers, Dictionary::Ptr(), &value)) {
+                       if (!MacroProcessor::ResolveMacro(macro, resolvers, service->GetLastCheckResult(), &value)) {
                                Log(LogWarning, "icinga", "export_macros for service '" + service->GetName() + "' refers to unknown macro '" + macro + "'");
                                continue;
                        }
index 313463c25903121e1510d97fa73063ea4617e74a..611c2eab0cc0d905fe5593c288bd1e4a6d4a691d 100644 (file)
@@ -44,7 +44,7 @@ void PluginEventTask::ScriptFunc(const Service::Ptr& service)
        resolvers.push_back(commandObj);
        resolvers.push_back(IcingaApplication::GetInstance());
 
-       Value command = MacroProcessor::ResolveMacros(raw_command, resolvers, Dictionary::Ptr(), Utility::EscapeShellCmd, commandObj->GetEscapeMacros());
+       Value command = MacroProcessor::ResolveMacros(raw_command, resolvers, service->GetLastCheckResult(), Utility::EscapeShellCmd, commandObj->GetEscapeMacros());
 
        Dictionary::Ptr envMacros = boost::make_shared<Dictionary>();
 
@@ -54,7 +54,7 @@ void PluginEventTask::ScriptFunc(const Service::Ptr& service)
                BOOST_FOREACH(const String& macro, export_macros) {
                        String value;
 
-                       if (!MacroProcessor::ResolveMacro(macro, resolvers, Dictionary::Ptr(), &value)) {
+                       if (!MacroProcessor::ResolveMacro(macro, resolvers, service->GetLastCheckResult(), &value)) {
                                Log(LogWarning, "icinga", "export_macros for command '" + commandObj->GetName() + "' refers to unknown macro '" + macro + "'");
                                continue;
                        }