mirror of https://github.com/Icinga/icinga2.git
RedisWriter: identify config objects by SHA1(PackObject([Environment, __name]))
This commit is contained in:
parent
fae5b88e48
commit
4eee9572ab
|
@ -43,11 +43,6 @@ void RedisWriter::ConfigStaticInitialize()
|
|||
ConfigObject::OnVersionChanged.connect(std::bind(&RedisWriter::VersionChangedHandler, _1));
|
||||
}
|
||||
|
||||
static inline String GetIdentifier(const ConfigObject::Ptr& object)
|
||||
{
|
||||
return object->GetName();
|
||||
}
|
||||
|
||||
void RedisWriter::UpdateAllConfigObjects(void)
|
||||
{
|
||||
AssertOnWorkQueue();
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include "base/tlsutility.hpp"
|
||||
#include "base/initialize.hpp"
|
||||
#include "base/objectlock.hpp"
|
||||
#include "base/array.hpp"
|
||||
#include "base/scriptglobal.hpp"
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
|
@ -37,6 +39,13 @@ String RedisWriter::FormatCheckSumBinary(const String& str)
|
|||
return output;
|
||||
}
|
||||
|
||||
static Value l_DefaultEnv = "production";
|
||||
|
||||
String RedisWriter::GetIdentifier(const ConfigObject::Ptr& object)
|
||||
{
|
||||
return HashValue((Array::Ptr)new Array({ScriptGlobal::Get("Environment", &l_DefaultEnv), object->GetName()}));
|
||||
}
|
||||
|
||||
String RedisWriter::CalculateCheckSumString(const String& str)
|
||||
{
|
||||
return SHA1(str);
|
||||
|
|
|
@ -77,6 +77,7 @@ private:
|
|||
/* utilities */
|
||||
static String FormatCheckSumBinary(const String& str);
|
||||
|
||||
static String GetIdentifier(const ConfigObject::Ptr& object);
|
||||
static String CalculateCheckSumString(const String& str);
|
||||
static String CalculateCheckSumGroups(const Array::Ptr& groups);
|
||||
static String CalculateCheckSumProperties(const ConfigObject::Ptr& object, const std::set<String>& propertiesBlacklist);
|
||||
|
|
Loading…
Reference in New Issue