mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-24 06:05:01 +02:00
IcingaDB: Send the string representation of comment#entry_type
to Redis
This commit is contained in:
parent
215af2b580
commit
5d11df1abf
@ -1684,7 +1684,7 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a
|
||||
|
||||
attributes->Set("author", comment->GetAuthor());
|
||||
attributes->Set("text", comment->GetText());
|
||||
attributes->Set("entry_type", comment->GetEntryType());
|
||||
attributes->Set("entry_type", IcingaDB::CommentTypeToString(comment->GetEntryType()));
|
||||
attributes->Set("entry_time", TimestampToMilliseconds(comment->GetEntryTime()));
|
||||
attributes->Set("is_persistent", comment->GetPersistent());
|
||||
attributes->Set("is_sticky", comment->GetSticky());
|
||||
@ -2300,7 +2300,7 @@ void IcingaDB::SendAddedComment(const Comment::Ptr& comment)
|
||||
"entry_time", Convert::ToString(TimestampToMilliseconds(comment->GetEntryTime())),
|
||||
"author", Utility::ValidateUTF8(comment->GetAuthor()),
|
||||
"comment", Utility::ValidateUTF8(comment->GetText()),
|
||||
"entry_type", Convert::ToString(comment->GetEntryType()),
|
||||
"entry_type", IcingaDB::CommentTypeToString(comment->GetEntryType()),
|
||||
"is_persistent", Convert::ToString((unsigned short)comment->GetPersistent()),
|
||||
"is_sticky", Convert::ToString((unsigned short)comment->GetSticky()),
|
||||
"event_id", CalcEventID("comment_add", comment),
|
||||
@ -2372,7 +2372,7 @@ void IcingaDB::SendRemovedComment(const Comment::Ptr& comment)
|
||||
"entry_time", Convert::ToString(TimestampToMilliseconds(comment->GetEntryTime())),
|
||||
"author", Utility::ValidateUTF8(comment->GetAuthor()),
|
||||
"comment", Utility::ValidateUTF8(comment->GetText()),
|
||||
"entry_type", Convert::ToString(comment->GetEntryType()),
|
||||
"entry_type", IcingaDB::CommentTypeToString(comment->GetEntryType()),
|
||||
"is_persistent", Convert::ToString((unsigned short)comment->GetPersistent()),
|
||||
"is_sticky", Convert::ToString((unsigned short)comment->GetSticky()),
|
||||
"event_id", CalcEventID("comment_remove", comment),
|
||||
|
@ -245,6 +245,21 @@ const char* IcingaDB::GetNotificationTypeByEnum(NotificationType type)
|
||||
VERIFY(!"Invalid notification type.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the given comment type to its string representation.
|
||||
*
|
||||
* @ingroup icinga
|
||||
*/
|
||||
String IcingaDB::CommentTypeToString(CommentType type)
|
||||
{
|
||||
switch (type) {
|
||||
case CommentUser: return "comment";
|
||||
case CommentAcknowledgement: return "ack";
|
||||
default:
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid comment type specified"));
|
||||
}
|
||||
}
|
||||
|
||||
static const std::set<String> propertiesBlacklistEmpty;
|
||||
|
||||
String IcingaDB::HashValue(const Value& value)
|
||||
|
@ -174,6 +174,7 @@ private:
|
||||
static String GetObjectIdentifier(const ConfigObject::Ptr& object);
|
||||
static String CalcEventID(const char* eventType, const ConfigObject::Ptr& object, double eventTime = 0, NotificationType nt = NotificationType(0));
|
||||
static const char* GetNotificationTypeByEnum(NotificationType type);
|
||||
static String CommentTypeToString(CommentType type);
|
||||
static Dictionary::Ptr SerializeVars(const Dictionary::Ptr& vars);
|
||||
static Dictionary::Ptr SerializeDependencyEdgeState(const DependencyGroup::Ptr& dependencyGroup, const Dependency::Ptr& dep);
|
||||
static Dictionary::Ptr SerializeRedundancyGroupState(const Checkable::Ptr& child, const DependencyGroup::Ptr& redundancyGroup);
|
||||
|
Loading…
x
Reference in New Issue
Block a user