mirror of https://github.com/Icinga/icinga2.git
parent
208d035db4
commit
17fa327159
|
@ -303,8 +303,7 @@ int DaemonCommand::Run(const po::variables_map& vm, const std::vector<std::strin
|
||||||
sigaction(SIGHUP, &sa, NULL);
|
sigaction(SIGHUP, &sa, NULL);
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
/* update object authority */
|
ApiListener::UpdateObjectAuthority();
|
||||||
ApiListener::UpdateObjectAuthorityAsync();
|
|
||||||
|
|
||||||
return Application::GetInstance()->Run();
|
return Application::GetInstance()->Run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -431,6 +431,9 @@ void ApiListener::SyncClient(const JsonRpcConnection::Ptr& aclient, const Endpoi
|
||||||
|
|
||||||
ReplayLog(aclient);
|
ReplayLog(aclient);
|
||||||
|
|
||||||
|
if (endpoint->GetZone() == Zone::GetLocalZone())
|
||||||
|
UpdateObjectAuthority();
|
||||||
|
|
||||||
Log(LogInformation, "ApiListener")
|
Log(LogInformation, "ApiListener")
|
||||||
<< "Finished sending replay log for endpoint '" << endpoint->GetName() << "'.";
|
<< "Finished sending replay log for endpoint '" << endpoint->GetName() << "'.";
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
|
|
|
@ -98,7 +98,7 @@ public:
|
||||||
|
|
||||||
static Value HelloAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
static Value HelloAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
||||||
|
|
||||||
static void UpdateObjectAuthorityAsync(void);
|
static void UpdateObjectAuthority(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void OnConfigLoaded(void) override;
|
virtual void OnConfigLoaded(void) override;
|
||||||
|
|
|
@ -34,7 +34,7 @@ static bool ObjectNameLessComparer(const ConfigObject::Ptr& a, const ConfigObjec
|
||||||
return a->GetName() < b->GetName();
|
return a->GetName() < b->GetName();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AuthorityTimerHandler(void)
|
void ApiListener::UpdateObjectAuthority(void)
|
||||||
{
|
{
|
||||||
Zone::Ptr my_zone = Zone::GetLocalZone();
|
Zone::Ptr my_zone = Zone::GetLocalZone();
|
||||||
|
|
||||||
|
@ -80,16 +80,11 @@ static void AuthorityTimerHandler(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiListener::UpdateObjectAuthorityAsync(void)
|
|
||||||
{
|
|
||||||
l_AuthorityTimer->Reschedule(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void StaticInitialize(void)
|
static void StaticInitialize(void)
|
||||||
{
|
{
|
||||||
l_AuthorityTimer = new Timer();
|
l_AuthorityTimer = new Timer();
|
||||||
l_AuthorityTimer->OnTimerExpired.connect(boost::bind(&AuthorityTimerHandler));
|
l_AuthorityTimer->OnTimerExpired.connect(boost::bind(&ApiListener::UpdateObjectAuthority));
|
||||||
l_AuthorityTimer->SetInterval(15);
|
l_AuthorityTimer->SetInterval(30);
|
||||||
l_AuthorityTimer->Start();
|
l_AuthorityTimer->Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include "remote/configobjectutility.hpp"
|
#include "remote/configobjectutility.hpp"
|
||||||
#include "remote/configpackageutility.hpp"
|
#include "remote/configpackageutility.hpp"
|
||||||
|
#include "remote/apilistener.hpp"
|
||||||
#include "config/configcompiler.hpp"
|
#include "config/configcompiler.hpp"
|
||||||
#include "config/configitem.hpp"
|
#include "config/configitem.hpp"
|
||||||
#include "base/configwriter.hpp"
|
#include "base/configwriter.hpp"
|
||||||
|
@ -149,6 +150,8 @@ bool ConfigObjectUtility::CreateObject(const Type::Ptr& type, const String& full
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ApiListener::UpdateObjectAuthority();
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
delete expr;
|
delete expr;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue