Add warning if --superuser option provided when it won't be used

Currently the only place this option is relevant is "standby clone".
This commit is contained in:
Ian Barwick
2020-03-23 15:23:58 +09:00
parent b691a1bd10
commit 12adb5e0d1
2 changed files with 15 additions and 1 deletions

View File

@@ -8388,6 +8388,7 @@ do_standby_help(void)
printf(_(" --no-upstream-connection when using Barman, do not connect to upstream node\n"));
printf(_(" -R, --remote-user=USERNAME database server username for SSH operations (default: \"%s\")\n"), runtime_options.username);
printf(_(" --replication-user user to make replication connections with (optional, not usually required)\n"));
printf(_(" -S, --superuser=USERNAME superuser to use, if repmgr user is not superuser\n"));
printf(_(" --upstream-conninfo \"primary_conninfo\" value to write in recovery.conf\n" \
" when the intended upstream server does not yet exist\n"));
printf(_(" --upstream-node-id ID of the upstream node to replicate from (optional, defaults to primary node)\n"));

View File

@@ -1686,6 +1686,20 @@ check_cli_parameters(const int action)
}
}
if (runtime_options.superuser[0])
{
switch (action)
{
case STANDBY_CLONE:
break;
default:
item_list_append_format(&cli_warnings,
_("--superuser ignored when executing %s"),
action_name(action));
}
}
if (runtime_options.replication_conf_only == true)
{
switch (action)
@@ -2622,7 +2636,6 @@ do_help(void)
printf(_(" -p, --port=PORT database server port (default: \"%s\")\n"), runtime_options.port);
printf(_(" -U, --username=USERNAME database user name to connect as (default: \"%s\")\n"), runtime_options.username);
printf(_(" -S, --superuser=USERNAME superuser to use, if repmgr user is not superuser\n"));
puts("");