[Cluster-devel] Cluster Project branch, master, updated. cluster-2.99.06-80-ga87f95f

fabbione at sourceware.org fabbione at sourceware.org
Tue Jul 29 05:14:27 UTC 2008


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=a87f95fa74fc4376915fb661b8c681ccd5641145

The branch, master has been updated
       via  a87f95fa74fc4376915fb661b8c681ccd5641145 (commit)
      from  1b71d4bfcc3f42974b0cc34dc81a98f3c5224a8b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a87f95fa74fc4376915fb661b8c681ccd5641145
Author: Fabio M. Di Nitto <fdinitto at redhat.com>
Date:   Tue Jul 29 07:12:37 2008 +0200

    config: allow users to override default config file in xmlconfig
    
    By setting CLUSTER_CONFIG_FILE either in the enviroment it is possible
    to use an alternate cluster.conf.
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>

-----------------------------------------------------------------------

Summary of changes:
 config/plugins/xml/config.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/config/plugins/xml/config.c b/config/plugins/xml/config.c
index 84eee55..1328bca 100644
--- a/config/plugins/xml/config.c
+++ b/config/plugins/xml/config.c
@@ -13,11 +13,13 @@
 #include "logging.h"
 
 static int xml_readconfig(struct objdb_iface_ver0 *objdb, char **error_string);
-static int init_config(struct objdb_iface_ver0 *objdb, char *error_string);
+static int init_config(struct objdb_iface_ver0 *objdb, char *configfile, char *error_string);
 static char error_reason[1024];
 static int xmllistindex = 0;
 static char previous_query[PATH_MAX];
 
+#define DEFAULT_CONFIG DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE
+
 /*
  * Exports the interface for the service
  */
@@ -237,16 +239,20 @@ static int read_config_for(xmlXPathContextPtr ctx, struct objdb_iface_ver0 *objd
 
 static int xml_readconfig(struct objdb_iface_ver0 *objdb, char **error_string)
 {
-	int ret;
+	int ret = 0;
+	char *configfile = DEFAULT_CONFIG;
 
 	/* We need to set this up to internal defaults too early */
 	openlog("openais", LOG_CONS|LOG_PID, SYSLOGFACILITY);
 
+	if(getenv("CLUSTER_CONFIG_FILE"))
+		configfile = getenv("CLUSTER_CONFIG_FILE");
+
 	/* Read low-level totem/aisexec etc config from cluster.conf */
-	if ( !(ret = init_config(objdb, error_reason)) )
-		sprintf (error_reason, "%s", "Successfully read config from " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "\n");
+	if ( !(ret = init_config(objdb, configfile, error_reason)) )
+		sprintf (error_reason, "Successfully read config from %s\n", configfile);
 	else
-		sprintf (error_reason, "%s", "Unable to read config from " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "\n");
+		sprintf (error_reason, "Unable to read config from %s\n", configfile);
 
         *error_string = error_reason;
 
@@ -254,7 +260,7 @@ static int xml_readconfig(struct objdb_iface_ver0 *objdb, char **error_string)
 }
 
 
-static int init_config(struct objdb_iface_ver0 *objdb, char *error_string)
+static int init_config(struct objdb_iface_ver0 *objdb, char *configfile, char *error_string)
 {
 	int err = 0;
 	xmlDocPtr doc = NULL;
@@ -262,7 +268,7 @@ static int init_config(struct objdb_iface_ver0 *objdb, char *error_string)
 
 	/* openfile */
 
-	doc = xmlParseFile(DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE);
+	doc = xmlParseFile(configfile);
 	if (!doc) {
 		err = -1;
 		goto fail;


hooks/post-receive
--
Cluster Project




More information about the Cluster-devel mailing list