mirror of https://github.com/Icinga/icinga2.git
Verify object type in the CIB class constructors.
This commit is contained in:
parent
0032e32026
commit
c7788f73c2
|
@ -9,7 +9,9 @@ class I2_CIB_API Host : public ConfigObjectAdapter
|
||||||
public:
|
public:
|
||||||
Host(const ConfigObject::Ptr& configObject)
|
Host(const ConfigObject::Ptr& configObject)
|
||||||
: ConfigObjectAdapter(configObject)
|
: ConfigObjectAdapter(configObject)
|
||||||
{ }
|
{
|
||||||
|
assert(GetType() == "host");
|
||||||
|
}
|
||||||
|
|
||||||
static bool Exists(const string& name);
|
static bool Exists(const string& name);
|
||||||
static Host GetByName(const string& name);
|
static Host GetByName(const string& name);
|
||||||
|
|
|
@ -9,7 +9,9 @@ class I2_CIB_API HostGroup : public ConfigObjectAdapter
|
||||||
public:
|
public:
|
||||||
HostGroup(const ConfigObject::Ptr& configObject)
|
HostGroup(const ConfigObject::Ptr& configObject)
|
||||||
: ConfigObjectAdapter(configObject)
|
: ConfigObjectAdapter(configObject)
|
||||||
{ }
|
{
|
||||||
|
assert(GetType() == "hostgroup");
|
||||||
|
}
|
||||||
|
|
||||||
static bool Exists(const string& name);
|
static bool Exists(const string& name);
|
||||||
static HostGroup GetByName(const string& name);
|
static HostGroup GetByName(const string& name);
|
||||||
|
|
|
@ -27,7 +27,9 @@ class I2_CIB_API Service : public ConfigObjectAdapter
|
||||||
public:
|
public:
|
||||||
Service(const ConfigObject::Ptr& configObject)
|
Service(const ConfigObject::Ptr& configObject)
|
||||||
: ConfigObjectAdapter(configObject)
|
: ConfigObjectAdapter(configObject)
|
||||||
{ }
|
{
|
||||||
|
assert(GetType() == "service");
|
||||||
|
}
|
||||||
|
|
||||||
static bool Exists(const string& name);
|
static bool Exists(const string& name);
|
||||||
static Service GetByName(const string& name);
|
static Service GetByName(const string& name);
|
||||||
|
|
|
@ -9,7 +9,9 @@ class I2_CIB_API ServiceGroup : public ConfigObjectAdapter
|
||||||
public:
|
public:
|
||||||
ServiceGroup(const ConfigObject::Ptr& configObject)
|
ServiceGroup(const ConfigObject::Ptr& configObject)
|
||||||
: ConfigObjectAdapter(configObject)
|
: ConfigObjectAdapter(configObject)
|
||||||
{ }
|
{
|
||||||
|
assert(GetType() == "servicegroup");
|
||||||
|
}
|
||||||
|
|
||||||
static bool Exists(const string& name);
|
static bool Exists(const string& name);
|
||||||
static ServiceGroup GetByName(const string& name);
|
static ServiceGroup GetByName(const string& name);
|
||||||
|
|
Loading…
Reference in New Issue