mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 08:56:29 +00:00
Add option "--initdb-no-pwprompt"
Previously repmgr passed the -W flag to initdb, which forced manual input of a password; this option removes the -W flag to make repetitive testing easier.
This commit is contained in:
12
repmgr.c
12
repmgr.c
@@ -112,6 +112,7 @@ main(int argc, char **argv)
|
|||||||
{"ignore-rsync-warning", no_argument, NULL, 'I'},
|
{"ignore-rsync-warning", no_argument, NULL, 'I'},
|
||||||
{"min-recovery-apply-delay", required_argument, NULL, 'r'},
|
{"min-recovery-apply-delay", required_argument, NULL, 'r'},
|
||||||
{"verbose", no_argument, NULL, 'v'},
|
{"verbose", no_argument, NULL, 'v'},
|
||||||
|
{"initdb-no-pwprompt", no_argument, NULL, 1},
|
||||||
{NULL, 0, NULL, 0}
|
{NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -212,6 +213,9 @@ main(int argc, char **argv)
|
|||||||
case 'v':
|
case 'v':
|
||||||
runtime_options.verbose = true;
|
runtime_options.verbose = true;
|
||||||
break;
|
break;
|
||||||
|
case 1:
|
||||||
|
runtime_options.initdb_no_pwprompt = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
exit(ERR_BAD_CONFIG);
|
exit(ERR_BAD_CONFIG);
|
||||||
@@ -1716,8 +1720,10 @@ do_witness_create(void)
|
|||||||
if (!runtime_options.superuser[0])
|
if (!runtime_options.superuser[0])
|
||||||
strncpy(runtime_options.superuser, "postgres", MAXLEN);
|
strncpy(runtime_options.superuser, "postgres", MAXLEN);
|
||||||
|
|
||||||
sprintf(script, "%s/pg_ctl %s -D %s init -o \"-W -U %s\"", options.pg_bindir,
|
sprintf(script, "%s/pg_ctl %s -D %s init -o \"%s-U %s\"", options.pg_bindir,
|
||||||
options.pgctl_options, runtime_options.dest_dir, runtime_options.superuser);
|
options.pgctl_options, runtime_options.dest_dir,
|
||||||
|
runtime_options.initdb_no_pwprompt ? "" : "-W ",
|
||||||
|
runtime_options.superuser);
|
||||||
log_info("Initialize cluster for witness: %s.\n", script);
|
log_info("Initialize cluster for witness: %s.\n", script);
|
||||||
|
|
||||||
r = system(script);
|
r = system(script);
|
||||||
@@ -1955,7 +1961,7 @@ help(const char *progname)
|
|||||||
" to happen\n"));
|
" to happen\n"));
|
||||||
printf(_(" -W, --wait wait for a master to appear\n"));
|
printf(_(" -W, --wait wait for a master to appear\n"));
|
||||||
printf(_(" -r, --min-recovery-apply-delay=VALUE enable recovery time delay, value has to be a valid time atom (e.g. 5min)"));
|
printf(_(" -r, --min-recovery-apply-delay=VALUE enable recovery time delay, value has to be a valid time atom (e.g. 5min)"));
|
||||||
|
printf(_(" --initdb-no-pwprompt don't require superuser password when running initdb\n"));
|
||||||
printf(_("\n%s performs some tasks like clone a node, promote it or making follow\n"), progname);
|
printf(_("\n%s performs some tasks like clone a node, promote it or making follow\n"), progname);
|
||||||
printf(_("another node and then exits.\n\n"));
|
printf(_("another node and then exits.\n\n"));
|
||||||
printf(_("COMMANDS:\n"));
|
printf(_("COMMANDS:\n"));
|
||||||
|
|||||||
3
repmgr.h
3
repmgr.h
@@ -62,6 +62,7 @@ typedef struct
|
|||||||
bool force;
|
bool force;
|
||||||
bool wait_for_master;
|
bool wait_for_master;
|
||||||
bool ignore_rsync_warn;
|
bool ignore_rsync_warn;
|
||||||
|
bool initdb_no_pwprompt;
|
||||||
|
|
||||||
char masterport[MAXLEN];
|
char masterport[MAXLEN];
|
||||||
char localport[MAXLEN];
|
char localport[MAXLEN];
|
||||||
@@ -72,6 +73,6 @@ typedef struct
|
|||||||
char min_recovery_apply_delay[MAXLEN];
|
char min_recovery_apply_delay[MAXLEN];
|
||||||
} t_runtime_options;
|
} t_runtime_options;
|
||||||
|
|
||||||
#define T_RUNTIME_OPTIONS_INITIALIZER { "", "", "", "", "", "", "", DEFAULT_WAL_KEEP_SEGMENTS, false, false, false, false, "", "", 0, "" }
|
#define T_RUNTIME_OPTIONS_INITIALIZER { "", "", "", "", "", "", "", DEFAULT_WAL_KEEP_SEGMENTS, false, false, false, false, false, "", "", 0, "" }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user