Merge pull request #5746 from sni/livestatus_should_return_empty_lists

livestatus: custom variables return empty arrays instead of strings
This commit is contained in:
Gunnar Beutner 2017-11-27 10:33:32 +01:00 committed by GitHub
commit 4fcb1af8fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 45 additions and 45 deletions

View File

@ -106,11 +106,11 @@ Value CommandsTable::CustomVariableNamesAccessor(const Value& row)
vars = CompatUtility::GetCustomAttributeConfig(command);
}
if (!vars)
return Empty;
Array::Ptr cv = new Array();
if (!vars)
return cv;
{
ObjectLock xlock(vars);
for (const auto& kv : vars) {
@ -135,11 +135,11 @@ Value CommandsTable::CustomVariableValuesAccessor(const Value& row)
vars = CompatUtility::GetCustomAttributeConfig(command);
}
if (!vars)
return Empty;
Array::Ptr cv = new Array();
if (!vars)
return cv;
{
ObjectLock xlock(vars);
for (const auto& kv : vars) {
@ -164,11 +164,11 @@ Value CommandsTable::CustomVariablesAccessor(const Value& row)
vars = CompatUtility::GetCustomAttributeConfig(command);
}
if (!vars)
return Empty;
Array::Ptr cv = new Array();
if (!vars)
return cv;
{
ObjectLock xlock(vars);
for (const auto& kv : vars) {

View File

@ -210,11 +210,11 @@ Value ContactsTable::CustomVariableNamesAccessor(const Value& row)
vars = CompatUtility::GetCustomAttributeConfig(user);
}
if (!vars)
return Empty;
Array::Ptr cv = new Array();
if (!vars)
return cv;
ObjectLock olock(vars);
for (const Dictionary::Pair& kv : vars) {
cv->Add(kv.first);
@ -237,11 +237,11 @@ Value ContactsTable::CustomVariableValuesAccessor(const Value& row)
vars = CompatUtility::GetCustomAttributeConfig(user);
}
if (!vars)
return Empty;
Array::Ptr cv = new Array();
if (!vars)
return cv;
ObjectLock olock(vars);
for (const Dictionary::Pair& kv : vars) {
if (kv.second.IsObjectType<Array>() || kv.second.IsObjectType<Dictionary>())
@ -267,11 +267,11 @@ Value ContactsTable::CustomVariablesAccessor(const Value& row)
vars = CompatUtility::GetCustomAttributeConfig(user);
}
if (!vars)
return Empty;
Array::Ptr cv = new Array();
if (!vars)
return cv;
ObjectLock olock(vars);
for (const Dictionary::Pair& kv : vars) {
Array::Ptr key_val = new Array();

View File

@ -1016,11 +1016,11 @@ Value HostsTable::CustomVariableNamesAccessor(const Value& row)
vars = CompatUtility::GetCustomAttributeConfig(host);
}
if (!vars)
return Empty;
Array::Ptr cv = new Array();
if (!vars)
return cv;
ObjectLock olock(vars);
for (const Dictionary::Pair& kv : vars) {
cv->Add(kv.first);
@ -1043,11 +1043,11 @@ Value HostsTable::CustomVariableValuesAccessor(const Value& row)
vars = CompatUtility::GetCustomAttributeConfig(host);
}
if (!vars)
return Empty;
Array::Ptr cv = new Array();
if (!vars)
return cv;
ObjectLock olock(vars);
for (const Dictionary::Pair& kv : vars) {
if (kv.second.IsObjectType<Array>() || kv.second.IsObjectType<Dictionary>())
@ -1073,11 +1073,11 @@ Value HostsTable::CustomVariablesAccessor(const Value& row)
vars = CompatUtility::GetCustomAttributeConfig(host);
}
if (!vars)
return Empty;
Array::Ptr cv = new Array();
if (!vars)
return cv;
ObjectLock olock(vars);
for (const Dictionary::Pair& kv : vars) {
Array::Ptr key_val = new Array();

View File

@ -1055,11 +1055,11 @@ Value ServicesTable::CustomVariableNamesAccessor(const Value& row)
vars = CompatUtility::GetCustomAttributeConfig(service);
}
if (!vars)
return Empty;
Array::Ptr cv = new Array();
if (!vars)
return cv;
ObjectLock olock(vars);
for (const Dictionary::Pair& kv : vars) {
cv->Add(kv.first);
@ -1082,11 +1082,11 @@ Value ServicesTable::CustomVariableValuesAccessor(const Value& row)
vars = CompatUtility::GetCustomAttributeConfig(service);
}
if (!vars)
return Empty;
Array::Ptr cv = new Array();
if (!vars)
return cv;
ObjectLock olock(vars);
for (const Dictionary::Pair& kv : vars) {
if (kv.second.IsObjectType<Array>() || kv.second.IsObjectType<Dictionary>())
@ -1112,11 +1112,11 @@ Value ServicesTable::CustomVariablesAccessor(const Value& row)
vars = CompatUtility::GetCustomAttributeConfig(service);
}
if (!vars)
return Empty;
Array::Ptr cv = new Array();
if (!vars)
return cv;
ObjectLock olock(vars);
for (const Dictionary::Pair& kv : vars) {
Array::Ptr key_val = new Array();

View File

@ -233,11 +233,11 @@ Value StatusTable::CustomVariableNamesAccessor(const Value&)
{
Dictionary::Ptr vars = IcingaApplication::GetInstance()->GetVars();
if (!vars)
return Empty;
Array::Ptr cv = new Array();
if (!vars)
return cv;
{
ObjectLock olock(vars);
for (const auto& kv : vars) {
@ -252,11 +252,11 @@ Value StatusTable::CustomVariableValuesAccessor(const Value&)
{
Dictionary::Ptr vars = IcingaApplication::GetInstance()->GetVars();
if (!vars)
return Empty;
Array::Ptr cv = new Array();
if (!vars)
return cv;
{
ObjectLock olock(vars);
for (const auto& kv : vars) {
@ -271,11 +271,11 @@ Value StatusTable::CustomVariablesAccessor(const Value&)
{
Dictionary::Ptr vars = IcingaApplication::GetInstance()->GetVars();
if (!vars)
return Empty;
Array::Ptr cv = new Array();
if (!vars)
return cv;
{
ObjectLock olock(vars);
for (const auto& kv : vars) {