mirror of https://github.com/Icinga/icinga2.git
Implement handler for hostgroup changes.
This commit is contained in:
parent
7e01b2bb47
commit
7a96794dbc
|
@ -22,16 +22,24 @@
|
|||
#include "ido/dbvalue.h"
|
||||
#include "icinga/hostgroup.h"
|
||||
#include "base/objectlock.h"
|
||||
#include "base/initialize.h"
|
||||
#include "base/logger_fwd.h"
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
REGISTER_DBTYPE(HostGroup, "hostgroup", 3, "hostgroup_object_id", HostGroupDbObject);
|
||||
INITIALIZE_ONCE(HostGroupDbObject, &HostGroupDbObject::StaticInitialize);
|
||||
|
||||
HostGroupDbObject::HostGroupDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
|
||||
: DbObject(type, name1, name2)
|
||||
{ }
|
||||
|
||||
void HostGroupDbObject::StaticInitialize(void)
|
||||
{
|
||||
HostGroup::OnMembersChanged.connect(&HostGroupDbObject::MembersChangedHandler);
|
||||
}
|
||||
|
||||
Dictionary::Ptr HostGroupDbObject::GetConfigFields(void) const
|
||||
{
|
||||
Dictionary::Ptr fields = boost::make_shared<Dictionary>();
|
||||
|
@ -46,3 +54,13 @@ Dictionary::Ptr HostGroupDbObject::GetStatusFields(void) const
|
|||
{
|
||||
return Empty;
|
||||
}
|
||||
|
||||
void HostGroupDbObject::OnConfigUpdate(void)
|
||||
{
|
||||
MembersChangedHandler();
|
||||
}
|
||||
|
||||
void HostGroupDbObject::MembersChangedHandler(void)
|
||||
{
|
||||
Log(LogWarning, "ido", "MOO");
|
||||
}
|
||||
|
|
|
@ -38,8 +38,16 @@ public:
|
|||
|
||||
HostGroupDbObject(const DbType::Ptr& type, const String& name1, const String& name2);
|
||||
|
||||
static void StaticInitialize(void);
|
||||
|
||||
virtual Dictionary::Ptr GetConfigFields(void) const;
|
||||
virtual Dictionary::Ptr GetStatusFields(void) const;
|
||||
|
||||
protected:
|
||||
virtual void OnConfigUpdate(void);
|
||||
|
||||
private:
|
||||
static void MembersChangedHandler(void);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue