Merge pull request #9058 from Icinga/bugfix/icingadb-prefix-command_id

IcingaDB: Prefix command_id with command type
This commit is contained in:
Noah Hilverling 2021-11-11 11:50:26 +01:00 committed by GitHub
commit 4e79eb080c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 10 deletions

View File

@ -132,7 +132,7 @@ void IcingaDB::ConfigStaticInitialize()
void IcingaDB::UpdateAllConfigObjects()
{
m_Rcon->Sync();
m_Rcon->FireAndForgetQuery({"XADD", "icinga:schema", "MAXLEN", "1", "*", "version", "3"}, Prio::Heartbeat);
m_Rcon->FireAndForgetQuery({"XADD", "icinga:schema", "MAXLEN", "1", "*", "version", "4"}, Prio::Heartbeat);
Log(LogInformation, "IcingaDB") << "Starting initial config/status dump";
double startTime = Utility::GetTime();
@ -602,14 +602,9 @@ void IcingaDB::InsertObjectDependencies(const ConfigObject::Ptr& object, const S
std::vector<Dictionary::Ptr>& runtimeUpdates, bool runtimeUpdate)
{
String objectKey = GetObjectIdentifier(object);
String objectKeyName;
String objectKeyName = typeName + "_id";
Type::Ptr type = object->GetReflectionType();
if (type == CheckCommand::TypeInstance || type == NotificationCommand::TypeInstance || type == EventCommand::TypeInstance) {
objectKeyName = "command_id";
} else {
objectKeyName = typeName + "_id";
}
CustomVarObject::Ptr customVarObject = dynamic_pointer_cast<CustomVarObject>(object);
@ -975,7 +970,7 @@ void IcingaDB::InsertObjectDependencies(const ConfigObject::Ptr& object, const S
}
}
values->Set("command_id", objectKey);
values->Set(objectKeyName, objectKey);
values->Set("argument_key", kv.first);
values->Set("environment_id", m_EnvironmentId);
@ -1024,7 +1019,7 @@ void IcingaDB::InsertObjectDependencies(const ConfigObject::Ptr& object, const S
}
}
values->Set("command_id", objectKey);
values->Set(objectKeyName, objectKey);
values->Set("envvar_key", kv.first);
values->Set("environment_id", m_EnvironmentId);
@ -1276,7 +1271,7 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a
tie(host, service) = GetHostService(notification->GetCheckable());
attributes->Set("command_id", GetObjectIdentifier(notification->GetCommand()));
attributes->Set("notificationcommand_id", GetObjectIdentifier(notification->GetCommand()));
attributes->Set("host_id", GetObjectIdentifier(host));
if (service)