barman.config module#
This module is responsible for all the things related to Barman configuration, such as parsing configuration file.
- class barman.config.BackupOptions(value, key, source)View on GitHub#
Bases:
CsvOption
Extends CsvOption class providing all the details for the backup_options field
- CONCURRENT_BACKUP = 'concurrent_backup'#
- EXCLUSIVE_BACKUP = 'exclusive_backup'#
- EXTERNAL_CONFIGURATION = 'external_configuration'#
- conflicts = {'concurrent_backup': 'exclusive_backup', 'exclusive_backup': 'concurrent_backup'}#
- value_list = ['exclusive_backup', 'concurrent_backup', 'external_configuration']#
- class barman.config.BaseChangeView on GitHub#
Bases:
object
Base class for change objects.
Provides methods for equality comparison, hashing, and conversion to tuple and dictionary.
- _fields = []#
- as_dict()View on GitHub#
Convert to a dictionary, using
_fields
as keys.- Returns:
a dictionary where keys are taken from
_fields
and values are the corresponding values for those fields.
- as_tuple() tuple View on GitHub#
Convert to a tuple, ordered as
_fields
.- Returns:
tuple of values for
_fields
.
- class barman.config.BaseConfigView on GitHub#
Bases:
object
Contains basic methods for handling configuration of Servers and Models.
You are expected to inherit from this class and define at least the :cvar:`PARSERS` dictionary with a mapping of parsers for each suported configuration option.
- PARSERS = {}#
- invoke_parser(key, source, value, new_value)View on GitHub#
Function used for parsing configuration values. If needed, it uses special parsers from the PARSERS map, and handles parsing exceptions.
Uses two values (value and new_value) to manage configuration hierarchy (server config overwrites global config).
- class barman.config.Config(filename=None)View on GitHub#
Bases:
object
This class represents the barman configuration.
Default configuration files are /etc/barman.conf, /etc/barman/barman.conf and ~/.barman.conf for a per-user configuration
- CONFIG_FILES = ['~/.barman.conf', '/etc/barman.conf', '/etc/barman/barman.conf']#
- _QUOTE_RE = re.compile('^(["\'])(.*)\\1$')#
- __init__(filename=None)View on GitHub#
- _apply_models()View on GitHub#
For each Barman server, check for a pre-existing active model.
If a hidden file with a pre-existing active model file exists, apply that on top of the server configuration.
- _check_conflicting_paths()View on GitHub#
Look for conflicting paths intra-server and inter-server
- static _detect_missing_keys(config_items, required_keys, section)View on GitHub#
Check config for any missing required keys
- Parameters:
config_items – list of tuples containing provided parameters along with their values
required_keys – list of required keys
section – source section (for error reporting)
- _is_global_config_changed()View on GitHub#
Return true if something has changed in global configuration
- _is_model(name)View on GitHub#
Check if section name is a model.
- Parameters:
name – name of the config section.
- Returns:
True
if section name is a model,False
otherwise.- Raises:
ValueError
: re-raised if thrown byparse_boolean()
.
- _parse_global_config()View on GitHub#
This method parses the global [barman] section
- _populate_servers_and_models()View on GitHub#
Populate server list and model list from configuration file
Also check for paths errors in configuration. If two or more paths overlap in a single server, that server is disabled. If two or more directory paths overlap between different servers an error is raised.
- static _validate_with_keys(config_items, allowed_keys, section)View on GitHub#
Check every config parameter against a list of allowed keys
- Parameters:
config_items – list of tuples containing provided parameters along with their values
allowed_keys – list of allowed keys
section – source section (for error reporting)
- get(section, option, defaults=None, none_value=None)View on GitHub#
Method to get the value from a given section from Barman configuration
- get_config_source(section, option)View on GitHub#
Get the source INI file from which a config value comes from.
- get_model(name)View on GitHub#
Get the configuration of the specified model.
- Parameters:
name – the model name.
- Returns:
a
ModelConfig
if the model exists, otherwiseNone
.
- get_server(name)View on GitHub#
Get the configuration of the specified server
- Parameters:
name (str) – the server name
- global_config_to_json(with_source=False)View on GitHub#
Return an equivalent dictionary that can be encoded in json
- Parameters:
with_source – if we should include the source file that provides the effective value for each configuration option.
- Returns:
a dictionary. The structure depends on with_source argument:
If
False
: key is the option name, value is its value;If
True
: key is the option name, value is a dict with a couple keys:value
: the value of the option;source
: the file which provides the effective value, if the option has been configured by the user, otherwiseNone
.
- load_config_file(cfile)View on GitHub#
- load_configuration_files_directory()View on GitHub#
Read the “configuration_files_directory” option and load all the configuration files with the .conf suffix that lie in that folder
- model_names()View on GitHub#
Get a list of model names.
- Returns:
a
list
of configured model names.
- models()View on GitHub#
Get a list of models.
- Returns:
a
list
of configuredModelConfig
objects.
- server_names()View on GitHub#
This method returns a list of server names
- servers()View on GitHub#
This method returns a list of server parameters
- validate_global_config()View on GitHub#
Validate global configuration parameters
- validate_model_config(model)View on GitHub#
Validate configuration parameters for a specified model.
- Parameters:
model – the model name.
- validate_server_config(server)View on GitHub#
Validate configuration parameters for a specified server
- Parameters:
server (str) – the server name
- class barman.config.ConfigChange(key, value, config_file=None)View on GitHub#
Bases:
BaseChange
Represents a configuration change received.
- Variables:
str (value) – The key of the configuration change.
str – The value of the configuration change.
Optional[str] (config_file) – The configuration file associated with the change, or
None
.
- __init__(key, value, config_file=None)View on GitHub#
Initialize a
ConfigChange
object.- Parameters:
str (value) – the configuration setting to be changed.
str – the new configuration value.
Optional[str] (config_file) – configuration file associated with the change, if any, or
None
.
- _fields = ['key', 'value', 'config_file']#
- classmethod from_dict(obj)View on GitHub#
Factory method for creating
ConfigChange
objects from a dictionary.- Parameters:
obj (
dict
) – Dictionary representing the configuration change.- Returns:
Configuration change object.
- Return type:
- Raises:
ValueError
: If the dictionary is malformed.
- class barman.config.ConfigChangeSet(section, changes_set=None)View on GitHub#
Bases:
BaseChange
Represents a set of
ConfigChange
for a given configuration section.- Variables:
str (section) – name of the configuration section related with the changes.
:ivar changes_set List[
ConfigChange
]: list of configuration changes to be applied to the section.- __init__(section, changes_set=None)View on GitHub#
Initialize a new
ConfigChangeSet
object.- Parameters:
str (section) – name of the configuration section related with the changes.
List[ConfigChange] (changes_set) – list of configuration changes to be applied to the section.
- _fields = ['section', 'changes_set']#
- classmethod from_dict(obj)View on GitHub#
Factory for configuration change objects.
Generates configuration change objects starting from a dictionary with the same fields.
Note
Handles both
ConfigChange
andConfigChangeSet
mapping.- Parameters:
obj (
dict
) – Dictionary representing the configuration changes set.- Returns:
Configuration set of changes.
- Return type:
- Raises:
ValueError
: If the dictionary is malformed.
- class barman.config.ConfigChangeSetEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)View on GitHub#
Bases:
JSONEncoder
JSON encoder for
ConfigChange
andConfigChangeSet
objects.- default(obj)View on GitHub#
Implement this method in a subclass such that it returns a serializable object for
o
, or calls the base implementation (to raise aTypeError
).For example, to support arbitrary iterators, you could implement default like this:
def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o)
- class barman.config.ConfigChangesProcessor(config)View on GitHub#
Bases:
object
The class is responsible for processing the config changes to apply to the barman config
- __init__(config)View on GitHub#
Initialize a new
ConfigChangesProcessor
object,- Parameters:
Config (config) – the Barman configuration.
- apply_change(changes)View on GitHub#
Apply the given changes to the configuration files.
- Parameters:
List[ConfigChangeSet] (changes) – list of sections and their configuration options to be updated.
- process_conf_changes_queue()View on GitHub#
Process the configuration changes in the queue.
This method iterates over the configuration changes in the queue and applies them one by one. If an error occurs while applying a change, it logs the error and raises an exception.
- Raises:
Exception
: If an error occurs while applying a change.
- receive_config_changes(changes)View on GitHub#
Process all the configuration changes.
- Parameters:
str] (changes Dict[str,) – each key is the name of a section to be updated, and the value is a dictionary of configuration options along with their values that should be updated in such section.
- class barman.config.ConfigChangesQueue(queue_file)View on GitHub#
Bases:
object
Wraps the management of the config changes queue.
The
ConfigChangesQueue
class provides methods to read, write, and manipulate a queue of configuration changes. It is designed to be used as a context manager to ensure proper opening and closing of the queue file.Once instantiated the queue can be accessed using the
queue
property.- __init__(queue_file)View on GitHub#
Initialize the
ConfigChangesQueue
object.- Parameters:
str (queue_file) – file where to persist the queue of changes to be processed.
- close()View on GitHub#
Write the new content and close the
queue_file
.
- open()View on GitHub#
Open and parse the
queue_file
into_queue
.
- property queueView on GitHub#
Returns the queue object.
If the queue object is not yet initialized, it will be opened before returning.
- Returns:
the queue object.
- static read_file(path) List[ConfigChangeSet] View on GitHub#
Reads a json file containing a list of configuration changes.
- Returns:
the list of
ConfigChangeSet
to be applied to Barman configuration sections.
- class barman.config.ConfigMapping(*args, **kwargs)View on GitHub#
Bases:
ConfigParser
Wrapper for
ConfigParser
.Extend the facilities provided by a
ConfigParser
object, and additionally keep track of the source file for each configuration option.This is very useful as Barman allows the user to provide configuration options spread over multiple files in the system, so one can know which file provides the value for a configuration option in use.
Note
When using this class you are expected to use
read_config()
instead of anyread*
method exposed byConfigParser
.- __init__(*args, **kwargs)View on GitHub#
Create a new instance of
ConfigMapping
.Note
We save args and kwargs so we can instantiate a temporary
ConfigParser
with similar options onread_config()
.- Parameters:
args – positional arguments to be passed down to
ConfigParser
.kwargs – keyword arguments to be passed down to
ConfigParser
.
- _abc_impl = <_abc._abc_data object>#
- get_config_source(section, option)View on GitHub#
Get the source INI file from which a config value comes from.
- Parameters:
section – the section of the configuration option.
option – the name of the configuraion option.
- Returns:
the file that provides the effective value for section -> option. If no such configuration exists in the mapping, we assume it has a default value and return the
default
string.
- read_config(filename)View on GitHub#
Read and merge configuration options from filename.
- Parameters:
filename – path to a configuration file or its file descriptor in reading mode.
- Returns:
a list of file names which were able to be parsed, so we are compliant with the return value of
ConfigParser.read()
. In practice the list will always contain at most one item. If filename is a descriptor with noname
attribute, the corresponding entry in the list will beNone
.
- class barman.config.CsvOption(value, key, source)View on GitHub#
Bases:
set
Base class for CSV options.
Given a comma delimited string, this class is a list containing the submitted options. Internally, it uses a set in order to avoid option replication. Allowed values for the CSV option are contained in the ‘value_list’ attribute. The ‘conflicts’ attribute specifies for any value, the list of values that are prohibited (and thus generate a conflict). If a conflict is found, raises a ValueError exception.
- __init__(value, key, source)View on GitHub#
- conflicts = {}#
- parse(value, key, source)View on GitHub#
Parses a list of values and correctly assign the set of values (removing duplication) and checking for conflicts.
- to_json()View on GitHub#
Output representation of the obj for JSON serialization
The result is a string which can be parsed by the same class
- validate(key, source)View on GitHub#
Override this method for special validation needs
- value_list = []#
- class barman.config.ModelConfig(config, name)View on GitHub#
Bases:
BaseConfig
This class represents the configuration for a specific model of a server.
- Variables:
KEYS – list of configuration options that are allowed in a model.
REQUIRED_KEYS – list of configuration options that must always be set when defining a configuration model.
PARSERS – mapping of parsers for the configuration options, if they need special handling.
- KEYS = ['conninfo', 'local_staging_path', 'compression', 'archiver_batch_size', 'streaming_backup_name', 'minimum_redundancy', 'backup_method', 'create_slot', 'retention_policy_mode', 'last_backup_maximum_age', 'forward_config_path', 'keepalive_interval', 'primary_checkpoint_timeout', 'backup_options', 'custom_compression_magic', 'description', 'snapshot_provider', 'custom_compression_filter', 'parallel_jobs_start_batch_period', 'model', 'snapshot_instance', 'max_incoming_wals_queue', 'recovery_staging_path', 'streaming_archiver_name', 'tablespace_bandwidth_limit', 'azure_resource_group', 'backup_compression_workers', 'aws_profile', 'network_compression', 'azure_credential', 'aws_snapshot_lock_cool_off_period', 'basebackup_retry_sleep', 'gcp_zone', 'aws_await_snapshots_timeout', 'streaming_conninfo', 'check_timeout', 'aws_region', 'active', 'snapshot_disks', 'snapshot_zone', 'autogenerate_manifest', 'primary_conninfo', 'parallel_jobs_start_batch_size', 'last_backup_minimum_size', 'reuse_backup', 'primary_ssh_command', 'backup_compression_level', 'gcp_project', 'parallel_jobs', 'disabled', 'path_prefix', 'retention_policy', 'recovery_options', 'backup_compression_location', 'custom_decompression_filter', 'wal_conninfo', 'immediate_checkpoint', 'basebackup_retry_times', 'backup_compression_format', 'bandwidth_limit', 'wal_streaming_conninfo', 'azure_subscription_id', 'last_wal_maximum_age', 'ssh_command', 'aws_snapshot_lock_mode', 'backup_compression', 'wal_retention_policy', 'streaming_archiver_batch_size', 'slot_name', 'snapshot_gcp_project', 'aws_snapshot_lock_duration', 'aws_snapshot_lock_expiration_date', 'archiver', 'cluster', 'streaming_archiver']#
- PARSERS = {'active': <function parse_boolean>, 'archiver': <function parse_boolean>, 'archiver_batch_size': <class 'int'>, 'autogenerate_manifest': <function parse_boolean>, 'aws_await_snapshots_timeout': <class 'int'>, 'aws_snapshot_lock_cool_off_period': <class 'int'>, 'aws_snapshot_lock_duration': <class 'int'>, 'backup_compression': <function parse_backup_compression>, 'backup_compression_format': <function parse_backup_compression_format>, 'backup_compression_level': <class 'int'>, 'backup_compression_location': <function parse_backup_compression_location>, 'backup_compression_workers': <class 'int'>, 'backup_method': <function parse_backup_method>, 'backup_options': <class 'barman.config.BackupOptions'>, 'basebackup_retry_sleep': <class 'int'>, 'basebackup_retry_times': <class 'int'>, 'check_timeout': <class 'int'>, 'create_slot': <function parse_create_slot>, 'disabled': <function parse_boolean>, 'forward_config_path': <function parse_boolean>, 'immediate_checkpoint': <function parse_boolean>, 'keepalive_interval': <class 'int'>, 'last_backup_maximum_age': <function parse_time_interval>, 'last_backup_minimum_size': <function parse_si_suffix>, 'last_wal_maximum_age': <function parse_time_interval>, 'local_staging_path': <function parse_staging_path>, 'max_incoming_wals_queue': <class 'int'>, 'model': <function parse_boolean>, 'network_compression': <function parse_boolean>, 'parallel_jobs': <class 'int'>, 'parallel_jobs_start_batch_period': <class 'int'>, 'parallel_jobs_start_batch_size': <class 'int'>, 'primary_checkpoint_timeout': <class 'int'>, 'recovery_options': <class 'barman.config.RecoveryOptions'>, 'recovery_staging_path': <function parse_staging_path>, 'reuse_backup': <function parse_reuse_backup>, 'slot_name': <function parse_slot_name>, 'snapshot_disks': <function parse_snapshot_disks>, 'streaming_archiver': <function parse_boolean>, 'streaming_archiver_batch_size': <class 'int'>}#
- REQUIRED_KEYS = ['cluster', 'model']#
- _KEYS_BLACKLIST = {'backup_directory', 'basebackups_directory', 'errors_directory', 'incoming_wals_directory', 'post_archive_retry_script', 'post_archive_script', 'post_backup_retry_script', 'post_backup_script', 'post_delete_retry_script', 'post_delete_script', 'post_recovery_retry_script', 'post_recovery_script', 'post_wal_delete_retry_script', 'post_wal_delete_script', 'pre_archive_retry_script', 'pre_archive_script', 'pre_backup_retry_script', 'pre_backup_script', 'pre_delete_retry_script', 'pre_delete_script', 'pre_recovery_retry_script', 'pre_recovery_script', 'pre_wal_delete_retry_script', 'pre_wal_delete_script', 'streaming_wals_directory', 'wals_directory'}#
- __init__(config, name)View on GitHub#
- get_override_options()View on GitHub#
Get a list of options which values in the server should be override.
- Yield:
tuples os option name and value which should override the value specified in the server with the value specified in the model.
- key = 'post_archive_retry_script'#
- to_json(with_source=False)View on GitHub#
Return an equivalent dictionary that can be encoded in json
- Parameters:
with_source – if we should include the source file that provides the effective value for each configuration option.
- Returns:
a dictionary. The structure depends on with_source argument:
If
False
: key is the option name, value is its value;If
True
: key is the option name, value is a dict with a couple keys:value
: the value of the option;source
: the file which provides the effective value, if the option has been configured by the user, otherwiseNone
.
- class barman.config.PathConflict(label, server)#
Bases:
tuple
- _asdict()#
Return a new dict which maps field names to their values.
- _field_defaults = {}#
- _fields = ('label', 'server')#
- classmethod _make(iterable)#
Make a new PathConflict object from a sequence or iterable
- _replace(**kwds)#
Return a new PathConflict object replacing specified fields with new values
- label#
Alias for field number 0
- server#
Alias for field number 1
- class barman.config.RecoveryOptions(value, key, source)View on GitHub#
Bases:
CsvOption
Extends CsvOption class providing all the details for the recovery_options field
- GET_WAL = 'get-wal'#
- value_list = ['get-wal']#
- class barman.config.ServerConfig(config, name)View on GitHub#
Bases:
BaseConfig
This class represents the configuration for a specific Server instance.
- BARMAN_KEYS = ['archiver', 'archiver_batch_size', 'autogenerate_manifest', 'aws_await_snapshots_timeout', 'aws_snapshot_lock_mode', 'aws_snapshot_lock_duration', 'aws_snapshot_lock_cool_off_period', 'aws_snapshot_lock_expiration_date', 'aws_profile', 'aws_region', 'azure_credential', 'azure_resource_group', 'azure_subscription_id', 'backup_compression', 'backup_compression_format', 'backup_compression_level', 'backup_compression_location', 'backup_compression_workers', 'backup_method', 'backup_options', 'bandwidth_limit', 'basebackup_retry_sleep', 'basebackup_retry_times', 'check_timeout', 'compression', 'configuration_files_directory', 'create_slot', 'custom_compression_filter', 'custom_decompression_filter', 'custom_compression_magic', 'forward_config_path', 'gcp_project', 'immediate_checkpoint', 'keepalive_internval', 'last_backup_maximum_age', 'last_backup_minimum_size', 'last_wal_maximum_age', 'local_staging_path', 'max_incoming_wals_queue', 'minimum_redundancy', 'network_compression', 'parallel_jobs', 'parallel_jobs_start_batch_period', 'parallel_jobs_start_batch_size', 'path_prefix', 'post_archive_retry_script', 'post_archive_script', 'post_backup_retry_script', 'post_backup_script', 'post_delete_script', 'post_delete_retry_script', 'post_recovery_retry_script', 'post_recovery_script', 'post_wal_delete_script', 'post_wal_delete_retry_script', 'pre_archive_retry_script', 'pre_archive_script', 'pre_backup_retry_script', 'pre_backup_script', 'pre_delete_script', 'pre_delete_retry_script', 'pre_recovery_retry_script', 'pre_recovery_script', 'pre_wal_delete_script', 'pre_wal_delete_retry_script', 'primary_ssh_command', 'recovery_options', 'recovery_staging_path', 'retention_policy', 'retention_policy_mode', 'reuse_backup', 'slot_name', 'snapshot_gcp_project', 'snapshot_provider', 'streaming_archiver', 'streaming_archiver_batch_size', 'streaming_archiver_name', 'streaming_backup_name', 'tablespace_bandwidth_limit', 'wal_retention_policy']#
- DEFAULTS = {'active': 'true', 'archiver': 'off', 'archiver_batch_size': '0', 'autogenerate_manifest': 'false', 'aws_await_snapshots_timeout': '3600', 'backup_directory': '%(barman_home)s/%(name)s', 'backup_method': 'rsync', 'backup_options': '', 'basebackup_retry_sleep': '30', 'basebackup_retry_times': '0', 'basebackups_directory': '%(backup_directory)s/base', 'check_timeout': '30', 'cluster': '%(name)s', 'create_slot': 'manual', 'disabled': 'false', 'errors_directory': '%(backup_directory)s/errors', 'forward_config_path': 'false', 'immediate_checkpoint': 'false', 'incoming_wals_directory': '%(backup_directory)s/incoming', 'keepalive_interval': '60', 'minimum_redundancy': '0', 'network_compression': 'false', 'parallel_jobs': '1', 'parallel_jobs_start_batch_period': '1', 'parallel_jobs_start_batch_size': '10', 'primary_checkpoint_timeout': '0', 'recovery_options': '', 'retention_policy_mode': 'auto', 'streaming_archiver': 'off', 'streaming_archiver_batch_size': '0', 'streaming_archiver_name': 'barman_receive_wal', 'streaming_backup_name': 'barman_streaming_backup', 'streaming_conninfo': '%(conninfo)s', 'streaming_wals_directory': '%(backup_directory)s/streaming', 'wal_retention_policy': 'main', 'wals_directory': '%(backup_directory)s/wals'}#
- FIXED = ['disabled']#
- KEYS = ['active', 'archiver', 'archiver_batch_size', 'autogenerate_manifest', 'aws_await_snapshots_timeout', 'aws_snapshot_lock_mode', 'aws_snapshot_lock_duration', 'aws_snapshot_lock_cool_off_period', 'aws_snapshot_lock_expiration_date', 'aws_profile', 'aws_region', 'azure_credential', 'azure_resource_group', 'azure_subscription_id', 'backup_compression', 'backup_compression_format', 'backup_compression_level', 'backup_compression_location', 'backup_compression_workers', 'backup_directory', 'backup_method', 'backup_options', 'bandwidth_limit', 'basebackup_retry_sleep', 'basebackup_retry_times', 'basebackups_directory', 'check_timeout', 'cluster', 'compression', 'conninfo', 'custom_compression_filter', 'custom_decompression_filter', 'custom_compression_magic', 'description', 'disabled', 'errors_directory', 'forward_config_path', 'gcp_project', 'gcp_zone', 'immediate_checkpoint', 'incoming_wals_directory', 'keepalive_interval', 'last_backup_maximum_age', 'last_backup_minimum_size', 'last_wal_maximum_age', 'local_staging_path', 'max_incoming_wals_queue', 'minimum_redundancy', 'network_compression', 'parallel_jobs', 'parallel_jobs_start_batch_period', 'parallel_jobs_start_batch_size', 'path_prefix', 'post_archive_retry_script', 'post_archive_script', 'post_backup_retry_script', 'post_backup_script', 'post_delete_script', 'post_delete_retry_script', 'post_recovery_retry_script', 'post_recovery_script', 'post_wal_delete_script', 'post_wal_delete_retry_script', 'pre_archive_retry_script', 'pre_archive_script', 'pre_backup_retry_script', 'pre_backup_script', 'pre_delete_script', 'pre_delete_retry_script', 'pre_recovery_retry_script', 'pre_recovery_script', 'pre_wal_delete_script', 'pre_wal_delete_retry_script', 'primary_checkpoint_timeout', 'primary_conninfo', 'primary_ssh_command', 'recovery_options', 'recovery_staging_path', 'create_slot', 'retention_policy', 'retention_policy_mode', 'reuse_backup', 'slot_name', 'snapshot_disks', 'snapshot_gcp_project', 'snapshot_instance', 'snapshot_provider', 'snapshot_zone', 'ssh_command', 'streaming_archiver', 'streaming_archiver_batch_size', 'streaming_archiver_name', 'streaming_backup_name', 'streaming_conninfo', 'streaming_wals_directory', 'tablespace_bandwidth_limit', 'wal_conninfo', 'wal_retention_policy', 'wal_streaming_conninfo', 'wals_directory']#
- PARSERS = {'active': <function parse_boolean>, 'archiver': <function parse_boolean>, 'archiver_batch_size': <class 'int'>, 'autogenerate_manifest': <function parse_boolean>, 'aws_await_snapshots_timeout': <class 'int'>, 'aws_snapshot_lock_cool_off_period': <class 'int'>, 'aws_snapshot_lock_duration': <class 'int'>, 'backup_compression': <function parse_backup_compression>, 'backup_compression_format': <function parse_backup_compression_format>, 'backup_compression_level': <class 'int'>, 'backup_compression_location': <function parse_backup_compression_location>, 'backup_compression_workers': <class 'int'>, 'backup_method': <function parse_backup_method>, 'backup_options': <class 'barman.config.BackupOptions'>, 'basebackup_retry_sleep': <class 'int'>, 'basebackup_retry_times': <class 'int'>, 'check_timeout': <class 'int'>, 'create_slot': <function parse_create_slot>, 'disabled': <function parse_boolean>, 'forward_config_path': <function parse_boolean>, 'immediate_checkpoint': <function parse_boolean>, 'keepalive_interval': <class 'int'>, 'last_backup_maximum_age': <function parse_time_interval>, 'last_backup_minimum_size': <function parse_si_suffix>, 'last_wal_maximum_age': <function parse_time_interval>, 'local_staging_path': <function parse_staging_path>, 'max_incoming_wals_queue': <class 'int'>, 'network_compression': <function parse_boolean>, 'parallel_jobs': <class 'int'>, 'parallel_jobs_start_batch_period': <class 'int'>, 'parallel_jobs_start_batch_size': <class 'int'>, 'primary_checkpoint_timeout': <class 'int'>, 'recovery_options': <class 'barman.config.RecoveryOptions'>, 'recovery_staging_path': <function parse_staging_path>, 'reuse_backup': <function parse_reuse_backup>, 'slot_name': <function parse_slot_name>, 'snapshot_disks': <function parse_snapshot_disks>, 'streaming_archiver': <function parse_boolean>, 'streaming_archiver_batch_size': <class 'int'>}#
- __init__(config, name)View on GitHub#
- apply_model(model, from_cli=False)View on GitHub#
Apply config from a model named name.
- Parameters:
model – the model to be applied.
from_cli –
True
if this function has been called by the user through a command, e.g.barman-config-switch
.False
if it has been called internally by Barman.INFO
messages are written in the first case,DEBUG
messages in the second case.
- get_bwlimit(tablespace=None)View on GitHub#
Return the configured bandwidth limit for the provided tablespace
If tablespace is None, it returns the global bandwidth limit
- Parameters:
tablespace (barman.infofile.Tablespace) – the tablespace to copy
- Return type:
- get_wal_conninfo()View on GitHub#
Return WAL-specific conninfo strings for this server.
Returns the value of
wal_streaming_conninfo
andwal_conninfo
if they are set in the configuration. Ifwal_conninfo
is unset then it will be given the value ofwal_streaming_conninfo
. Ifwal_streaming_conninfo
is unset then fall back tostreaming_conninfo
andconninfo
.
- reset_model()View on GitHub#
Reset the active model for this server, if any.
- to_json(with_source=False)View on GitHub#
Return an equivalent dictionary that can be encoded in json
- Parameters:
with_source – if we should include the source file that provides the effective value for each configuration option.
- Returns:
a dictionary. The structure depends on with_source argument:
If
False
: key is the option name, value is its value;If
True
: key is the option name, value is a dict with a couple keys:value
: the value of the option;source
: the file which provides the effective value, if the option has been configured by the user, otherwiseNone
.
- update_msg_list_and_disable_server(msg_list)View on GitHub#
Will take care of upgrading msg_list :param msg_list: str|list can be either a string or a list of strings
- barman.config._main()View on GitHub#
- barman.config.parse_backup_compression(value)View on GitHub#
Parse a string to a valid backup_compression value.
- Parameters:
value (str) – backup_compression value
- Raises:
ValueError – if the value is invalid
- barman.config.parse_backup_compression_format(value)View on GitHub#
Parse a string to a valid backup_compression format value.
Valid values are “plain” and “tar”
- Parameters:
value (str) – backup_compression_location value
- Raises:
ValueError – if the value is invalid
- barman.config.parse_backup_compression_location(value)View on GitHub#
Parse a string to a valid backup_compression location value.
Valid values are “client” and “server”
- Parameters:
value (str) – backup_compression_location value
- Raises:
ValueError – if the value is invalid
- barman.config.parse_backup_method(value)View on GitHub#
Parse a string to a valid backup_method value.
Valid values are contained in BACKUP_METHOD_VALUES list
- Parameters:
value (str) – backup_method value
- Raises:
ValueError – if the value is invalid
- barman.config.parse_boolean(value)View on GitHub#
Parse a string to a boolean value
- Parameters:
value (str) – string representing a boolean
- Raises:
ValueError – if the string is an invalid boolean representation
- barman.config.parse_create_slot(value)View on GitHub#
Parse a string to a valid create_slot value.
Valid values are “manual” and “auto”
- Parameters:
value (str) – create_slot value
- Raises:
ValueError – if the value is invalid
- barman.config.parse_reuse_backup(value)View on GitHub#
Parse a string to a valid reuse_backup value.
Valid values are “copy”, “link” and “off”
- Parameters:
value (str) – reuse_backup value
- Raises:
ValueError – if the value is invalid
- barman.config.parse_si_suffix(value)View on GitHub#
Parse a string, transforming it into integer and multiplying by the SI or IEC suffix eg a suffix of Ki multiplies the integer value by 1024 and returns the new value
Accepted format: N (k|Ki|M|Mi|G|Gi|T|Ti)
- Parameters:
value (str) – the string to evaluate
- barman.config.parse_slot_name(value)View on GitHub#
Replication slot names may only contain lower case letters, numbers, and the underscore character. This function parse a replication slot name
- Parameters:
value (str) – slot_name value
- Returns:
- barman.config.parse_snapshot_disks(value)View on GitHub#
Parse a comma separated list of names used to reference disks managed by a cloud provider.
- Parameters:
value (str) – Comma separated list of disk names
- Returns:
List of disk names
- barman.config.parse_staging_path(value)View on GitHub#
- barman.config.parse_time_interval(value)View on GitHub#
Parse a string, transforming it in a time interval. Accepted format: N (day|month|week)s
- Parameters:
value (str) – the string to evaluate