]> granicus.if.org Git - icinga2/commitdiff
Don't validate config items if we've already encountered an error.
authorGunnar Beutner <gunnar.beutner@netways.de>
Fri, 15 Mar 2013 10:18:02 +0000 (11:18 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Fri, 15 Mar 2013 10:18:02 +0000 (11:18 +0100)
icinga-app/icinga.cpp

index af5c566fc559a7ad7f1f1943860e8937425ce628..2350259d1a34e61ed42abbb6e122b0102ebbcafd 100644 (file)
@@ -49,16 +49,27 @@ static bool LoadConfigFiles(bool validateOnly)
        }
 
        String name, fragment;
-       BOOST_FOREACH(tie(name, fragment), ConfigCompiler::GetConfigFragments()) {
+       BOOST_FOREACH(tie(name, fragment), ConfigFragmentRegistry::GetInstance()->GetItems()) {
                ConfigCompiler::CompileText(name, fragment);
        }
 
        ConfigCompilerContext::SetContext(NULL);
 
-       context.Validate();
-
        bool hasError = false;
 
+       BOOST_FOREACH(const ConfigCompilerError& error, context.GetErrors()) {
+               if (!error.Warning) {
+                       hasError = true;
+                       break;
+               }
+       }
+
+       /* Don't validate if we have already encountered at least one error. */
+       if (!hasError)
+               context.Validate();
+
+       hasError = false;
+
        BOOST_FOREACH(const ConfigCompilerError& error, context.GetErrors()) {
                if (error.Warning) {
                        Logger::Write(LogWarning, "icinga-app", "Config warning: " + error.Message);