Fix some minor issues with the icinga2.debug feature

refs #6702
This commit is contained in:
Gunnar Beutner 2014-08-16 22:12:40 +02:00
parent f28b02b037
commit fdca524cdd
2 changed files with 38 additions and 11 deletions

2
debian/control vendored
View File

@ -243,7 +243,7 @@ Architecture: all
Section: python Section: python
Priority: extra Priority: extra
Depends: ${misc:Depends}, ${python:Depends} Depends: ${misc:Depends}, ${python:Depends}
Description: host and network monitoring system - debug symbols Description: host and network monitoring system - Python module
Icinga 2 is a general-purpose monitoring application and the next generation Icinga 2 is a general-purpose monitoring application and the next generation
after Icinga 1.x - which was a Nagios fork. It should fit the needs of a small after Icinga 1.x - which was a Nagios fork. It should fit the needs of a small
environment as well as big installations. environment as well as big installations.

View File

@ -312,10 +312,17 @@ Value AExpression::OpDict(const AExpression *expr, const Dictionary::Ptr& locals
Value AExpression::OpSet(const AExpression *expr, const Dictionary::Ptr& locals, DebugHint *dhint) Value AExpression::OpSet(const AExpression *expr, const Dictionary::Ptr& locals, DebugHint *dhint)
{ {
Value index = expr->EvaluateOperand1(locals); Value index = expr->EvaluateOperand1(locals);
DebugHint *sdhint = dhint->GetChild(index);
DebugHint *sdhint = NULL;
if (dhint)
sdhint = dhint->GetChild(index);
Value right = expr->EvaluateOperand2(locals, sdhint); Value right = expr->EvaluateOperand2(locals, sdhint);
locals->Set(index, right); locals->Set(index, right);
sdhint->AddMessage("=", expr->m_DebugInfo);
if (sdhint)
sdhint->AddMessage("=", expr->m_DebugInfo);
return right; return right;
} }
@ -335,7 +342,10 @@ Value AExpression::OpSetPlus(const AExpression *expr, const Dictionary::Ptr& loc
xlocals->Set("__parent", locals); xlocals->Set("__parent", locals);
} }
DebugHint *sdhint = dhint->GetChild(index); DebugHint *sdhint = NULL;
if (dhint)
sdhint = dhint->GetChild(index);
Value result = left + expr->EvaluateOperand2(xlocals, sdhint); Value result = left + expr->EvaluateOperand2(xlocals, sdhint);
if (exp_right->m_Operator == &AExpression::OpDict) { if (exp_right->m_Operator == &AExpression::OpDict) {
@ -344,7 +354,9 @@ Value AExpression::OpSetPlus(const AExpression *expr, const Dictionary::Ptr& loc
} }
locals->Set(index, result); locals->Set(index, result);
sdhint->AddMessage("+=", expr->m_DebugInfo);
if (sdhint)
sdhint->AddMessage("+=", expr->m_DebugInfo);
return result; return result;
} }
@ -365,7 +377,10 @@ Value AExpression::OpSetMinus(const AExpression *expr, const Dictionary::Ptr& lo
xlocals->Set("__parent", locals); xlocals->Set("__parent", locals);
} }
DebugHint *sdhint = dhint->GetChild(index); DebugHint *sdhint = NULL;
if (dhint)
sdhint = dhint->GetChild(index);
Value result = left - expr->EvaluateOperand2(xlocals, sdhint); Value result = left - expr->EvaluateOperand2(xlocals, sdhint);
if (exp_right->m_Operator == &AExpression::OpDict) { if (exp_right->m_Operator == &AExpression::OpDict) {
@ -374,7 +389,9 @@ Value AExpression::OpSetMinus(const AExpression *expr, const Dictionary::Ptr& lo
} }
locals->Set(index, result); locals->Set(index, result);
sdhint->AddMessage("-=", expr->m_DebugInfo);
if (sdhint)
sdhint->AddMessage("-=", expr->m_DebugInfo);
return result; return result;
} }
@ -395,7 +412,10 @@ Value AExpression::OpSetMultiply(const AExpression *expr, const Dictionary::Ptr&
xlocals->Set("__parent", locals); xlocals->Set("__parent", locals);
} }
DebugHint *sdhint = dhint->GetChild(index); DebugHint *sdhint = NULL;
if (dhint)
sdhint = dhint->GetChild(index);
Value result = left * expr->EvaluateOperand2(xlocals, sdhint); Value result = left * expr->EvaluateOperand2(xlocals, sdhint);
if (exp_right->m_Operator == &AExpression::OpDict) { if (exp_right->m_Operator == &AExpression::OpDict) {
@ -404,7 +424,9 @@ Value AExpression::OpSetMultiply(const AExpression *expr, const Dictionary::Ptr&
} }
locals->Set(index, result); locals->Set(index, result);
sdhint->AddMessage("*=", expr->m_DebugInfo);
if (sdhint)
sdhint->AddMessage("*=", expr->m_DebugInfo);
return result; return result;
} }
@ -425,7 +447,10 @@ Value AExpression::OpSetDivide(const AExpression *expr, const Dictionary::Ptr& l
xlocals->Set("__parent", locals); xlocals->Set("__parent", locals);
} }
DebugHint *sdhint = dhint->GetChild(index); DebugHint *sdhint = NULL;
if (dhint)
sdhint = dhint->GetChild(index);
Value result = left / expr->EvaluateOperand2(xlocals, sdhint); Value result = left / expr->EvaluateOperand2(xlocals, sdhint);
if (exp_right->m_Operator == &AExpression::OpDict) { if (exp_right->m_Operator == &AExpression::OpDict) {
@ -434,7 +459,9 @@ Value AExpression::OpSetDivide(const AExpression *expr, const Dictionary::Ptr& l
} }
locals->Set(index, result); locals->Set(index, result);
sdhint->AddMessage("/=", expr->m_DebugInfo);
if (sdhint)
sdhint->AddMessage("/=", expr->m_DebugInfo);
return result; return result;
} }