mirror of https://github.com/Icinga/icinga2.git
Merge pull request #9524 from Icinga/introduce-object-idx
Introduce object identifier attr
This commit is contained in:
commit
2a4dc083ae
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue