pglift 3.2.0__tar.gz → 3.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pglift-3.2.0 → pglift-3.3.0}/PKG-INFO +7 -3
- {pglift-3.2.0 → pglift-3.3.0}/pyproject.toml +7 -1
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/__init__.py +1 -1
- pglift-3.3.0/src/pglift/annotations/api.py +15 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/conf.py +4 -5
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/databases.py +5 -5
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/exceptions.py +2 -1
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/fixtures/etcd.py +5 -1
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/fixtures/unit.py +12 -28
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/hba.py +1 -1
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/instances.py +5 -10
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/models/interface.py +15 -5
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/passfile.py +10 -11
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/patroni/__init__.py +3 -3
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/patroni/dcs.py +19 -8
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/patroni/impl.py +1 -2
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/patroni/models/build.py +1 -1
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/patroni/models/interface.py +3 -1
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/pgbackrest/__init__.py +1 -1
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/pgbackrest/base.py +10 -6
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/pgbackrest/repo_path.py +4 -5
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/pm.py +1 -1
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/postgresql/__init__.py +10 -3
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/postgresql/ctl.py +7 -4
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/postgresql/pq.py +1 -4
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/prometheus/__init__.py +1 -1
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/prometheus/impl.py +1 -1
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/rsyslog/__init__.py +2 -3
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/settings/__init__.py +4 -0
- pglift-3.3.0/src/pglift/settings/_api.py +31 -0
- pglift-3.3.0/src/pglift/settings/_cli.py +58 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/settings/_postgresql.py +1 -2
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/subscriptions.py +1 -1
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/system/cmd.py +2 -2
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/system/db.py +2 -2
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/system/install.py +6 -7
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/systemd/__init__.py +1 -1
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/task.py +6 -6
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/temboard/__init__.py +1 -1
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/types.py +3 -2
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/util.py +5 -6
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/__init__.py +8 -6
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/cmd.py +9 -4
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/conftest.py +4 -5
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/pgbackrest.py +13 -7
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/test_00_site.py +4 -1
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/test_11_roles.py +6 -4
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/test_20_pgbackrest.py +1 -1
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/test_20_prometheus.py +4 -2
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/test_20_temboard.py +2 -1
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/test_30_patroni.py +55 -5
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/test_40_promote_demote.py +2 -1
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/test_99_drop.py +2 -1
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/conftest.py +1 -6
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_ansible.py +1 -4
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_conf.py +1 -1
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_diff.py +2 -1
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_logrotate.py +3 -3
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_models_interface.py +10 -10
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_models_system.py +1 -1
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_models_validators.py +5 -3
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_patroni.py +6 -10
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_pgbackrest.py +10 -7
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_pm.py +1 -1
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_postgresql.py +9 -12
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_prometheus.py +14 -26
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_rsyslog.py +3 -3
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_settings.py +10 -8
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_system_cmd.py +5 -3
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_systemd.py +4 -2
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_task.py +52 -47
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_util.py +4 -8
- {pglift-3.2.0 → pglift-3.3.0}/.gitignore +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/README.md +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/hatch.toml +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/pytest.ini +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/conftest.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/_compat.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/abc.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/annotations/__init__.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/annotations/ansible.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/annotations/cli.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/backup.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/deps.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/diff.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/extensions.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/fixtures/__init__.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/fixtures/functional.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/fixtures/types.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/hookspecs.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/logrotate/__init__.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/manager/__init__.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/manager/configuration.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/manager/hba.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/manager/instance.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/models/__init__.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/models/helpers.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/models/system.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/models/testing.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/models/types.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/models/validators.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/patroni/logrotate.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/patroni/logrotate.conf.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/patroni/models/__init__.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/patroni/models/common.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/patroni/models/system.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/patroni/patroni.yaml +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/patroni/patroni.yaml.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/pgbackrest/logrotate.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/pgbackrest/logrotate.conf.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/pgbackrest/models/__init__.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/pgbackrest/models/interface.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/pgbackrest/models/system.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/pgbackrest/pgbackrest.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/pgbackrest/pgbackrest.conf.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/pgbackrest/repo_host_ssh.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/pgbackrest/repo_host_tls.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/pgbackrest/server.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/pgbackrest/server.conf.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/postgresql/logrotate.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/postgresql/logrotate.conf.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/postgresql/models.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/postgresql/pg_hba.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/postgresql/pg_hba.conf.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/postgresql/pg_ident.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/postgresql/pg_ident.conf.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/postgresql/pgbackrest.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/postgresql/pgbackrest.conf.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/postgresql/postgresql-rsyslog.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/postgresql/postgresql-rsyslog.conf.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/postgresql/postgresql.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/postgresql/postgresql.conf.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/postgresql/psqlrc +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/postgresql/psqlrc.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/postgresql/rsyslog.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/postgresql/rsyslog.conf.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/powa/__init__.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/powa/impl.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/powa/models/__init__.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/powa/models/interface.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/privileges.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/profiles.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/prometheus/models/__init__.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/prometheus/models/interface.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/prometheus/models/system.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/prometheus/postgres_exporter.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/prometheus/postgres_exporter.conf.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/publications.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/py.typed +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/replication_slots.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/roles.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/schemas.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/settings/_logrotate.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/settings/_patroni.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/settings/_pgbackrest.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/settings/_powa.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/settings/_prometheus.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/settings/_rsyslog.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/settings/_systemd.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/settings/_temboard.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/settings/base.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/sql/__init__.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/sql/queries.sql +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/sql/queries.sql.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/system/__init__.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/system/command.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/system/dryrun.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/system/fs.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/system/imfs.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/system/svc.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/systemd/pglift-backup@.service +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/systemd/pglift-backup@.service.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/systemd/pglift-backup@.timer +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/systemd/pglift-backup@.timer.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/systemd/pglift-patroni@.service +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/systemd/pglift-patroni@.service.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/systemd/pglift-pgbackrest.service +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/systemd/pglift-pgbackrest.service.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/systemd/pglift-postgres_exporter@.service +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/systemd/pglift-postgres_exporter@.service.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/systemd/pglift-postgresql@.service +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/systemd/pglift-postgresql@.service.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/systemd/pglift-temboard_agent@.service +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/systemd/pglift-temboard_agent@.service.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/systemd/pglift-tmpfiles.d.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/systemd/pglift-tmpfiles.d.conf.license +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/systemd/scheduler.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/systemd/service_manager.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/systemd/tmpfilesd.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/temboard/impl.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/temboard/models/__init__.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/temboard/models/interface.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/temboard/models/system.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/testutil.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/src/pglift/ui.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/README.md +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/data/base/postgresql/16/psqlrc +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/data/base/postgresql/pg_hba.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/data/peer/postgresql/16/psqlrc +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/data/peer/postgresql/pg_hba.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/data/peer/postgresql/pg_ident.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/ssh.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/test_10_instances.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/test_10_standby.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/test_11_databases.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/test_11_privileges.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/test_11_profiles.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/test_11_replication_slots.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/test_20_backup.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/test_20_powa.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/test_40_reconfigure.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/func/test_41_upgrade.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/__init__.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/config/postgresql/18/pg_ident.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/config/postgresql/18/postgresql.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/config/postgresql/pgbackrest.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/expected/ansible-argspec-database.json +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/expected/ansible-argspec-instance.json +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/expected/ansible-argspec-postgresexporter.json +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/expected/ansible-argspec-role.json +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/expected/ansible-examples/database.yaml +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/expected/ansible-examples/instance.yaml +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/expected/ansible-examples/postgresexporter.yaml +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/expected/ansible-examples/role.yaml +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/expected/patroni-15-updated.diff +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/expected/patroni-15-upgraded.diff +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/expected/patroni-15.yaml +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/expected/patroni-18-updated.diff +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/expected/patroni-18-upgraded.diff +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/expected/patroni-18.yaml +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/expected/pg_hba.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/expected/pg_ident.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/expected/postgresql.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/expected/postgresql.merged.conf +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/expected/queries.json +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/data/postgresql.conf.sample +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_annotations_cli.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_backup.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_databases.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_exceptions.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_hba.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_hooks.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_instances.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_main.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_models_helpers.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_passfile.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_roles.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_sql.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_system_db.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_system_fs.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_system_imfs.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_system_install.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_temboard.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_testutil.py +0 -0
- {pglift-3.2.0 → pglift-3.3.0}/tests/unit/test_types.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: pglift
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.3.0
|
|
4
4
|
Summary: Life-cycle management of production-ready PostgreSQL instances
|
|
5
5
|
Project-URL: Documentation, https://pglift.readthedocs.io/
|
|
6
6
|
Project-URL: Source, https://gitlab.com/dalibo/pglift/
|
|
@@ -33,13 +33,15 @@ Requires-Dist: pgtoolkit>=0.33.0
|
|
|
33
33
|
Requires-Dist: pluggy
|
|
34
34
|
Requires-Dist: psutil
|
|
35
35
|
Requires-Dist: psycopg>=3.1
|
|
36
|
+
Requires-Dist: pydantic!=2.14.0b2,>=2.10.2
|
|
36
37
|
Requires-Dist: pydantic-settings
|
|
37
|
-
Requires-Dist: pydantic>=2.10.2
|
|
38
38
|
Requires-Dist: python-dotenv
|
|
39
39
|
Requires-Dist: pyyaml>=6.0.1
|
|
40
40
|
Requires-Dist: tenacity!=8.4.0,>=8.2.0
|
|
41
41
|
Requires-Dist: typing-extensions
|
|
42
42
|
Requires-Dist: tzlocal
|
|
43
|
+
Provides-Extra: api
|
|
44
|
+
Requires-Dist: pglift-api; extra == 'api'
|
|
43
45
|
Provides-Extra: cli
|
|
44
46
|
Requires-Dist: pglift-cli; extra == 'cli'
|
|
45
47
|
Provides-Extra: dev
|
|
@@ -55,6 +57,8 @@ Requires-Dist: tenacity!=8.2.0,!=8.4.0,>=8.0.0; extra == 'dev'
|
|
|
55
57
|
Requires-Dist: trustme; extra == 'dev'
|
|
56
58
|
Requires-Dist: types-psutil; extra == 'dev'
|
|
57
59
|
Requires-Dist: types-pyyaml>=6.0.12.10; extra == 'dev'
|
|
60
|
+
Provides-Extra: http-api
|
|
61
|
+
Requires-Dist: fastapi; extra == 'http-api'
|
|
58
62
|
Provides-Extra: test
|
|
59
63
|
Requires-Dist: ansible-core; extra == 'test'
|
|
60
64
|
Requires-Dist: anyio>=4.9.0; extra == 'test'
|
|
@@ -47,7 +47,7 @@ dependencies = [
|
|
|
47
47
|
"pluggy",
|
|
48
48
|
"psycopg >= 3.1",
|
|
49
49
|
"psutil",
|
|
50
|
-
"pydantic >= 2.10.2",
|
|
50
|
+
"pydantic >= 2.10.2, != 2.14.0b2",
|
|
51
51
|
"pydantic-settings",
|
|
52
52
|
"python-dotenv",
|
|
53
53
|
"tenacity >=8.2.0, != 8.4.0",
|
|
@@ -57,9 +57,15 @@ dependencies = [
|
|
|
57
57
|
]
|
|
58
58
|
|
|
59
59
|
[project.optional-dependencies]
|
|
60
|
+
http-api = [
|
|
61
|
+
"fastapi",
|
|
62
|
+
]
|
|
60
63
|
cli = [
|
|
61
64
|
"pglift_cli",
|
|
62
65
|
]
|
|
66
|
+
api = [
|
|
67
|
+
"pglift_api",
|
|
68
|
+
]
|
|
63
69
|
test = [
|
|
64
70
|
"ansible-core",
|
|
65
71
|
"anyio >= 4.9.0",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Dalibo
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
import attrs
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@attrs.define(frozen=True)
|
|
11
|
+
class Hidden:
|
|
12
|
+
"""Mark the field as available in create context."""
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
HIDDEN = Hidden()
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
6
6
|
|
|
7
|
+
import contextlib
|
|
7
8
|
from functools import partial
|
|
8
9
|
from pathlib import Path
|
|
9
10
|
from typing import Any
|
|
@@ -161,10 +162,8 @@ def format_values(
|
|
|
161
162
|
continue
|
|
162
163
|
if v is None:
|
|
163
164
|
continue
|
|
164
|
-
|
|
165
|
+
with contextlib.suppress(ValueError):
|
|
165
166
|
confitems[k] = util.percent_memory(v, memtotal)
|
|
166
|
-
except ValueError:
|
|
167
|
-
pass
|
|
168
167
|
for k, v in confitems.items():
|
|
169
168
|
if isinstance(v, str):
|
|
170
169
|
confitems[k] = v.format(name=name, version=version, settings=settings)
|
|
@@ -185,7 +184,7 @@ def get_str(config: pgconf.Configuration, key: str, default: str | None = None)
|
|
|
185
184
|
>>> get_str(config, "port")
|
|
186
185
|
Traceback (most recent call last):
|
|
187
186
|
...
|
|
188
|
-
|
|
187
|
+
TypeError: unexpected int type for 'port' option
|
|
189
188
|
"""
|
|
190
189
|
try:
|
|
191
190
|
value = config[key]
|
|
@@ -194,7 +193,7 @@ def get_str(config: pgconf.Configuration, key: str, default: str | None = None)
|
|
|
194
193
|
raise
|
|
195
194
|
return default
|
|
196
195
|
if not isinstance(value, str):
|
|
197
|
-
raise
|
|
196
|
+
raise TypeError(f"unexpected {type(value).__name__} type for {key!r} option")
|
|
198
197
|
return value
|
|
199
198
|
|
|
200
199
|
|
|
@@ -173,9 +173,9 @@ async def clone(
|
|
|
173
173
|
await asyncio.gather(dump2restore, dump_stderr, restore_stderr)
|
|
174
174
|
|
|
175
175
|
if dump_rc:
|
|
176
|
-
raise exceptions.CommandError(dump_rc, [str(pg_dump)
|
|
176
|
+
raise exceptions.CommandError(dump_rc, [str(pg_dump), *dump_args])
|
|
177
177
|
if restore_rc:
|
|
178
|
-
raise exceptions.CommandError(restore_rc, [str(pg_restore)
|
|
178
|
+
raise exceptions.CommandError(restore_rc, [str(pg_restore), *restore_args])
|
|
179
179
|
|
|
180
180
|
|
|
181
181
|
async def get(instance: PostgreSQLInstance, name: str) -> interface.Database:
|
|
@@ -336,9 +336,9 @@ async def revert_create(
|
|
|
336
336
|
instance: PostgreSQLInstance,
|
|
337
337
|
) -> None:
|
|
338
338
|
# The reconnect would happen if the 'create' task is reverted while inkoved from apply().
|
|
339
|
-
async with db.maybe_reconnect(cnx, instance) as
|
|
340
|
-
if await _exists(
|
|
341
|
-
await _drop(
|
|
339
|
+
async with db.maybe_reconnect(cnx, instance) as cnx_:
|
|
340
|
+
if await _exists(cnx_, database.name):
|
|
341
|
+
await _drop(cnx_, interface.DatabaseDropped(name=database.name))
|
|
342
342
|
|
|
343
343
|
|
|
344
344
|
async def alter(cnx: db.Connection, database: interface.Database) -> bool:
|
|
@@ -38,7 +38,8 @@ class NotFound(Error, metaclass=abc.ABCMeta):
|
|
|
38
38
|
self.hint = hint
|
|
39
39
|
super().__init__(name)
|
|
40
40
|
|
|
41
|
-
@
|
|
41
|
+
@property
|
|
42
|
+
@abc.abstractmethod
|
|
42
43
|
def object_type(self) -> str:
|
|
43
44
|
"""Type of object that's not found."""
|
|
44
45
|
raise NotImplementedError
|
|
@@ -101,7 +101,11 @@ class Etcd:
|
|
|
101
101
|
cmd = ctl + args
|
|
102
102
|
logger.debug("%s", shlex.join(cmd))
|
|
103
103
|
r = subprocess.run( # nosec
|
|
104
|
-
cmd,
|
|
104
|
+
cmd,
|
|
105
|
+
stdin=subprocess.DEVNULL,
|
|
106
|
+
capture_output=True,
|
|
107
|
+
text=True,
|
|
108
|
+
check=True,
|
|
105
109
|
)
|
|
106
110
|
for outline in r.stdout.rstrip().splitlines():
|
|
107
111
|
logger.debug("%s: %s", ctl[0], outline)
|
|
@@ -68,16 +68,12 @@ def patroni_execpaths(bin_path: Path) -> tuple[Path, Path]:
|
|
|
68
68
|
execpath = bin_path / "patroni"
|
|
69
69
|
execpath.touch(0o700)
|
|
70
70
|
execpath.write_text(
|
|
71
|
-
"\n"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"fi",
|
|
78
|
-
"exit 1",
|
|
79
|
-
]
|
|
80
|
-
)
|
|
71
|
+
"#!/bin/sh\n"
|
|
72
|
+
'if [ "$1" = "--validate-config" ]\n'
|
|
73
|
+
"then\n"
|
|
74
|
+
' echo "test test test"\n'
|
|
75
|
+
"fi\n"
|
|
76
|
+
"exit 1"
|
|
81
77
|
)
|
|
82
78
|
ctlpath = bin_path / "patronictl"
|
|
83
79
|
ctlpath.touch(0o700)
|
|
@@ -183,22 +179,12 @@ def settings(
|
|
|
183
179
|
pg_controldata = path / "pg_controldata"
|
|
184
180
|
pg_controldata.touch(mode=0o700)
|
|
185
181
|
pg_controldata.write_text(
|
|
186
|
-
"\
|
|
187
|
-
[
|
|
188
|
-
"#!/bin/sh",
|
|
189
|
-
'echo "Data page checksum version: 1"',
|
|
190
|
-
"exit 0",
|
|
191
|
-
]
|
|
192
|
-
)
|
|
182
|
+
'#!/bin/sh\necho "Data page checksum version: 1"\nexit 0'
|
|
193
183
|
)
|
|
194
184
|
|
|
195
185
|
psql = path / "psql"
|
|
196
186
|
psql.touch(mode=0o700)
|
|
197
|
-
psql.write_text(
|
|
198
|
-
"\n".join(
|
|
199
|
-
["#!/bin/sh", 'echo "unexpected psql $* invocation" >&2', "exit 1"]
|
|
200
|
-
)
|
|
201
|
-
)
|
|
187
|
+
psql.write_text('#!/bin/sh\necho "unexpected psql $* invocation" >&2\nexit 1')
|
|
202
188
|
|
|
203
189
|
pg_isready = path / "pg_isready"
|
|
204
190
|
pg_isready.touch(mode=0o700)
|
|
@@ -278,12 +264,10 @@ def settings(
|
|
|
278
264
|
|
|
279
265
|
@pytest.fixture
|
|
280
266
|
def postgresql_conf() -> str:
|
|
281
|
-
return
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
"# backslash_quote = 'safe_encoding'",
|
|
286
|
-
]
|
|
267
|
+
return (
|
|
268
|
+
"port = 999\n"
|
|
269
|
+
"unix_socket_directories = /socks, /shoes\n"
|
|
270
|
+
"# backslash_quote = 'safe_encoding'"
|
|
287
271
|
)
|
|
288
272
|
|
|
289
273
|
|
|
@@ -152,7 +152,7 @@ async def records(
|
|
|
152
152
|
r["connection"] = {
|
|
153
153
|
"type": record["conntype"],
|
|
154
154
|
"address": record["address"],
|
|
155
|
-
"netmask": record
|
|
155
|
+
"netmask": record.get("netmask"),
|
|
156
156
|
}
|
|
157
157
|
yield interface.HbaRecordForRole(**r)
|
|
158
158
|
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
6
6
|
|
|
7
|
+
import asyncio
|
|
7
8
|
import contextlib
|
|
8
9
|
import logging
|
|
9
10
|
import os
|
|
10
11
|
import re
|
|
11
12
|
import shutil
|
|
12
13
|
import tempfile
|
|
13
|
-
import time
|
|
14
14
|
from collections.abc import AsyncIterator, Iterator, Sequence
|
|
15
15
|
from dataclasses import dataclass
|
|
16
16
|
from functools import singledispatch
|
|
@@ -19,7 +19,6 @@ from typing import Any
|
|
|
19
19
|
|
|
20
20
|
import pgtoolkit.conf as pgconf
|
|
21
21
|
import psycopg.rows
|
|
22
|
-
import psycopg.sql
|
|
23
22
|
import tenacity
|
|
24
23
|
from pgtoolkit import pgpass
|
|
25
24
|
|
|
@@ -262,7 +261,7 @@ async def stopped(
|
|
|
262
261
|
|
|
263
262
|
await stop(instance)
|
|
264
263
|
for __ in range(timeout):
|
|
265
|
-
|
|
264
|
+
await asyncio.sleep(1)
|
|
266
265
|
if not await postgresql.is_running(pg_instance):
|
|
267
266
|
break
|
|
268
267
|
else:
|
|
@@ -924,7 +923,7 @@ async def _get(
|
|
|
924
923
|
|
|
925
924
|
standby = None
|
|
926
925
|
if pg_instance.standby:
|
|
927
|
-
|
|
926
|
+
with contextlib.suppress(ValueError):
|
|
928
927
|
standby = await async_hook(
|
|
929
928
|
settings,
|
|
930
929
|
h.standby_model,
|
|
@@ -932,8 +931,6 @@ async def _get(
|
|
|
932
931
|
standby=pg_instance.standby,
|
|
933
932
|
running=instance_is_running,
|
|
934
933
|
)
|
|
935
|
-
except ValueError:
|
|
936
|
-
pass
|
|
937
934
|
|
|
938
935
|
locale = None
|
|
939
936
|
encoding = None
|
|
@@ -1017,10 +1014,8 @@ def system_list(
|
|
|
1017
1014
|
versions = [v.version for v in settings.postgresql.versions]
|
|
1018
1015
|
for ver in versions:
|
|
1019
1016
|
for name in system_version_lookup(ver, settings.postgresql.datadir):
|
|
1020
|
-
|
|
1017
|
+
with contextlib.suppress(exceptions.InstanceNotFound):
|
|
1021
1018
|
yield PostgreSQLInstance.system_lookup(name, ver, settings)
|
|
1022
|
-
except exceptions.InstanceNotFound:
|
|
1023
|
-
pass
|
|
1024
1019
|
|
|
1025
1020
|
|
|
1026
1021
|
@deps.use
|
|
@@ -1102,7 +1097,7 @@ def exec(
|
|
|
1102
1097
|
raise exceptions.FileNotFoundError(progname)
|
|
1103
1098
|
program = PurePath(ppath)
|
|
1104
1099
|
try:
|
|
1105
|
-
cmd.execute_program([str(program)
|
|
1100
|
+
cmd.execute_program([str(program), *args], env=env)
|
|
1106
1101
|
except FileNotFoundError as e:
|
|
1107
1102
|
raise exceptions.FileNotFoundError(str(e)) from e
|
|
1108
1103
|
|
|
@@ -27,7 +27,7 @@ from .. import conf, postgresql, types
|
|
|
27
27
|
from .. import diff as diffmod
|
|
28
28
|
from .. import settings as s
|
|
29
29
|
from .._compat import Self, assert_never
|
|
30
|
-
from ..annotations import CREATE_ONLY, ansible, cli
|
|
30
|
+
from ..annotations import CREATE_ONLY, ansible, api, cli
|
|
31
31
|
from ..exceptions import MutuallyExclusiveError
|
|
32
32
|
from ..pm import PluginManager
|
|
33
33
|
from ..postgresql.models import Standby
|
|
@@ -281,8 +281,8 @@ class RoleDropped(BaseRole):
|
|
|
281
281
|
"""Model for a role that is being dropped."""
|
|
282
282
|
|
|
283
283
|
state: Literal["absent"] = "absent"
|
|
284
|
-
password: Literal[None] = None
|
|
285
|
-
encrypted_password: Literal[None] = None
|
|
284
|
+
password: Literal[None] = None # noqa: PYI061
|
|
285
|
+
encrypted_password: Literal[None] = None # noqa: PYI061
|
|
286
286
|
drop_owned: Annotated[bool, DropOwned] = False
|
|
287
287
|
reassign_owned: Annotated[str | None, ReassignOwned] = None
|
|
288
288
|
|
|
@@ -333,6 +333,7 @@ class _RoleExisting(BaseRole):
|
|
|
333
333
|
bool,
|
|
334
334
|
cli.HIDDEN,
|
|
335
335
|
ansible.HIDDEN,
|
|
336
|
+
api.HIDDEN,
|
|
336
337
|
Field(
|
|
337
338
|
description="True if the role has a password.",
|
|
338
339
|
validate_default=True,
|
|
@@ -963,6 +964,7 @@ class PostgreSQLInstance(BaseModel):
|
|
|
963
964
|
PostgreSQLInstanceRef | None,
|
|
964
965
|
cli.HIDDEN,
|
|
965
966
|
ansible.HIDDEN,
|
|
967
|
+
api.HIDDEN,
|
|
966
968
|
Field(
|
|
967
969
|
description="Internal field to keep a reference to the instance this manifest will be upgraded from.",
|
|
968
970
|
exclude=True,
|
|
@@ -1044,6 +1046,7 @@ class PostgreSQLInstance(BaseModel):
|
|
|
1044
1046
|
bool,
|
|
1045
1047
|
cli.HIDDEN,
|
|
1046
1048
|
ansible.HIDDEN,
|
|
1049
|
+
api.HIDDEN,
|
|
1047
1050
|
Field(
|
|
1048
1051
|
description="Whether the instance needs a restart to account for settings changes.",
|
|
1049
1052
|
json_schema_extra={"readOnly": True},
|
|
@@ -1068,6 +1071,10 @@ class PostgreSQLInstance(BaseModel):
|
|
|
1068
1071
|
memberships=["pg_read_all_stats"],
|
|
1069
1072
|
)
|
|
1070
1073
|
|
|
1074
|
+
@property
|
|
1075
|
+
def qualname(self) -> str:
|
|
1076
|
+
return f"{self.version}-{self.name}"
|
|
1077
|
+
|
|
1071
1078
|
|
|
1072
1079
|
def _set_creating_when_upgrading_from(value: bool, info: ValidationInfo) -> bool:
|
|
1073
1080
|
if info.data["upgrading_from"] is not None:
|
|
@@ -1105,8 +1112,10 @@ class Instance(PostgreSQLInstance, CompositeModel, extra="allow"):
|
|
|
1105
1112
|
"""
|
|
1106
1113
|
|
|
1107
1114
|
@classmethod
|
|
1108
|
-
def component_models(
|
|
1109
|
-
|
|
1115
|
+
def component_models(
|
|
1116
|
+
cls, pm: PluginManager, operation: str | None = None
|
|
1117
|
+
) -> list[types.ComponentModel]:
|
|
1118
|
+
return pm.hook.instance_model(operation=operation) # type: ignore[no-any-return]
|
|
1110
1119
|
|
|
1111
1120
|
state: Annotated[
|
|
1112
1121
|
InstanceState,
|
|
@@ -1118,6 +1127,7 @@ class Instance(PostgreSQLInstance, CompositeModel, extra="allow"):
|
|
|
1118
1127
|
bool,
|
|
1119
1128
|
cli.HIDDEN,
|
|
1120
1129
|
ansible.HIDDEN,
|
|
1130
|
+
api.HIDDEN,
|
|
1121
1131
|
AfterValidator(_set_creating_when_upgrading_from),
|
|
1122
1132
|
Field(
|
|
1123
1133
|
description="Internal field to indicate that the instance is being created.",
|
|
@@ -201,17 +201,16 @@ async def role_change(
|
|
|
201
201
|
entry.password = password
|
|
202
202
|
return True, False
|
|
203
203
|
return False, False
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
return False, False
|
|
204
|
+
if in_pgpass and password is not None:
|
|
205
|
+
logger.info(
|
|
206
|
+
"adding an entry for '%(username)s' in %(passfile)s (port=%(port)d)",
|
|
207
|
+
{"username": username, "passfile": path, "port": port},
|
|
208
|
+
)
|
|
209
|
+
entry = pgpass.PassEntry("*", port, "*", username, password)
|
|
210
|
+
f.lines.append(entry)
|
|
211
|
+
f.sort()
|
|
212
|
+
return True, False
|
|
213
|
+
return False, False
|
|
215
214
|
|
|
216
215
|
|
|
217
216
|
class RoleInspect(TypedDict):
|
|
@@ -8,7 +8,7 @@ import contextlib
|
|
|
8
8
|
from collections.abc import AsyncIterator, Iterator, Sequence
|
|
9
9
|
from functools import singledispatch
|
|
10
10
|
from pathlib import Path
|
|
11
|
-
from typing import Annotated, Any, Literal
|
|
11
|
+
from typing import Annotated, Any, Literal
|
|
12
12
|
|
|
13
13
|
import pgtoolkit.conf as pgconf
|
|
14
14
|
from pydantic import Field
|
|
@@ -56,9 +56,9 @@ def instance_model() -> types.ComponentModel:
|
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
@hookimpl
|
|
59
|
-
async def standby_model(instance: PostgreSQLInstance) ->
|
|
59
|
+
async def standby_model(instance: PostgreSQLInstance) -> None:
|
|
60
60
|
if system_lookup(instance) is None:
|
|
61
|
-
return
|
|
61
|
+
return
|
|
62
62
|
raise ValueError("standby not supported with Patroni")
|
|
63
63
|
|
|
64
64
|
|
|
@@ -3,17 +3,20 @@
|
|
|
3
3
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
6
|
+
import json
|
|
6
7
|
from typing import Any, Literal
|
|
7
8
|
|
|
8
9
|
import pgtoolkit.conf as pgconf
|
|
9
10
|
|
|
10
|
-
from .. import types
|
|
11
|
+
from .. import postgresql, types, util
|
|
11
12
|
from ..models import PostgreSQLInstance, interface
|
|
12
13
|
from . import configure_context, impl
|
|
13
|
-
from .impl import available as available
|
|
14
|
-
from .impl import get_settings
|
|
14
|
+
from .impl import available as available # noqa: PLC0414
|
|
15
|
+
from .impl import get_settings
|
|
15
16
|
from .models import build
|
|
16
17
|
|
|
18
|
+
logger = util.get_logger(__name__)
|
|
19
|
+
|
|
17
20
|
|
|
18
21
|
async def pg_hba_config(instance: PostgreSQLInstance) -> list[str]:
|
|
19
22
|
settings = get_settings(instance._settings)
|
|
@@ -44,7 +47,7 @@ async def postgresql_editable_conf(
|
|
|
44
47
|
settings = get_settings(instance._settings)
|
|
45
48
|
patroni = build.Patroni.get(instance.qualname, settings)
|
|
46
49
|
conf = pgconf.Configuration()
|
|
47
|
-
parameters = await _postgresql_parameters(patroni)
|
|
50
|
+
parameters = await _postgresql_parameters(instance, patroni)
|
|
48
51
|
with conf.edit() as entries:
|
|
49
52
|
for k, v in parameters.items():
|
|
50
53
|
entries.add(k, v)
|
|
@@ -55,9 +58,17 @@ async def postgresql_editable_conf(
|
|
|
55
58
|
postgresql_conf = postgresql_editable_conf
|
|
56
59
|
|
|
57
60
|
|
|
58
|
-
async def _postgresql_parameters(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
async def _postgresql_parameters(
|
|
62
|
+
instance: PostgreSQLInstance, patroni: build.Patroni
|
|
63
|
+
) -> dict[str, Any]:
|
|
64
|
+
if await postgresql.is_running(instance):
|
|
65
|
+
r = await impl.api_request(patroni, "GET", "config")
|
|
66
|
+
json_ = r.json()
|
|
67
|
+
else:
|
|
68
|
+
logger.debug("reading configuration from patroni.dynamic.json")
|
|
69
|
+
with open(instance.datadir / "patroni.dynamic.json") as config_file: # noqa: ASYNC230
|
|
70
|
+
json_ = json.load(config_file)
|
|
71
|
+
parameters = json_.get("postgresql", {}).get("parameters", {})
|
|
61
72
|
assert isinstance(parameters, dict)
|
|
62
73
|
return parameters
|
|
63
74
|
|
|
@@ -77,7 +88,7 @@ async def configure_postgresql(
|
|
|
77
88
|
) -> tuple[dict[str, Any], dict[str, Any]]:
|
|
78
89
|
if actual is None:
|
|
79
90
|
return {}, build.parameters_managed(configuration, {})
|
|
80
|
-
actual_params = await _postgresql_parameters(actual)
|
|
91
|
+
actual_params = await _postgresql_parameters(instance, actual)
|
|
81
92
|
return (
|
|
82
93
|
actual_params,
|
|
83
94
|
build.parameters_managed(configuration, actual_params, False),
|
|
@@ -89,7 +89,7 @@ def validate_config(content: str, settings: _patroni.Settings) -> None:
|
|
|
89
89
|
raise exceptions.ConfigurationError(
|
|
90
90
|
PurePath(f.name), msg % e.stdout.strip()
|
|
91
91
|
) from e
|
|
92
|
-
|
|
92
|
+
logger.warning(msg, e.stdout.strip())
|
|
93
93
|
|
|
94
94
|
|
|
95
95
|
@deps.use
|
|
@@ -610,7 +610,6 @@ async def wait_reload_complete(instance: PostgreSQLInstance, patroni: Patroni) -
|
|
|
610
610
|
# Case where the database can't be reached.
|
|
611
611
|
# This may happen for example after a port change.
|
|
612
612
|
logger.debug(e)
|
|
613
|
-
pass
|
|
614
613
|
|
|
615
614
|
|
|
616
615
|
async def cluster_members(patroni: Patroni) -> list[i.ClusterMember]:
|
|
@@ -410,7 +410,7 @@ class PostgreSQL(_BaseModel):
|
|
|
410
410
|
pg_hba: list[str] | None = None
|
|
411
411
|
pgpass: Path | None = None
|
|
412
412
|
create_replica_methods: list[str] | None = None
|
|
413
|
-
basebackup:
|
|
413
|
+
basebackup: dict[str, Any] | list[str | dict[str, Any]] | None = None
|
|
414
414
|
|
|
415
415
|
|
|
416
416
|
class RESTAPI(common.RESTAPI, _BaseModel):
|
|
@@ -15,7 +15,7 @@ from pydantic import (
|
|
|
15
15
|
)
|
|
16
16
|
|
|
17
17
|
from ... import types
|
|
18
|
-
from ...annotations import CREATE_ONLY, ansible, cli
|
|
18
|
+
from ...annotations import CREATE_ONLY, ansible, api, cli
|
|
19
19
|
from ...models.validators import default_if_none
|
|
20
20
|
from .common import RESTAPI
|
|
21
21
|
|
|
@@ -136,6 +136,7 @@ class Service(types.Service, service_name="patroni"):
|
|
|
136
136
|
cli.HIDDEN,
|
|
137
137
|
ansible.HIDDEN,
|
|
138
138
|
CREATE_ONLY,
|
|
139
|
+
api.HIDDEN,
|
|
139
140
|
Field(description="Members of the Patroni cluster this instance is member of."),
|
|
140
141
|
] = []
|
|
141
142
|
|
|
@@ -143,6 +144,7 @@ class Service(types.Service, service_name="patroni"):
|
|
|
143
144
|
bool | None,
|
|
144
145
|
cli.HIDDEN,
|
|
145
146
|
ansible.HIDDEN,
|
|
147
|
+
api.HIDDEN,
|
|
146
148
|
Field(description="Whether the Patroni cluster is in pause mode."),
|
|
147
149
|
] = None
|
|
148
150
|
|
|
@@ -31,7 +31,7 @@ from .base import stop as stop
|
|
|
31
31
|
from .models import interface as i
|
|
32
32
|
from .models import system as s
|
|
33
33
|
|
|
34
|
-
__all__ = ["available", "
|
|
34
|
+
__all__ = ["available", "iter_backups", "restore"]
|
|
35
35
|
|
|
36
36
|
logger = util.get_logger(__name__)
|
|
37
37
|
|
|
@@ -84,7 +84,8 @@ def make_cmd(stanza: str, settings: _pgbackrest.Settings, *args: str) -> list[st
|
|
|
84
84
|
f"--config-path={settings.configpath}",
|
|
85
85
|
"--log-level-stderr=info",
|
|
86
86
|
f"--stanza={stanza}",
|
|
87
|
-
|
|
87
|
+
*list(args),
|
|
88
|
+
]
|
|
88
89
|
|
|
89
90
|
|
|
90
91
|
parser = partial(configparser.ConfigParser, strict=True)
|
|
@@ -166,9 +167,8 @@ def get_service(
|
|
|
166
167
|
|
|
167
168
|
Fall back to building a new service object from scratch.
|
|
168
169
|
"""
|
|
169
|
-
if upgrading_from:
|
|
170
|
-
|
|
171
|
-
return attrs.evolve(svc, datadir=instance.datadir)
|
|
170
|
+
if upgrading_from and (svc := system_lookup(upgrading_from.datadir, settings)):
|
|
171
|
+
return attrs.evolve(svc, datadir=instance.datadir)
|
|
172
172
|
if svc := system_lookup(instance.datadir, settings):
|
|
173
173
|
if manifest.stanza != svc.stanza:
|
|
174
174
|
raise exceptions.InstanceStateError(
|
|
@@ -388,8 +388,12 @@ async def iter_backups(
|
|
|
388
388
|
for backup in sorted(backups, key=started_at, reverse=True):
|
|
389
389
|
info_set = await backup_info(service, settings, backup_set=backup["label"])
|
|
390
390
|
databases = [db["name"] for db in info_set["backup"][0]["database-ref"]]
|
|
391
|
-
dtstart = datetime.datetime.fromtimestamp(
|
|
392
|
-
|
|
391
|
+
dtstart = datetime.datetime.fromtimestamp(
|
|
392
|
+
backup["timestamp"]["start"], tz=datetime.timezone.utc
|
|
393
|
+
)
|
|
394
|
+
dtstop = datetime.datetime.fromtimestamp(
|
|
395
|
+
backup["timestamp"]["stop"], tz=datetime.timezone.utc
|
|
396
|
+
)
|
|
393
397
|
yield i.Backup(
|
|
394
398
|
label=backup["label"],
|
|
395
399
|
size=backup["info"]["size"],
|
|
@@ -48,11 +48,10 @@ async def site_configure_uninstall(settings: Settings) -> None:
|
|
|
48
48
|
base.site_configure_uninstall(settings)
|
|
49
49
|
s = get_settings(settings)
|
|
50
50
|
util.rmdir(s.configpath)
|
|
51
|
-
if util.exists(repo_path := repository_settings(s).path)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
)
|
|
51
|
+
if util.exists(repo_path := repository_settings(s).path) and ui.confirm(
|
|
52
|
+
f"Delete pgbackrest repository path {repo_path}?", False
|
|
53
|
+
):
|
|
54
|
+
util.check_and_delete_directory(repo_path, "pgBackRest repository path", True)
|
|
56
55
|
|
|
57
56
|
|
|
58
57
|
@hookimpl
|
|
@@ -73,7 +73,7 @@ class PluginManager(pluggy.PluginManager):
|
|
|
73
73
|
unregistered.append(plugin)
|
|
74
74
|
return unregistered
|
|
75
75
|
|
|
76
|
-
def __eq__(self, other:
|
|
76
|
+
def __eq__(self, other: object) -> bool:
|
|
77
77
|
if not isinstance(other, self.__class__):
|
|
78
78
|
return NotImplemented
|
|
79
79
|
return self.get_plugins() == other.get_plugins()
|