[icinga-checkins] icinga.org: icinga-core/feature/exclude-with-regexp-3720: core/ido: generic deprecation warning

git at icinga.org git at icinga.org
Sat Jul 20 13:54:45 CEST 2013


Module: icinga-core
Branch: feature/exclude-with-regexp-3720
Commit: b8ec7f4d712d6d0a54d95284a24dac656415523e
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=b8ec7f4d712d6d0a54d95284a24dac656415523e

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Sun Jun 30 17:13:14 2013 +0200

core/ido: generic deprecation warning

refs #2244
refs #4363

---

 base/config.c                |   20 ++++++++++++++++----
 module/idoutils/src/ido2db.c |   11 ++++++++++-
 2 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/base/config.c b/base/config.c
index 067b1dc..eadb783 100644
--- a/base/config.c
+++ b/base/config.c
@@ -260,6 +260,14 @@ int read_all_object_data(char *main_config_file) {
 	return OK;
 }
 
+/* log generic deprecation warning on variables */
+static void log_deprecation_warning(char *var) {
+
+	if (!var)
+		return;
+
+	logit(NSLOG_CONFIG_WARNING, TRUE, "Warning: config setting '%s' ignored. This has been deprecated. Remove it from your configuration!", var);
+}
 
 /* process the main configuration file */
 int read_main_config_file(char *main_config_file) {
@@ -631,10 +639,6 @@ int read_main_config_file(char *main_config_file) {
 			log_external_commands = (atoi(value) > 0) ? TRUE : FALSE;
 		}
 
-		else if (!strcmp(variable, "log_external_commands_user")) {
-			logit(NSLOG_CONFIG_WARNING, TRUE, "Warning: log_external_commands_user variable ignored. This has been deprecated.");
-		}
-
 		else if (!strcmp(variable, "log_passive_checks")) {
 
 			if (strlen(value) != 1 || value[0] < '0' || value[0] > '1') {
@@ -1514,6 +1518,14 @@ int read_main_config_file(char *main_config_file) {
 		else if (strstr(input, "precached_object_file=") == input)
 			continue;
 
+		/* DEPRECATED variables */
+		else if (!strcmp(variable, "log_external_commands_user")) {
+			log_deprecation_warning(variable);
+		}
+		else if (!strcmp(variable, "event_profiling_enabled")) {
+			log_deprecation_warning(variable);
+		}
+
 		/* we don't know what this variable is... */
 		else {
 			asprintf(&error_message, "UNKNOWN VARIABLE");
diff --git a/module/idoutils/src/ido2db.c b/module/idoutils/src/ido2db.c
index fa03fcb..d22d171 100644
--- a/module/idoutils/src/ido2db.c
+++ b/module/idoutils/src/ido2db.c
@@ -456,6 +456,15 @@ int ido2db_process_config_file(char *filename) {
 	return result;
 }
 
+/* log generic deprecation warning on variables */
+static void log_deprecation_warning(char *var) {
+
+	if (!var)
+		return;
+
+	syslog(LOG_USER | LOG_INFO, "Warning: config setting '%s' ignored. This has been deprecated. Remove it from your configuration!", var);
+}
+
 
 /* process a single module config variable */
 int ido2db_process_config_var(char *arg) {
@@ -611,7 +620,7 @@ int ido2db_process_config_var(char *arg) {
 	} else if (!strcmp(var, "oracle_trace_level")) {
 		ido2db_db_settings.oracle_trace_level = atoi(val);
 	} else if (!strcmp(var, "enable_sla")) {
-		syslog(LOG_USER | LOG_INFO, "Warning: enable_sla is deprecated!\n");
+		log_deprecation_warning(var);
 		enable_sla = (atoi(val) > 0) ? IDO_TRUE : IDO_FALSE;
 	} else if (!strcmp(var, "debug_readable_timestamp")) {
 		ido2db_debug_readable_timestamp = (atoi(val) > 0) ? IDO_TRUE : IDO_FALSE;





More information about the icinga-checkins mailing list