Skip to content

Remove RuntimeException in __checkPostgresDbIsReady

Es kommt bereits eine Exceptin zuvor, da sollte nicht im catch eine neue Exception geworfen werden.

Anbei ein Beispiel-Output:

2021-06-05 13:12:18,027 - BackupOrRestorePostgres - ERROR - An error occurred while doing the backup
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/backupandrestore/bnr/Postgres.py", line 107, in __checkPostgresDbIsReady
    self._runCommand(cmd)
  File "/usr/local/lib/python3.7/dist-packages/backupandrestore/bnr/Base.py", line 225, in _runCommand
    command), cwd=workingDir, timeout=internalTimeout)
  File "/usr/lib/python3.7/subprocess.py", line 395, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.7/subprocess.py", line 487, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['pg_isready', '-d', 'rv-tool', '-h', 'rv-tool-postgres', '-p', '5432', '-U', 'admin']' returned non-zero exit status 2.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/backupandrestore/bnr/Postgres.py", line 59, in doBackup
    self.__checkPostgresDbIsReady(db)
  File "/usr/local/lib/python3.7/dist-packages/backupandrestore/bnr/Postgres.py", line 112, in __checkPostgresDbIsReady
    % (self.pgConfig.pgHost, self.pgConfig.pgPort, db))
RuntimeError: Postgres database rv-tool-postgres:5432/rv-tool is unavailable using the current configuration. Aborting.