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
{
/* keep this in sync with tools/mkclass/classcompiler.hpp */
enum FieldAttribute
{
FAConfig = 1,
FAState = 2,
FAInternal = 32
FAEphemeral = 1,
FAConfig = 2,
FAState = 4,
FAInternal = 64,
};
class Type;

View File

@ -655,7 +655,7 @@ void LivestatusQuery::ExecuteScriptHelper(const Stream::Ptr& stream)
throw;
}
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)

View File

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

View File

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