Skip to content

Commit

Permalink
Fix incorrectly resolved macros
Browse files Browse the repository at this point in the history
refs #7564
  • Loading branch information
gunnarbeutner authored and Crunsher committed Feb 4, 2015
1 parent 4082f57 commit db70fac
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/icinga/macroprocessor.cpp
Expand Up @@ -241,16 +241,19 @@ Value MacroProcessor::InternalResolveMacros(const String& str, const ResolverLis
if (recursive_macro) {
if (resolved_macro.IsObjectType<Array>()) {
Array::Ptr arr = resolved_macro;
Array::Ptr result = new Array();
Array::Ptr resolved_arr = new Array();

ObjectLock olock(arr);
BOOST_FOREACH(Value& value, arr) {
result->Add(InternalResolveMacros(value,
resolvers, cr, missingMacro, EscapeCallback(), Dictionary::Ptr(),
false, recursionLevel + 1));
BOOST_FOREACH(const Value& value, arr) {
if (value.IsScalar()) {
resolved_arr->Add(InternalResolveMacros(value,
resolvers, cr, missingMacro, EscapeCallback(), Dictionary::Ptr(),
false, recursionLevel + 1));
} else
resolved_arr->Add(value);
}

resolved_macro = result;
resolved_macro = resolved_arr;
} else
resolved_macro = InternalResolveMacros(resolved_macro,
resolvers, cr, missingMacro, EscapeCallback(), Dictionary::Ptr(),
Expand Down

0 comments on commit db70fac

Please sign in to comment.