MCPcopy Create free account
hub / github.com/Icinga/icinga2 / CustomVariableValuesAccessor

Method CustomVariableValuesAccessor

lib/livestatus/hoststable.cpp:1034–1056  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1032}
1033
1034Value HostsTable::CustomVariableValuesAccessor(const Value& row)
1035{
1036 Host::Ptr host = static_cast<Host::Ptr>(row);
1037
1038 if (!host)
1039 return Empty;
1040
1041 Dictionary::Ptr vars = host->GetVars();
1042
1043 ArrayData result;
1044
1045 if (vars) {
1046 ObjectLock olock(vars);
1047 for (const Dictionary::Pair& kv : vars) {
1048 if (kv.second.IsObjectType<Array>() || kv.second.IsObjectType<Dictionary>())
1049 result.push_back(JsonEncode(kv.second));
1050 else
1051 result.push_back(kv.second);
1052 }
1053 }
1054
1055 return new Array(std::move(result));
1056}
1057
1058Value HostsTable::CustomVariablesAccessor(const Value& row)
1059{

Callers

nothing calls this directly

Calls 1

push_backMethod · 0.80

Tested by

no test coverage detected