Reinstate deprecated command line options and add warnings

-l/--local-port will be removed in 3.2, not 3.1.x.

--initdb-no-pwprompt already has no effect.
This commit is contained in:
Ian Barwick
2016-08-15 12:22:33 +09:00
parent a7ed60a533
commit ed1136f443
2 changed files with 30 additions and 3 deletions

View File

@@ -196,6 +196,9 @@ main(int argc, char **argv)
{"pwprompt", optional_argument, NULL, OPT_PWPROMPT},
{"csv", no_argument, NULL, OPT_CSV},
{"version", no_argument, NULL, 'V'},
/* Following options deprecated */
{"local-port", required_argument, NULL, 'l'},
{"initdb-no-pwprompt", no_argument, NULL, OPT_INITDB_NO_PWPROMPT},
{NULL, 0, NULL, 0}
};
@@ -310,7 +313,7 @@ main(int argc, char **argv)
/* Prevent getopt_long() from printing an error message */
opterr = 0;
while ((c = getopt_long(argc, argv, "?Vd:h:p:U:S:D:f:R:w:k:FWIvb:rcL:tm:C:", long_options,
while ((c = getopt_long(argc, argv, "?Vd:h:p:U:S:D:f:R:w:k:FWIvb:rcL:tm:C:l:", long_options,
&optindex)) != -1)
{
/*
@@ -490,6 +493,21 @@ main(int argc, char **argv)
case OPT_CSV:
runtime_options.csv_mode = true;
break;
/* deprecated options - output a warning */
case 'l':
/* -l/--local-port is deprecated */
repmgr_atoi(optarg, "-l/--local-port", &cli_errors, false);
strncpy(runtime_options.localport,
optarg,
MAXLEN);
error_list_append(&cli_warnings, _("-l/--local-port is deprecated; repmgr will extract the witness port from the conninfo string in repmgr.conf"));
break;
case OPT_INITDB_NO_PWPROMPT:
/* --initdb-no-pwprompt is deprecated */
error_list_append(&cli_warnings, _("--initdb-no-pwprompt is deprecated and has no effect; use -P/--pwprompt instead"));
break;
default:
unknown_option:
{
@@ -3992,8 +4010,14 @@ do_witness_create(void)
xsnprintf(buf, sizeof(buf), "\n#Configuration added by %s\n", progname());
fputs(buf, pg_conf);
/* value provided with '-l/--local-port' */
strncpy(witness_port, runtime_options.localport, MAXLEN);
/*
* Attempt to extract a port number from the provided conninfo string.
* This will override any value provided with '-l/--local-port', as it's
* what we'll later try and connect to anyway. '-l/--local-port' should
* be deprecated.
*/
get_conninfo_value(options.conninfo, "port", witness_port);

View File

@@ -55,7 +55,7 @@
#define OPT_PG_REWIND 6
#define OPT_PWPROMPT 7
#define OPT_CSV 8
#define OPT_INITDB_NO_PWPROMPT 9
/* Run time options type */
@@ -99,9 +99,12 @@ typedef struct
char pg_bindir[MAXLEN];
char recovery_min_apply_delay[MAXLEN];
/* deprecated command line options */
char localport[MAXLEN];
} t_runtime_options;
#define T_RUNTIME_OPTIONS_INITIALIZER { "", "", "", "", "", "", "", DEFAULT_WAL_KEEP_SEGMENTS, false, false, false, false, false, false, false, false, false, false, "", "", "", "", "fast", "", 0, "", ""}
#define T_RUNTIME_OPTIONS_INITIALIZER { "", "", "", "", "", "", "", DEFAULT_WAL_KEEP_SEGMENTS, false, false, false, false, false, false, false, false, false, false, "", "", "", "", "fast", "", 0, "", "", ""}
struct BackupLabel
{