mirror of https://github.com/zulip/zulip.git
pg_backup_and_purge: Fix buggy recovery status parsing.
This was converted to Python 3 incorrectly, in a way that actually completely broke the script (the .decode() that this adds is critical, since 'f' != b'f'). We fix this, and also add an assert that makes the parsing code safer against future refactors.
This commit is contained in:
parent
49528a98eb
commit
db1f706d09
|
@ -30,8 +30,11 @@ def run(args, dry_run=False):
|
|||
sys.exit(1)
|
||||
return stdout
|
||||
|
||||
recovery_val = run(['psql', '-t', '-c', 'select pg_is_in_recovery()']).strip().decode()
|
||||
# Assertion to check that we're extracting the value correctly.
|
||||
assert recovery_val in ['t', 'f']
|
||||
if recovery_val == 't':
|
||||
# Only run if we're the master
|
||||
if run(['psql', '-t', '-c', 'select pg_is_in_recovery()']).strip() != 'f':
|
||||
sys.exit(0)
|
||||
|
||||
pg_data_paths = glob.glob('/var/lib/postgresql/*/main')
|
||||
|
|
Loading…
Reference in New Issue