mirror of https://github.com/Icinga/icinga2.git
livestatus: custom variables return empty arrays instead of strings
livestatus queries for custom variables should return an empty list, ex: [] instead of an empty string if there are no variables. Signed-off-by: Sven Nierlein <sven@nierlein.de> refs #5746
This commit is contained in:
parent
3a7c54c3d1
commit
9ba5f30afa
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue