barman.clients.walarchive module#
- class barman.clients.walarchive.ChecksumTarFile(*args, **kwargs)View on GitHub#
Bases:
TarFile
Custom TarFile class that automatically calculates hash checksum of each file and appends a file called ‘MD5SUMS’ or ‘SHA256SUMS’ to the stream, depending on the hash algorithm specified.
- __init__(*args, **kwargs)View on GitHub#
Open an (uncompressed) tar archive `name’. `mode’ is either ‘r’ to read from an existing archive, ‘a’ to append data to an existing file or ‘w’ to create a new file overwriting an existing one. `mode’ defaults to ‘r’. If `fileobj’ is given, it is used for reading or writing data. If it can be determined, `mode’ is overridden by `fileobj’s mode. `fileobj’ is not closed, when TarFile is closed.
- addfile(tarinfo, fileobj=None)View on GitHub#
Add the provided fileobj to the tar using hashCopyfileobj and saves the file hash in the provided ChecksumTarInfo object.
This method completely replaces TarFile.addfile()
- close()View on GitHub#
Add a
HASHSUMS_FILE
file to the tar just before closing.This method extends TarFile.close().
- format = 2#
- tarinfoView on GitHub#
alias of
ChecksumTarInfo
- class barman.clients.walarchive.ChecksumTarInfo(*args, **kwargs)View on GitHub#
Bases:
TarInfo
Special TarInfo that can hold a file checksum
- __init__(*args, **kwargs)View on GitHub#
Construct a TarInfo object. name is the optional name of the member.
- _link_target#
- _sparse_structs#
- chksum#
Header checksum.
- devmajor#
Device major number.
- devminor#
Device minor number.
- gid#
Group ID of the user who originally stored this member.
- gname#
Group name.
- linkname#
Name of the target file name, which is only present in TarInfo objects of type LNKTYPE and SYMTYPE.
- mode#
Permission bits.
- mtime#
Time of last modification.
- name#
Name of the archive member.
- offset#
The tar header starts here.
- offset_data#
The file’s data starts here.
- pax_headers#
A dictionary containing key-value pairs of an associated pax extended header.
- size#
Size in bytes.
- sparse#
Sparse member information.
- tarfile#
- type#
File type. type is usually one of these constants: REGTYPE, AREGTYPE, LNKTYPE, SYMTYPE, DIRTYPE, FIFOTYPE, CONTTYPE, CHRTYPE, BLKTYPE, GNUTYPE_SPARSE.
- uid#
User ID of the user who originally stored this member.
- uname#
User name.
- class barman.clients.walarchive.RemotePutWal(config, wal_path)View on GitHub#
Bases:
object
Spawn a process that sends a WAL to a remote Barman server.
- Parameters:
config (argparse.Namespace) – the configuration from command line
wal_path – The name of WAL to upload
- __init__(config, wal_path)View on GitHub#
- processes = {}#
The list of processes that has been spawned by RemotePutWal
- property returncodeView on GitHub#
Return the exit code of the RemoteGetWal processes.
- Returns:
exit code of the RemoteGetWal processes
- classmethod wait_for_all()View on GitHub#
Wait for the termination of all the registered spawned processes.
- barman.clients.walarchive.build_ssh_command(config)View on GitHub#
Prepare an ssh command according to the arguments passed on command line
- Parameters:
config (argparse.Namespace) – the configuration from command line
- Return list[str]:
the ssh command as list of string
- barman.clients.walarchive.connectivity_test(config)View on GitHub#
Invoke remote put-wal –test to test the connection with Barman server
- Parameters:
config (argparse.Namespace) – the configuration from command line
- barman.clients.walarchive.exit_with_error(message, status=2)View on GitHub#
Print
message
and terminate the script withstatus
- barman.clients.walarchive.hashCopyfileobj(src, dst, length=None, hash_algorithm='sha256')View on GitHub#
Copy length bytes from fileobj src to fileobj dst. If length is None, copy the entire content. This method is used by the ChecksumTarFile.addfile(). Returns the checksum for the specified hashing algorithm.
- barman.clients.walarchive.main(args=None)View on GitHub#
The main script entry point
- barman.clients.walarchive.parse_arguments(args=None)View on GitHub#
Parse the command line arguments