Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix pg-backup-api so it can handle Barman <= 3.9
pg-backup-api 2.1.0 doesn't work with Barman <= 3.9 because it attempts to fetch models independently of the Barman version it operates on. As Barman models were introduced through version 3.10, pg-backup-api fails with an ugly stack trace: ``` Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args) File "/usr/lib/python3.9/site-packages/pg_backup_api/logic/utility_controller.py", line 76, in diagnose available_models = barman.__config__.model_names() AttributeError: 'Config' object has no attribute 'model_names' ``` Through this commit we fix pg-backup-api in that sense: * It attempts to use models and the new signature of the `exec_diagnose`, which were introduced by Barman 3.10; * It falls back to the old signature of `exec_diagnose` if models are not available (Barman <= 3.9). References: BAR-171. Signed-off-by: Israel Barth Rubio <[email protected]>
- Loading branch information