[icinga-checkins] icinga.org: icinga-core/test/core: core: fix keep_unknown_macros still exposes wrong warnings to logs refs #3725
git at icinga.org
git at icinga.org
Mon Mar 4 18:38:13 CET 2013
Module: icinga-core
Branch: test/core
Commit: d2b7951cb02ac9e6a6001d577104250941d7d879
URL: https://git.icinga.org/?p=icinga-core.git;a=commit;h=d2b7951cb02ac9e6a6001d577104250941d7d879
Author: Michael Friedrich <michael.friedrich at netways.de>
Date: Thu Feb 21 20:12:31 2013 +0100
core: fix keep_unknown_macros still exposes wrong warnings to logs refs #3725
---
Changelog | 1 +
common/macros.c | 13 ++++++++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/Changelog b/Changelog
index c94569e..ab8f8a1 100644
--- a/Changelog
+++ b/Changelog
@@ -33,6 +33,7 @@ FIXES
* core: fix macro escaping logs incorrect warning for $$escapes #3404 - MF
* core: fix wrong escalation notification due to state based escalation range behaviour changes #3441 - MF
* core: change ownership of debug log file before dropping privileges (Eric Stanley) #3521 - MF
+* core: fix keep_unknown_macros still exposes wrong warnings to logs #3725 - MF
* idoutils: fix many memory leaks in ido2db on dbi_result_free and others (thx Klaus Wagner) #3406 - MF
* idoutils: fix ido2db crashes when Oracle queries fail #3324 - GB
diff --git a/common/macros.c b/common/macros.c
index 0b4a32c..fd5fe97 100644
--- a/common/macros.c
+++ b/common/macros.c
@@ -200,13 +200,20 @@ int process_macros_r(icinga_macros *mac, char *input_buffer, char **output_buffe
/* grab the macro value */
result = grab_macro_value_r(mac, temp_buffer, &selected_macro, &clean_options, &free_macro);
- log_debug_info(DEBUGL_MACROS, 2, " Processed '%s', Clean Options: %d, Free: %d\n", temp_buffer, clean_options, free_macro);
+ log_debug_info(DEBUGL_MACROS, 2, " Processed '%s', Clean Options: %d, Free: %d\n, Value: '%s'", temp_buffer, clean_options, free_macro, selected_macro ? selected_macro : "");
/* an error occurred - we couldn't parse the macro, so continue on */
if (result == ERROR) {
/* empty string still could mean that we hit the escaped $, so log an error in all other cases */
- if(strcmp(temp_buffer, ""))
- logit(NSLOG_RUNTIME_WARNING, TRUE, "Warning: An error occurred processing macro '%s'!\n", temp_buffer);
+ /* the error tells the user that the macro is valid, but value fetching contained error*/
+ if(strcmp(temp_buffer, "")) {
+ log_debug_info(DEBUGL_MACROS, 2, " Warning: Error grabbing macro '%s' value '%s'! Maybe used in the wrong scope? Check the docs.\n", temp_buffer, selected_macro ? selected_macro : "" );
+#ifdef NSCORE
+ if (keep_unknown_macros == FALSE) {
+ logit(NSLOG_RUNTIME_WARNING, TRUE, "Warning: Error grabbing macro '%s' value '%s'! Maybe used in the wrong scope? Check the docs.\n", temp_buffer, selected_macro ? selected_macro : "" );
+ }
+#endif
+ }
if (free_macro == TRUE)
my_free(selected_macro);
More information about the icinga-checkins
mailing list