mirror of https://github.com/Icinga/icinga2.git
Merge pull request #7653 from Icinga/bugfix/icingadb-expire_time-null
IcingaDB: don't always set Comment#expire_time
This commit is contained in:
commit
284d131f61
|
@ -970,7 +970,6 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a
|
||||||
attributes->Set("entry_time", TimestampToMilliseconds(comment->GetEntryTime()));
|
attributes->Set("entry_time", TimestampToMilliseconds(comment->GetEntryTime()));
|
||||||
attributes->Set("is_persistent", comment->GetPersistent());
|
attributes->Set("is_persistent", comment->GetPersistent());
|
||||||
attributes->Set("is_sticky", comment->GetEntryType() == CommentAcknowledgement && comment->GetCheckable()->GetAcknowledgement() == AcknowledgementSticky);
|
attributes->Set("is_sticky", comment->GetEntryType() == CommentAcknowledgement && comment->GetCheckable()->GetAcknowledgement() == AcknowledgementSticky);
|
||||||
attributes->Set("expire_time", TimestampToMilliseconds(comment->GetExpireTime()));
|
|
||||||
|
|
||||||
Host::Ptr host;
|
Host::Ptr host;
|
||||||
Service::Ptr service;
|
Service::Ptr service;
|
||||||
|
@ -985,6 +984,12 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a
|
||||||
attributes->Set("service_id", "00000000000000000000000000000000");
|
attributes->Set("service_id", "00000000000000000000000000000000");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto expireTime (comment->GetExpireTime());
|
||||||
|
|
||||||
|
if (expireTime > 0) {
|
||||||
|
attributes->Set("expire_time", TimestampToMilliseconds(expireTime));
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1453,7 +1458,6 @@ void IcingaDB::SendAddedComment(const Comment::Ptr& comment)
|
||||||
"entry_type", Convert::ToString(comment->GetEntryType()),
|
"entry_type", Convert::ToString(comment->GetEntryType()),
|
||||||
"is_persistent", Convert::ToString((unsigned short)comment->GetPersistent()),
|
"is_persistent", Convert::ToString((unsigned short)comment->GetPersistent()),
|
||||||
"is_sticky", Convert::ToString((unsigned short)(comment->GetEntryType() == CommentAcknowledgement && comment->GetCheckable()->GetAcknowledgement() == AcknowledgementSticky)),
|
"is_sticky", Convert::ToString((unsigned short)(comment->GetEntryType() == CommentAcknowledgement && comment->GetCheckable()->GetAcknowledgement() == AcknowledgementSticky)),
|
||||||
"expire_time", Convert::ToString(TimestampToMilliseconds(comment->GetExpireTime())),
|
|
||||||
"event_id", Utility::NewUniqueID(),
|
"event_id", Utility::NewUniqueID(),
|
||||||
"event_type", "comment_add"
|
"event_type", "comment_add"
|
||||||
});
|
});
|
||||||
|
@ -1475,6 +1479,15 @@ void IcingaDB::SendAddedComment(const Comment::Ptr& comment)
|
||||||
xAdd.emplace_back(GetObjectIdentifier(endpoint));
|
xAdd.emplace_back(GetObjectIdentifier(endpoint));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto expireTime (comment->GetExpireTime());
|
||||||
|
|
||||||
|
if (expireTime > 0) {
|
||||||
|
xAdd.emplace_back("expire_time");
|
||||||
|
xAdd.emplace_back(Convert::ToString(TimestampToMilliseconds(expireTime)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_Rcon->FireAndForgetQuery(std::move(xAdd));
|
m_Rcon->FireAndForgetQuery(std::move(xAdd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1500,7 +1513,6 @@ void IcingaDB::SendRemovedComment(const Comment::Ptr& comment)
|
||||||
"entry_type", Convert::ToString(comment->GetEntryType()),
|
"entry_type", Convert::ToString(comment->GetEntryType()),
|
||||||
"is_persistent", Convert::ToString((unsigned short)comment->GetPersistent()),
|
"is_persistent", Convert::ToString((unsigned short)comment->GetPersistent()),
|
||||||
"is_sticky", Convert::ToString((unsigned short)(comment->GetEntryType() == CommentAcknowledgement && comment->GetCheckable()->GetAcknowledgement() == AcknowledgementSticky)),
|
"is_sticky", Convert::ToString((unsigned short)(comment->GetEntryType() == CommentAcknowledgement && comment->GetCheckable()->GetAcknowledgement() == AcknowledgementSticky)),
|
||||||
"expire_time", Convert::ToString(TimestampToMilliseconds(comment->GetExpireTime())),
|
|
||||||
"event_id", Utility::NewUniqueID(),
|
"event_id", Utility::NewUniqueID(),
|
||||||
"event_type", "comment_remove"
|
"event_type", "comment_remove"
|
||||||
});
|
});
|
||||||
|
@ -1532,6 +1544,15 @@ void IcingaDB::SendRemovedComment(const Comment::Ptr& comment)
|
||||||
xAdd.emplace_back("0");
|
xAdd.emplace_back("0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto expireTime (comment->GetExpireTime());
|
||||||
|
|
||||||
|
if (expireTime > 0) {
|
||||||
|
xAdd.emplace_back("expire_time");
|
||||||
|
xAdd.emplace_back(Convert::ToString(TimestampToMilliseconds(expireTime)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_Rcon->FireAndForgetQuery(std::move(xAdd));
|
m_Rcon->FireAndForgetQuery(std::move(xAdd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue