From 4b007bf4bcb16e81db75b5ad50134c4ab9728cfb Mon Sep 17 00:00:00 2001 From: Daniel Farina Date: Thu, 10 Feb 2011 03:12:51 -0800 Subject: [PATCH] Use a better check for when to issue an error message This patch changes raising the error "You need to use connection parameters to the master when issuing a STANDBY CLONE command." to only occur when no host (a global variable, that is abused for at least two purposes, but is okay in this case) is passed, rather than when no config file is passed, which is fine for standby clone (which itself is a wrapper for rsync) Signed-off-by: Daniel Farina --- repmgr.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/repmgr.c b/repmgr.c index 1d22cf66..127043ff 100644 --- a/repmgr.c +++ b/repmgr.c @@ -1557,19 +1557,20 @@ check_parameters_for_action(const int action) ok = false; } break; - case STANDBY_CLONE: - /* - * To clone a master into a standby we need connection parameters - * repmgr.conf is useless because we don't have a server running - * in the standby - */ - if (config_file != NULL) - { - fprintf(stderr, "\nYou need to use connection parameters to the master when issuing a STANDBY CLONE command."); + case STANDBY_CLONE: + /* + * To clone a master into a standby we need connection parameters + * repmgr.conf is useless because we don't have a server running in + * the standby; warn the user, but keep going. + */ + if (host == NULL) + { + fprintf(stderr, "\nYou need to use connection parameters to " + "the master when issuing a STANDBY CLONE command."); fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname); - ok = false; - } + ok = false; + } break; }