From fe5904e04e55986ffc94dd6197029610b63001de Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Tue, 20 Oct 2020 17:21:17 +0900 Subject: [PATCH] standby clone: improve Barman source server check Use "remote_command()" to execute the remote psql command, and provide the -X option to psql to ensure it doesn't read ~/.psqlrc. --- repmgr-action-standby.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/repmgr-action-standby.c b/repmgr-action-standby.c index 0b4ca09d..54615412 100644 --- a/repmgr-action-standby.c +++ b/repmgr-action-standby.c @@ -5962,19 +5962,22 @@ check_source_server_via_barman() initPQExpBuffer(&command_output); maxlen_snprintf(buf, - "ssh %s \"psql -Aqt \\\"%s\\\" -c \\\"" + "psql -AqtX -d \\\"%s\\\" -c \\\"" " SELECT conninfo" " FROM repmgr.nodes" " WHERE %s" " AND active IS TRUE" - "\\\"\"", - config_file_options.barman_host, + "\\\"", repmgr_conninfo_buf.data, where_condition); termPQExpBuffer(&repmgr_conninfo_buf); - command_success = local_command(buf, &command_output); + command_success = remote_command(config_file_options.barman_host, + runtime_options.remote_user, + buf, + config_file_options.ssh_options, + &command_output); if (command_success == false) {