From 01fe243f232dbcbb3e0e17a7008cc88fcbd519b4 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Wed, 7 Aug 2019 12:03:17 +0200 Subject: [PATCH] Log a hint after failed config validation for systemd users --- lib/cli/daemoncommand.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/cli/daemoncommand.cpp b/lib/cli/daemoncommand.cpp index 4975536ac..a9619c34a 100644 --- a/lib/cli/daemoncommand.cpp +++ b/lib/cli/daemoncommand.cpp @@ -206,8 +206,10 @@ int RunWorker(const std::vector& configs, bool closeConsoleLog = fa { std::vector newItems; - if (!DaemonUtility::LoadConfigFiles(configs, newItems, Configuration::ObjectsPath, Configuration::VarsPath)) + if (!DaemonUtility::LoadConfigFiles(configs, newItems, Configuration::ObjectsPath, Configuration::VarsPath)) { + Log(LogCritical, "cli", "Config validation failed. Re-run with 'icinga2 daemon -C' after fixing the config."); return EXIT_FAILURE; + } #ifndef _WIN32 Log(LogNotice, "cli") @@ -571,8 +573,10 @@ int DaemonCommand::Run(const po::variables_map& vm, const std::vector newItems; - if (!DaemonUtility::LoadConfigFiles(configs, newItems, Configuration::ObjectsPath, Configuration::VarsPath)) + if (!DaemonUtility::LoadConfigFiles(configs, newItems, Configuration::ObjectsPath, Configuration::VarsPath)) { + Log(LogCritical, "cli", "Config validation failed. Re-run with 'icinga2 daemon -C' after fixing the config."); return EXIT_FAILURE; + } Log(LogInformation, "cli", "Finished validating the configuration file(s)."); return EXIT_SUCCESS; -- 2.40.0