]> granicus.if.org Git - icinga2/commitdiff
Verify object type in the CIB class constructors.
authorGunnar Beutner <gunnar.beutner@netways.de>
Mon, 9 Jul 2012 14:38:01 +0000 (16:38 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Mon, 9 Jul 2012 14:38:01 +0000 (16:38 +0200)
cib/host.h
cib/hostgroup.h
cib/service.h
cib/servicegroup.h

index 719bac86e2cc0aaf36428a0f5b80f5eec8cfda49..156aaeefabf8131d73bafe78de4ce593dc52afe6 100644 (file)
@@ -9,7 +9,9 @@ class I2_CIB_API Host : public ConfigObjectAdapter
 public:
        Host(const ConfigObject::Ptr& configObject)
                : ConfigObjectAdapter(configObject)
-       { }
+       {
+               assert(GetType() == "host");
+       }
 
        static bool Exists(const string& name);
        static Host GetByName(const string& name);
index 3a5daf21ef034045adda9fe5db5b8193513566ec..025c1a819174935a5d2331cbf819c53d41e29a12 100644 (file)
@@ -9,7 +9,9 @@ class I2_CIB_API HostGroup : public ConfigObjectAdapter
 public:
        HostGroup(const ConfigObject::Ptr& configObject)
                : ConfigObjectAdapter(configObject)
-       { }
+       {
+               assert(GetType() == "hostgroup");
+       }
 
        static bool Exists(const string& name);
        static HostGroup GetByName(const string& name);
index 47978c73f0edeb01f7a9932cb3154c3c5c9c497d..a75abc8a60173cdd6576816ae341bca4f0e0e3f4 100644 (file)
@@ -27,7 +27,9 @@ class I2_CIB_API Service : public ConfigObjectAdapter
 public:
        Service(const ConfigObject::Ptr& configObject)
                : ConfigObjectAdapter(configObject)
-       { }
+       {
+               assert(GetType() == "service");
+       }
 
        static bool Exists(const string& name);
        static Service GetByName(const string& name);
index 6bde5232081d0dcce6febf7f7cd425a2e5a3ee13..51cd09111f00fa04296d7beaeb143c518cf08350 100644 (file)
@@ -9,7 +9,9 @@ class I2_CIB_API ServiceGroup : public ConfigObjectAdapter
 public:
        ServiceGroup(const ConfigObject::Ptr& configObject)
                : ConfigObjectAdapter(configObject)
-       { }
+       {
+               assert(GetType() == "servicegroup");
+       }
 
        static bool Exists(const string& name);
        static ServiceGroup GetByName(const string& name);