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.
This commit is contained in:
Ian Barwick
2020-10-20 17:21:17 +09:00
parent 2cb1f4f728
commit 9c93b42224

View File

@@ -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)
{