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

Function PersistModAttrHelper

lib/icinga/icingaapplication.cpp:130–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130static void PersistModAttrHelper(AtomicFile& fp, ConfigObject::Ptr& previousObject, const ConfigObject::Ptr& object, const String& attr, const Value& value)
131{
132 if (object != previousObject) {
133 if (previousObject) {
134 ConfigWriter::EmitRaw(fp, "\tobj.version = ");
135 ConfigWriter::EmitValue(fp, 0, previousObject->GetVersion());
136 ConfigWriter::EmitRaw(fp, "\n}\n\n");
137 }
138
139 ConfigWriter::EmitRaw(fp, "var obj = ");
140
141 Array::Ptr args1 = new Array({
142 object->GetReflectionType()->GetName(),
143 object->GetName()
144 });
145 ConfigWriter::EmitFunctionCall(fp, "get_object", args1);
146
147 ConfigWriter::EmitRaw(fp, "\nif (obj) {\n");
148 }
149
150 ConfigWriter::EmitRaw(fp, "\tobj.");
151
152 Array::Ptr args2 = new Array({
153 attr,
154 value
155 });
156 ConfigWriter::EmitFunctionCall(fp, "modify_attribute", args2);
157
158 ConfigWriter::EmitRaw(fp, "\n");
159
160 previousObject = object;
161}
162
163void IcingaApplication::DumpProgramState()
164{

Callers 1

Calls 2

GetNameMethod · 0.45
GetReflectionTypeMethod · 0.45

Tested by

no test coverage detected