Closed gustabowill closed 3 months ago
This is working fine. I'm receiving the expected exit codes in all cases, i.e. 1
on errors, 0
otherwise:
$ barman receive-wal pg17 --reset
ERROR: Unable to reset the status of receive-wal for server pg17. Process is still running
$ echo $?
1
$ barman receive-wal pg17 --create-slot
Creating physical replication slot 'barman_pg17' on server 'pg17'
ERROR: Replication slot 'barman_pg17' already exists
$ echo $?
1
$ barman receive-wal pg17 --drop-slot
Dropping physical replication slot 'barman_pg17' on server 'pg17'
ERROR: Cannot drop replication slot 'barman_pg17' on server 'pg17' because it is in use.
$ echo $?
1
$ barman receive-wal pg17
Starting receive-wal for server pg17
ERROR: Another receive-wal process is already running for server pg17.
$ echo $?
1
$ barman receive-wal pg17 --stop
Stopped process receive-wal(490962)
$ echo $?
0
$ barman receive-wal pg17 --stop
ERROR: Termination of receive-wal failed: no such process for server pg17
$ echo $?
1
Fixes #539 where some errors of the
receive-wal
command were exiting with a status of zero, indicating success. The referenced issue reports an error when using the--reset
option, but the same also occurs with another error when you execute it without the flag and a receive-wal process is already running. This commit fixes both.In the code, it was just a matter of using the proper logging type and the rest is already handled. Now both errors exit with a status different than zero:
References: BAR-230 Closes: #539