Merge pull request #9524 from Icinga/introduce-object-idx

Introduce object identifier attr
This commit is contained in:
Julian Brost 2022-10-07 10:19:59 +02:00 committed by GitHub
commit 2a4dc083ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -88,6 +88,7 @@ abstract class ConfigObject : ConfigObjectBase < ConfigType
[state, no_user_modify] double version {
default {{{ return 0; }}}
};
[no_user_view, no_user_modify] String icingadb_identifier;
};
}

View File

@ -62,7 +62,13 @@ String IcingaDB::FormatCommandLine(const Value& commandLine)
String IcingaDB::GetObjectIdentifier(const ConfigObject::Ptr& object)
{
return HashValue(new Array({m_EnvironmentId, object->GetName()}));
String identifier = object->GetIcingadbIdentifier();
if (identifier.IsEmpty()) {
identifier = HashValue(new Array({m_EnvironmentId, object->GetName()}));
object->SetIcingadbIdentifier(identifier);
}
return identifier;
}
/**