[icinga-checkins] icinga.org: icinga-core/r1.7: core: bail out early with config error if resource. cfg macros contain NULL values #2879

git at icinga.org git at icinga.org
Sun Aug 19 19:44:44 CEST 2012


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

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Tue Jul 31 12:46:49 2012 +0200

core: bail out early with config error if resource.cfg macros contain NULL values #2879

plus
core: fix logical bug on icinga.cfg detection on config read #2879
core: add hint on icinga.cfg package location, and tip to read
Changelog CHANGES on upgrades #2879

refs #2879

Conflicts:
	Changelog

---

 Changelog     |    3 +++
 base/config.c |    6 +++++-
 base/icinga.c |    6 ++++--
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/Changelog b/Changelog
index cc715ee..2b52426 100644
--- a/Changelog
+++ b/Changelog
@@ -14,6 +14,9 @@ FIXES
 * core: get rid of the instame macro usage while logging alerts and states (Andreas Ericsson) #2665 - MF
 * core: revamp the detection of embedded perl usage directive "# icinga: +epn" (Andreas Ericsson) #2197 - MF
 * core: fix whitespaces are not stripped using multiple templates ("use abc, def, ghi") #2701 - MF
+* core: add hint on icinga.cfg package location, and tip to read Changelog CHANGES on upgrades #2879 - MF
+* core: bail out early with config error if resource.cfg macros contain NULL values #2879 - MF
+* core: fix logical bug on icinga.cfg detection on config read #2879 - MF
 
 * idoutils: fix icinga mysql db creation script grants access to all dbs #2917 - MF
 
diff --git a/base/config.c b/base/config.c
index d01cd86..49aec0f 100644
--- a/base/config.c
+++ b/base/config.c
@@ -346,7 +346,11 @@ int read_main_config_file(char *main_config_file) {
 			mac->x[MACRO_RESOURCEFILE] = (char *)strdup(value);
 
 			/* process the resource file */
-			read_resource_file(value);
+			if(read_resource_file(value) == ERROR) {
+                                dummy = asprintf(&error_message, "Resource file parsing failed");
+				error = TRUE;
+				break;
+			}
 		}
 
 		else if (!strcmp(variable, "log_file")) {
diff --git a/base/icinga.c b/base/icinga.c
index 3499b7c..da46ce5 100644
--- a/base/icinga.c
+++ b/base/icinga.c
@@ -521,12 +521,13 @@ int main(int argc, char **argv, char **env) {
 		if (result != OK) {
 
 			/* if the config filename looks fishy, warn the user */
-			if (!strstr(config_file, "nagios.cfg") || !strstr(config_file, "icinga.cfg")) {
+			if (!strstr(config_file, "nagios.cfg") && !strstr(config_file, "icinga.cfg")) {
 				printf("\n***> The name of the main configuration file looks suspicious...\n");
 				printf("\n");
 				printf("     Make sure you are specifying the name of the MAIN configuration file on\n");
 				printf("     the command line and not the name of another configuration file.  The\n");
 				printf("     main configuration file is typically '/usr/local/icinga/etc/icinga.cfg'\n");
+				printf("     or if using packages, most likely '/etc/icinga/icinga.cfg'\n");
 			}
 
 			printf("\n***> One or more problems was encountered while processing the config files...\n");
@@ -536,7 +537,8 @@ int main(int argc, char **argv, char **env) {
 			printf("     version of %s, you should be aware that some variables/definitions\n", PROGRAM_NAME);
 			printf("     may have been removed or modified in this version.  Make sure to read\n");
 			printf("     the HTML documentation regarding the config files, as well as the\n");
-			printf("     'Whats New' section to find out what has changed.\n\n");
+			printf("     'Whats New' section and the Changelog CHANGES section as well to find\n");
+			printf("     out what has changed.\n\n");
 		}
 
 		/* the config files were okay, so run the pre-flight check */





More information about the icinga-checkins mailing list