[icinga-checkins] icinga.org: icinga-core/mfriedrich/core: enhanced diagnostic output when a regular expression fails to compile ( Max Schubert)

git at icinga.org git at icinga.org
Wed May 19 12:17:37 CEST 2010


Module: icinga-core
Branch: mfriedrich/core
Commit: ee1c9b2ef0f8d46b2b2c9cefbec4d2d121d562be
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=ee1c9b2ef0f8d46b2b2c9cefbec4d2d121d562be

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Wed May 19 12:17:32 2010 +0200

enhanced diagnostic output when a regular expression fails to compile (Max Schubert)

fixes #366

---

 Changelog           |    1 +
 xdata/xodtemplate.c |   10 ++++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/Changelog b/Changelog
index 937bd83..4b1ca3b 100644
--- a/Changelog
+++ b/Changelog
@@ -11,6 +11,7 @@ ENHANCEMENTS
 * core: add Icinga option -S functions much like -s but will dump the entire scheduling queue is it would run, 
         in addition to providing the summary data (Steven (Steven D. Morrey)
 * core: icinga can send log messages to syslogd using a local facility instead of the default one
+* core: enhanced diagnostic output when a regular expression fails to compile (Max Schubert)
 
 * cgi: add opt-in display_name from hosts/services definitions; if set, they will be shown in the classical ui
 * cgi: re-add quick search to navmenu in order to provide quick host/service lookups without idoutils/api
diff --git a/xdata/xodtemplate.c b/xdata/xodtemplate.c
index 1ed7c53..ed4480d 100644
--- a/xdata/xodtemplate.c
+++ b/xdata/xodtemplate.c
@@ -12147,6 +12147,7 @@ int xodtemplate_expand_contactgroups(xodtemplate_memberlist **list, xodtemplate_
 
 			/* compile regular expression */
 			if(regcomp(&preg,temp_ptr,REG_EXTENDED)){
+				logit(NSLOG_CONFIG_ERROR,TRUE,"Error: Invalid regular expression '%s' found while expanding contact group names in file '%s' starting on line %d. NOTE: regex could be inherited from a template in a different file.\n", temp_ptr, xodtemplate_config_file_name(_config_file), _start_line);
 				my_free(contactgroup_names);
 				return ERROR;
 		                }
@@ -12266,6 +12267,7 @@ int xodtemplate_expand_contacts(xodtemplate_memberlist **list, xodtemplate_membe
 
 			/* compile regular expression */
 			if(regcomp(&preg,temp_ptr,REG_EXTENDED)){
+				logit(NSLOG_CONFIG_ERROR,TRUE,"Error: Invalid regular expression '%s' found while expanding contact names in file '%s' starting on line %d. NOTE: regex could be inherited from a template in a different file.\n", temp_ptr, xodtemplate_config_file_name(_config_file), _start_line);
 				my_free(contact_names);
 				return ERROR;
 		                }
@@ -12489,6 +12491,7 @@ int xodtemplate_expand_hostgroups(xodtemplate_memberlist **list, xodtemplate_mem
 
 			/* compile regular expression */
 			if(regcomp(&preg,temp_ptr,REG_EXTENDED)){
+				logit(NSLOG_CONFIG_ERROR,TRUE,"Error: Invalid regular expression '%s' found while expanding host group names in file '%s' starting on line %d. NOTE: regex could be inherited from a template in a different file.\n", temp_ptr, xodtemplate_config_file_name(_config_file), _start_line);
 				my_free(hostgroup_names);
 				return ERROR;
 		                }
@@ -12608,6 +12611,7 @@ int xodtemplate_expand_hosts(xodtemplate_memberlist **list, xodtemplate_memberli
 
 			/* compile regular expression */
 			if(regcomp(&preg,temp_ptr,REG_EXTENDED)){
+				logit(NSLOG_CONFIG_ERROR,TRUE,"Error: Invalid regular expression '%s' found while expanding host names in file '%s' starting on line %d. NOTE: regex could be inherited from a template in a different file.\n", temp_ptr, xodtemplate_config_file_name(_config_file), _start_line);
 				my_free(host_names);
 				return ERROR;
 		                }
@@ -12820,6 +12824,7 @@ int xodtemplate_expand_servicegroups(xodtemplate_memberlist **list, xodtemplate_
 
 			/* compile regular expression */
 			if(regcomp(&preg,temp_ptr,REG_EXTENDED)){
+				logit(NSLOG_CONFIG_ERROR,TRUE,"Error: Invalid regular expression '%s' found while expanding service group names in file '%s' starting on line %d. NOTE: regex could be inherited from a template in a different file.\n", temp_ptr, xodtemplate_config_file_name(_config_file), _start_line);
 				my_free(servicegroup_names);
 				return ERROR;
 		                }
@@ -12928,6 +12933,7 @@ int xodtemplate_expand_services(xodtemplate_memberlist **list, xodtemplate_membe
 	/* compile regular expression for host name */
 	if(use_regexp_host==TRUE){
 		if(regcomp(&preg2,host_name,REG_EXTENDED))
+			logit(NSLOG_CONFIG_ERROR,TRUE,"Error: Invalid regular expression '%s' found while expanding host names in file '%s' starting on line %d. NOTE: regex could be inherited from a template in a different file.\n", host_name, xodtemplate_config_file_name(_config_file), _start_line);
 			return ERROR;
 	        }
 
@@ -12955,6 +12961,7 @@ int xodtemplate_expand_services(xodtemplate_memberlist **list, xodtemplate_membe
 		/* compile regular expression for service description */
 		if(use_regexp_service==TRUE){
 			if(regcomp(&preg,temp_ptr,REG_EXTENDED)){
+				logit(NSLOG_CONFIG_ERROR,TRUE,"Error: Invalid regular expression '%s' found while expanding service names in file '%s' starting on line %d. NOTE: regex could be inherited from a template in a different file.\n", temp_ptr, xodtemplate_config_file_name(_config_file), _start_line);
 				if(use_regexp_host==TRUE)
 					regfree(&preg2);
 				my_free(service_names);
@@ -13213,6 +13220,7 @@ int xodtemplate_get_hostgroup_names(xodtemplate_memberlist **list, xodtemplate_m
 
 			/* compile regular expression */
 			if(regcomp(&preg,temp_ptr,REG_EXTENDED)){
+				logit(NSLOG_CONFIG_ERROR,TRUE,"Error: Invalid regular expression '%s' found while expanding host group names in file '%s' starting on line %d. NOTE: regex could be inherited from a template in a different file.\n", temp_ptr, xodtemplate_config_file_name(_config_file), _start_line);
 				my_free(hostgroup_names);
 				return ERROR;
 		                }
@@ -13389,6 +13397,7 @@ int xodtemplate_get_contactgroup_names(xodtemplate_memberlist **list, xodtemplat
 
 			/* compile regular expression */
 			if(regcomp(&preg,temp_ptr,REG_EXTENDED)){
+				logit(NSLOG_CONFIG_ERROR,TRUE,"Error: Invalid regular expression '%s' found while expanding contact group names in file '%s' starting on line %d. NOTE: regex could be inherited from a template in a different file.\n", temp_ptr, xodtemplate_config_file_name(_config_file), _start_line);
 				my_free(contactgroup_names);
 				return ERROR;
 		                }
@@ -13565,6 +13574,7 @@ int xodtemplate_get_servicegroup_names(xodtemplate_memberlist **list, xodtemplat
 
 			/* compile regular expression */
 			if(regcomp(&preg,temp_ptr,REG_EXTENDED)){
+				logit(NSLOG_CONFIG_ERROR,TRUE,"Error: Invalid regular expression '%s' found while expanding service group names in file '%s' starting on line %d. NOTE: regex could be inherited from a template in a different file.\n", temp_ptr, xodtemplate_config_file_name(_config_file), _start_line);
 				my_free(servicegroup_names);
 				return ERROR;
 		                }





More information about the icinga-checkins mailing list