mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
Clarify error message.
Avoid implying there's a configuration file if none was provided.
This commit is contained in:
6
config.c
6
config.c
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
static void tablespace_list_append(t_configuration_options *options, const char *arg);
|
static void tablespace_list_append(t_configuration_options *options, const char *arg);
|
||||||
|
|
||||||
void
|
bool
|
||||||
parse_config(const char *config_file, t_configuration_options * options)
|
parse_config(const char *config_file, t_configuration_options * options)
|
||||||
{
|
{
|
||||||
char *s,
|
char *s,
|
||||||
@@ -74,7 +74,7 @@ parse_config(const char *config_file, t_configuration_options * options)
|
|||||||
log_notice(_("No configuration file provided and default file '%s' not found - "
|
log_notice(_("No configuration file provided and default file '%s' not found - "
|
||||||
"continuing with default values\n"),
|
"continuing with default values\n"),
|
||||||
config_file);
|
config_file);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read next line */
|
/* Read next line */
|
||||||
@@ -187,6 +187,8 @@ parse_config(const char *config_file, t_configuration_options * options)
|
|||||||
log_err(_("Reconnect intervals must be zero or greater. Check the configuration file.\n"));
|
log_err(_("Reconnect intervals must be zero or greater. Check the configuration file.\n"));
|
||||||
exit(ERR_BAD_CONFIG);
|
exit(ERR_BAD_CONFIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2
config.h
2
config.h
@@ -67,7 +67,7 @@ typedef struct
|
|||||||
#define T_CONFIGURATION_OPTIONS_INITIALIZER { "", -1, NO_UPSTREAM_NODE, "", MANUAL_FAILOVER, -1, "", "", "", "", "", "", "", -1, -1, -1, "", "", "", "", 0, 0, 0, {NULL, NULL} }
|
#define T_CONFIGURATION_OPTIONS_INITIALIZER { "", -1, NO_UPSTREAM_NODE, "", MANUAL_FAILOVER, -1, "", "", "", "", "", "", "", -1, -1, -1, "", "", "", "", 0, 0, 0, {NULL, NULL} }
|
||||||
|
|
||||||
|
|
||||||
void parse_config(const char *config_file, t_configuration_options * options);
|
bool parse_config(const char *config_file, t_configuration_options * options);
|
||||||
void parse_line(char *buff, char *name, char *value);
|
void parse_line(char *buff, char *name, char *value);
|
||||||
char *trim(char *s);
|
char *trim(char *s);
|
||||||
bool reload_config(char *config_file, t_configuration_options * orig_options);
|
bool reload_config(char *config_file, t_configuration_options * orig_options);
|
||||||
|
|||||||
17
repmgr.c
17
repmgr.c
@@ -133,7 +133,8 @@ main(int argc, char **argv)
|
|||||||
int c, targ;
|
int c, targ;
|
||||||
int action = NO_ACTION;
|
int action = NO_ACTION;
|
||||||
bool check_master_config = false;
|
bool check_master_config = false;
|
||||||
bool wal_keep_segments_used = false;
|
bool wal_keep_segments_used = false;
|
||||||
|
bool config_file_parsed = false;
|
||||||
char *ptr = NULL;
|
char *ptr = NULL;
|
||||||
|
|
||||||
progname = get_progname(argv[0]);
|
progname = get_progname(argv[0]);
|
||||||
@@ -388,7 +389,7 @@ main(int argc, char **argv)
|
|||||||
* however if available we'll parse it anyway for options like 'log_level',
|
* however if available we'll parse it anyway for options like 'log_level',
|
||||||
* 'use_replication_slots' etc.
|
* 'use_replication_slots' etc.
|
||||||
*/
|
*/
|
||||||
parse_config(runtime_options.config_file, &options);
|
config_file_parsed = parse_config(runtime_options.config_file, &options);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialise pg_bindir - command line parameter will override
|
* Initialise pg_bindir - command line parameter will override
|
||||||
@@ -441,8 +442,16 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
if (options.node == -1)
|
if (options.node == -1)
|
||||||
{
|
{
|
||||||
log_err(_("Node information is missing. "
|
if(config_file_parsed == true)
|
||||||
"Check the configuration file.\n"));
|
{
|
||||||
|
log_err(_("No node information was found. "
|
||||||
|
"Check the configuration file.\n"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log_err(_("No node information was found. "
|
||||||
|
"Please supply a configuration file.\n"));
|
||||||
|
}
|
||||||
exit(ERR_BAD_CONFIG);
|
exit(ERR_BAD_CONFIG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user