Remove all records from pg_hba.conf.
(self)
| 365 | process.returncode, stderr.decode())) |
| 366 | |
| 367 | def reset_hba(self): |
| 368 | """Remove all records from pg_hba.conf.""" |
| 369 | status = self.get_status() |
| 370 | if status == 'not-initialized': |
| 371 | raise ClusterError( |
| 372 | 'cannot modify HBA records: cluster is not initialized') |
| 373 | |
| 374 | pg_hba = os.path.join(self._data_dir, 'pg_hba.conf') |
| 375 | |
| 376 | try: |
| 377 | with open(pg_hba, 'w'): |
| 378 | pass |
| 379 | except IOError as e: |
| 380 | raise ClusterError( |
| 381 | 'cannot modify HBA records: {}'.format(e)) from e |
| 382 | |
| 383 | def add_hba_entry(self, *, type='host', database, user, address=None, |
| 384 | auth_method, auth_options=None): |