Make sure that 'icinga2 console' serializes temporary attributes (rather than just config + state)

fixes #8690
This commit is contained in:
Gunnar Beutner 2015-03-11 16:06:58 +01:00
parent 442078f5ac
commit 5e39fbbdf5
4 changed files with 19 additions and 12 deletions

View File

@ -30,11 +30,13 @@
namespace icinga namespace icinga
{ {
/* keep this in sync with tools/mkclass/classcompiler.hpp */
enum FieldAttribute enum FieldAttribute
{ {
FAConfig = 1, FAEphemeral = 1,
FAState = 2, FAConfig = 2,
FAInternal = 32 FAState = 4,
FAInternal = 64,
}; };
class Type; class Type;

View File

@ -655,7 +655,7 @@ void LivestatusQuery::ExecuteScriptHelper(const Stream::Ptr& stream)
throw; throw;
} }
delete expr; delete expr;
SendResponse(stream, LivestatusErrorOK, JsonEncode(Serialize(result, FAState | FAConfig), true)); SendResponse(stream, LivestatusErrorOK, JsonEncode(Serialize(result, FAEphemeral | FAState | FAConfig), true));
} }
void LivestatusQuery::ExecuteErrorHelper(const Stream::Ptr& stream) void LivestatusQuery::ExecuteErrorHelper(const Stream::Ptr& stream)

View File

@ -256,6 +256,9 @@ class_field: field_attribute_list identifier identifier alternative_name_specifi
field->Attributes = $1; field->Attributes = $1;
if ((field->Attributes & (FAConfig | FAState)) == 0)
field->Attributes |= FAEphemeral;
field->Type = $2; field->Type = $2;
std::free($2); std::free($2);

View File

@ -55,16 +55,18 @@ struct FieldAccessor
{ } { }
}; };
/* keep this in sync with lib/base/type.hpp */
enum FieldAttribute enum FieldAttribute
{ {
FAConfig = 1, FAEphemeral = 1,
FAState = 2, FAConfig = 2,
FAEnum = 4, FAState = 4,
FAGetProtected = 8, FAEnum = 8,
FASetProtected = 16, FAGetProtected = 16,
FAInternal = 32, FASetProtected = 32,
FANoStorage = 64, FAInternal = 64,
FALoadDependency = 128 FANoStorage = 128,
FALoadDependency = 256
}; };
struct Field struct Field