diff --git a/patroni/postgresql/bootstrap.py b/patroni/postgresql/bootstrap.py index e5d065dd..f58c8a81 100644 --- a/patroni/postgresql/bootstrap.py +++ b/patroni/postgresql/bootstrap.py @@ -356,7 +356,8 @@ END;$$""".format(f, rewind['username']) self._running_custom_bootstrap = False # If we don't have custom configuration for pg_hba.conf we need to restore original file if not postgresql.config.get('pg_hba'): - os.unlink(postgresql.config.pg_hba_conf) + if os.path.exists(postgresql.config.pg_hba_conf): + os.unlink(postgresql.config.pg_hba_conf) postgresql.config.restore_configuration_files() postgresql.config.write_postgresql_conf() postgresql.config.replace_pg_ident()