]> granicus.if.org Git - icinga2/commitdiff
Stop object in reversed activation priority order
authorMichael Friedrich <michael.friedrich@icinga.com>
Wed, 20 Feb 2019 11:38:57 +0000 (12:38 +0100)
committerMichael Friedrich <michael.friedrich@icinga.com>
Wed, 20 Feb 2019 11:38:57 +0000 (12:38 +0100)
This stops the checker component first, then notifications, then
features, then config objects, then the API feature and logger(s).

Patch taken from @al2klimov

lib/base/configobject.cpp

index b73285bc5dc1367dd920d8957ba04511d9f5b023..149917a43fb7ae3641fea82959f1d60ae140c784 100644 (file)
@@ -617,7 +617,15 @@ void ConfigObject::RestoreObjects(const String& filename, int attributeTypes)
 
 void ConfigObject::StopObjects()
 {
-       for (const Type::Ptr& type : Type::GetAllTypes()) {
+       std::vector<Type::Ptr> types = Type::GetAllTypes();
+
+       std::sort(types.begin(), types.end(), [](const Type::Ptr& a, const Type::Ptr& b) {
+               if (a->GetActivationPriority() > b->GetActivationPriority())
+                       return true;
+               return false;
+       });
+
+       for (const Type::Ptr& type : types) {
                auto *dtype = dynamic_cast<ConfigType *>(type.get());
 
                if (!dtype)