mirror of https://github.com/Icinga/icinga2.git
Fix missing insert IDs for hostgroups.
This commit is contained in:
parent
7aef2e75df
commit
17f1b98575
|
@ -20,7 +20,6 @@
|
||||||
#include "ido/hostgroupdbobject.h"
|
#include "ido/hostgroupdbobject.h"
|
||||||
#include "ido/dbtype.h"
|
#include "ido/dbtype.h"
|
||||||
#include "ido/dbvalue.h"
|
#include "ido/dbvalue.h"
|
||||||
#include "icinga/hostgroup.h"
|
|
||||||
#include "base/objectlock.h"
|
#include "base/objectlock.h"
|
||||||
#include "base/initialize.h"
|
#include "base/initialize.h"
|
||||||
#include "base/dynamictype.h"
|
#include "base/dynamictype.h"
|
||||||
|
@ -37,7 +36,7 @@ HostGroupDbObject::HostGroupDbObject(const DbType::Ptr& type, const String& name
|
||||||
|
|
||||||
void HostGroupDbObject::StaticInitialize(void)
|
void HostGroupDbObject::StaticInitialize(void)
|
||||||
{
|
{
|
||||||
HostGroup::OnMembersChanged.connect(&HostGroupDbObject::MembersChangedHandler);
|
HostGroup::OnMembersChanged.connect(boost::bind(&HostGroupDbObject::MembersChangedHandler, HostGroup::Ptr()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary::Ptr HostGroupDbObject::GetConfigFields(void) const
|
Dictionary::Ptr HostGroupDbObject::GetConfigFields(void) const
|
||||||
|
@ -57,10 +56,11 @@ Dictionary::Ptr HostGroupDbObject::GetStatusFields(void) const
|
||||||
|
|
||||||
void HostGroupDbObject::OnConfigUpdate(void)
|
void HostGroupDbObject::OnConfigUpdate(void)
|
||||||
{
|
{
|
||||||
MembersChangedHandler();
|
HostGroup::Ptr group = static_pointer_cast<HostGroup>(GetObject());
|
||||||
|
MembersChangedHandler(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HostGroupDbObject::MembersChangedHandler(void)
|
void HostGroupDbObject::MembersChangedHandler(const HostGroup::Ptr& hgfilter)
|
||||||
{
|
{
|
||||||
DbQuery query1;
|
DbQuery query1;
|
||||||
query1.Table = DbType::GetByName("HostGroup")->GetTable() + "_members";
|
query1.Table = DbType::GetByName("HostGroup")->GetTable() + "_members";
|
||||||
|
@ -72,6 +72,9 @@ void HostGroupDbObject::MembersChangedHandler(void)
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("HostGroup")) {
|
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("HostGroup")) {
|
||||||
HostGroup::Ptr hg = static_pointer_cast<HostGroup>(object);
|
HostGroup::Ptr hg = static_pointer_cast<HostGroup>(object);
|
||||||
|
|
||||||
|
if (hgfilter && hg != hgfilter)
|
||||||
|
continue;
|
||||||
|
|
||||||
BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
|
BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
|
||||||
DbQuery query2;
|
DbQuery query2;
|
||||||
query2.Table = DbType::GetByName("HostGroup")->GetTable() + "_members";
|
query2.Table = DbType::GetByName("HostGroup")->GetTable() + "_members";
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#define HOSTGROUPDBOBJECT_H
|
#define HOSTGROUPDBOBJECT_H
|
||||||
|
|
||||||
#include "ido/dbobject.h"
|
#include "ido/dbobject.h"
|
||||||
|
#include "icinga/hostgroup.h"
|
||||||
#include "base/dynamicobject.h"
|
#include "base/dynamicobject.h"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
|
@ -47,7 +48,7 @@ protected:
|
||||||
virtual void OnConfigUpdate(void);
|
virtual void OnConfigUpdate(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void MembersChangedHandler(void);
|
static void MembersChangedHandler(const HostGroup::Ptr& hgfilter);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue