mirror of https://github.com/Icinga/icinga2.git
Merge pull request #9779 from Icinga/macroprocessor-resolvemacro-quasi-cv-object-icingaapplication
MacroProcessor::ResolveMacro(): treat quasi-CV-object IcingaApplication as real CV-object
This commit is contained in:
commit
7c381ae12f
|
@ -220,13 +220,6 @@ bool IcingaApplication::ResolveMacro(const String& macro, const CheckResult::Ptr
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary::Ptr vars = GetVars();
|
|
||||||
|
|
||||||
if (vars && vars->Contains(macro)) {
|
|
||||||
*result = vars->Get(macro);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (macro.Contains("num_services")) {
|
if (macro.Contains("num_services")) {
|
||||||
ServiceStatistics ss = CIB::CalculateServiceStats();
|
ServiceStatistics ss = CIB::CalculateServiceStats();
|
||||||
|
|
||||||
|
|
|
@ -111,17 +111,24 @@ bool MacroProcessor::ResolveMacro(const String& macro, const ResolverList& resol
|
||||||
if (!resolver.ResolveShortMacros)
|
if (!resolver.ResolveShortMacros)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Dictionary::Ptr vars;
|
||||||
CustomVarObject::Ptr dobj = dynamic_pointer_cast<CustomVarObject>(resolver.Obj);
|
CustomVarObject::Ptr dobj = dynamic_pointer_cast<CustomVarObject>(resolver.Obj);
|
||||||
|
|
||||||
if (dobj) {
|
if (dobj) {
|
||||||
Dictionary::Ptr vars = dobj->GetVars();
|
vars = dobj->GetVars();
|
||||||
|
} else {
|
||||||
|
auto app (dynamic_pointer_cast<IcingaApplication>(resolver.Obj));
|
||||||
|
|
||||||
if (vars && vars->Contains(macro)) {
|
if (app) {
|
||||||
*result = vars->Get(macro);
|
vars = app->GetVars();
|
||||||
*recursive_macro = true;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vars && vars->Contains(macro)) {
|
||||||
|
*result = vars->Get(macro);
|
||||||
|
*recursive_macro = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *mresolver = dynamic_cast<MacroResolver *>(resolver.Obj.get());
|
auto *mresolver = dynamic_cast<MacroResolver *>(resolver.Obj.get());
|
||||||
|
|
Loading…
Reference in New Issue