public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: fabbione@sourceware.org
To: cluster-cvs@sources.redhat.com, cluster-devel@redhat.com
Subject: Cluster Project branch, master, updated. cluster-2.99.06-80-ga87f95f
Date: Tue, 29 Jul 2008 05:14:00 -0000	[thread overview]
Message-ID: <20080729051427.29944.qmail@sourceware.org> (raw)

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@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@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


                 reply	other threads:[~2008-07-29  5:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080729051427.29944.qmail@sourceware.org \
    --to=fabbione@sourceware.org \
    --cc=cluster-cvs@sources.redhat.com \
    --cc=cluster-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).