patroni.scripts.barman.config_switch module

Implements patroni_barman`+ ``+config-switch` sub-command.

Apply a Barman configuration model through pg-backup-api.

This sub-command is specially useful as a on_role_change callback to change Barman configuration in response to failovers and switchovers. Check the output of --help to understand the parameters supported by the sub-command.

It requires that you have previously configured a Barman server and Barman config models, and that you have pg-backup-api configured and running in the same host as Barman.

Refer to ExitCode for possible exit codes of this sub-command.

class _patroni.scripts.barman.config_switch.ExitCode(_value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None) View on GitHub

Bases: IntEnum + Possible exit codes of this script. +

Variables:

+

CONFIG_SWITCH_DONE_ = 0_

+

CONFIG_SWITCH_FAILED_ = 2_

+

CONFIG_SWITCH_SKIPPED_ = 1_

+

HTTP_ERROR_ = 3_

+

INVALID_ARGS_ = 4_
patroni.scripts.barman.config_switch.should_skip_switch(_args: Namespace) → bool View on GitHub

Check if we should skip the config switch operation. +

Parameters:

args – arguments received from the command-line of patroni_barman`+ ``+config-switch` command.

Returns:

if the operation should be skipped.

patroni.scripts.barman.config_switch.switch_config(_api: PgBackupApi, barman_server: str, barman_model: str | None, reset: bool | None) → int View on GitHub

Switch configuration of Barman server through pg-backup-api. + Note

If requests to `+pg-backup-api+` fail recurrently or we face HTTP errors, then exit with link:#patroni.scripts.barman.config_switch.ExitCode.HTTP_ERROR[`+ExitCode.HTTP_ERROR+`].
+
Parameters:;;
Returns:;;
  the return code to be used when exiting the `+patroni_barman+` application. Refer to link:#patroni.scripts.barman.config_switch.ExitCode[`+ExitCode+`].
patroni.scripts.barman.config_switch.run_barman_config_switch(api: PgBackupApi, args: Namespace) → int View on GitHub

Run a remote barman`+ ``+config-switch` through the pg-backup-api. +

Parameters:
Returns:

the return code to be used when exiting the patroni_barman application. Refer to ExitCode.


© Copyright 2015 Compose, Zalando SE. Revision 9d231aee.

Built with Sphinx using a theme provided by Read the Docs.

Read the Docs v: latest

+ Builds