mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
repmgr: require a valid repmgr cluster name unless -F/--force supplied
Addresses issue mentioned in GitHub #242.
This commit is contained in:
11
repmgr.c
11
repmgr.c
@@ -898,6 +898,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Initialise the repmgr schema name */
|
||||
|
||||
if (strlen(repmgr_cluster))
|
||||
/* --cluster parameter provided */
|
||||
maxlen_snprintf(repmgr_schema, "%s%s", DEFAULT_REPMGR_SCHEMA_PREFIX,
|
||||
@@ -906,6 +907,16 @@ main(int argc, char **argv)
|
||||
maxlen_snprintf(repmgr_schema, "%s%s", DEFAULT_REPMGR_SCHEMA_PREFIX,
|
||||
options.cluster_name);
|
||||
|
||||
/*
|
||||
* If no value for the repmgr_schema provided, continue only under duress.
|
||||
*/
|
||||
if (strcmp(repmgr_schema, DEFAULT_REPMGR_SCHEMA_PREFIX) == 0 && !runtime_options.force)
|
||||
{
|
||||
log_err(_("unable to determine cluster name - please provide a valid configuration file with -c/--config-file\n"));
|
||||
log_hint(_("Use -F/--force to continue anyway\n"));
|
||||
exit(ERR_BAD_CONFIG);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialise slot name, if required (9.4 and later)
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user