repmgr: emit warning if a deprecated command line option is used

This commit is contained in:
Ian Barwick
2016-08-15 12:27:55 +09:00
parent fb6109b3e6
commit 4a349f7224
2 changed files with 15 additions and 1 deletions

View File

@@ -209,6 +209,9 @@ main(int argc, char **argv)
{"csv", no_argument, NULL, OPT_CSV},
{"node", required_argument, NULL, OPT_NODE},
{"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}
};
@@ -322,7 +325,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)
{
/*
@@ -506,6 +509,16 @@ main(int argc, char **argv)
runtime_options.node = repmgr_atoi(optarg, "--node", &cli_errors, false);
break;
/* deprecated options - output a warning */
case 'l':
/* -l/--local-port is deprecated */
item_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 */
item_list_append(&cli_warnings, _("--initdb-no-pwprompt is deprecated and has no effect; use -P/--pwprompt instead"));
break;
default:
unknown_option:
{

View File

@@ -56,6 +56,7 @@
#define OPT_PWPROMPT 7
#define OPT_CSV 8
#define OPT_NODE 9
#define OPT_INITDB_NO_PWPROMPT 10
/* Run time options type */