fix for reload with scanconfig

This commit is contained in:
john30
2015-11-08 10:54:32 +01:00
parent 9fecc3a766
commit 41b6e91295
2 changed files with 5 additions and 6 deletions
+4 -4
View File
@@ -574,7 +574,7 @@ static result_t readConfigFiles(const string path, const string extension, DataF
return RESULT_OK; return RESULT_OK;
}; };
result_t loadConfigFiles(MessageMap* messages, bool recursive, bool verbose) result_t loadConfigFiles(MessageMap* messages, bool verbose)
{ {
logInfo(lf_main, "loading configuration files from %s", opt.configPath); logInfo(lf_main, "loading configuration files from %s", opt.configPath);
string path = string(opt.configPath); string path = string(opt.configPath);
@@ -586,7 +586,7 @@ result_t loadConfigFiles(MessageMap* messages, bool recursive, bool verbose)
else else
logError(lf_main, "error reading templates: %s, %s", getResultCode(result), globalTemplates.getLastError().c_str()); logError(lf_main, "error reading templates: %s, %s", getResultCode(result), globalTemplates.getLastError().c_str());
result = readConfigFiles(path, ".csv", &globalTemplates, messages, recursive, verbose); result = readConfigFiles(path, ".csv", &globalTemplates, messages, !opt.scanConfig, verbose);
if (result == RESULT_OK) if (result == RESULT_OK)
logInfo(lf_main, "read config files"); logInfo(lf_main, "read config files");
else else
@@ -801,7 +801,7 @@ int main(int argc, char* argv[])
if (opt.checkConfig) { if (opt.checkConfig) {
logNotice(lf_main, "Performing configuration check..."); logNotice(lf_main, "Performing configuration check...");
result_t result = loadConfigFiles(&messages, !opt.scanConfig, true); result_t result = loadConfigFiles(&messages, true);
if (result == RESULT_OK && opt.checkConfig > 1) { if (result == RESULT_OK && opt.checkConfig > 1) {
logNotice(lf_main, "Configuration dump:"); logNotice(lf_main, "Configuration dump:");
@@ -833,7 +833,7 @@ int main(int argc, char* argv[])
logNotice(lf_main, PACKAGE_STRING " started"); logNotice(lf_main, PACKAGE_STRING " started");
// load configuration files // load configuration files
loadConfigFiles(&messages, !opt.scanConfig); loadConfigFiles(&messages);
if (messages.sizeConditions()>0 && opt.pollInterval==0) if (messages.sizeConditions()>0 && opt.pollInterval==0)
logError(lf_main, "conditions require a poll interval > 0"); logError(lf_main, "conditions require a poll interval > 0");
+1 -2
View File
@@ -64,11 +64,10 @@ struct options
/** /**
* Load the message definitions from configuration files. * Load the message definitions from configuration files.
* @param messages the @a MessageMap to load the messages into. * @param messages the @a MessageMap to load the messages into.
* @param recursive whether to load all files recursively.
* @param verbose whether to verbosely log problems. * @param verbose whether to verbosely log problems.
* @return the result code. * @return the result code.
*/ */
result_t loadConfigFiles(MessageMap* messages, bool recursive=true, bool verbose=false); result_t loadConfigFiles(MessageMap* messages, bool verbose=false);
/** /**
* Load the message definitions from a configuration file matching the scan result. * Load the message definitions from a configuration file matching the scan result.