From 12adb5e0d12133f894fa7e285730406b1501837b Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Mon, 23 Mar 2020 15:23:58 +0900 Subject: [PATCH] Add warning if --superuser option provided when it won't be used Currently the only place this option is relevant is "standby clone". --- repmgr-action-standby.c | 1 + repmgr-client.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/repmgr-action-standby.c b/repmgr-action-standby.c index 10a15ec3..8948a34f 100644 --- a/repmgr-action-standby.c +++ b/repmgr-action-standby.c @@ -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")); diff --git a/repmgr-client.c b/repmgr-client.c index 63c2d499..568f00e9 100644 --- a/repmgr-client.c +++ b/repmgr-client.c @@ -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("");