Update handling of --replication-user

This commit is contained in:
Ian Barwick
2017-06-16 22:10:07 +09:00
parent 030fdc046b
commit 6f77e84b62

View File

@@ -204,6 +204,11 @@ main(int argc, char **argv)
runtime_options.force = true;
break;
/* --replication-user (master/standby register only) */
case OPT_REPLICATION_USER:
strncpy(runtime_options.replication_user, optarg, MAXLEN);
break;
/* -W/--wait */
case 'W':
runtime_options.wait = true;
@@ -350,10 +355,6 @@ main(int argc, char **argv)
break;
}
case OPT_REPLICATION_USER:
strncpy(runtime_options.replication_user, optarg, MAXLEN);
break;
case OPT_UPSTREAM_CONNINFO:
strncpy(runtime_options.upstream_conninfo, optarg, MAXLEN);
break;
@@ -1066,6 +1067,25 @@ check_cli_parameters(const int action)
}
}
if (runtime_options.replication_user[0])
{
switch (action)
{
case MASTER_REGISTER:
case STANDBY_REGISTER:
break;
case STANDBY_CLONE:
case STANDBY_FOLLOW:
item_list_append_format(&cli_warnings,
_("--replication-user ignored when executing %s)"),
action_name(action));
default:
item_list_append_format(&cli_warnings,
_("--replication-user not required when executing %s"),
action_name(action));
}
}
if (runtime_options.limit_provided)
{
switch (action)