sos.archive — Archive Interface

class sos.archive.Archive[source]

Bases: object

Abstract base class for archives.

Archive.add_binary(content, dest)[source]
Archive.add_dir(path)[source]
Archive.add_file(src, dest=None)[source]
Archive.add_link(source, link_name)[source]
Archive.add_node(path, mode, device)[source]
Archive.add_string(content, dest, mode='w')[source]
classmethod Archive.archive_type()[source]

Returns the archive class’s name as a string.

Archive.cleanup()[source]

Clean up any temporary resources used by an Archive class.

Archive.finalize(method)[source]

Finalize an archive object via method. This may involve creating An archive that is subsequently compressed or simply closing an archive that supports in-line handling. If method is automatic then the following methods are tried in order: xz, bz2 and gzip

Archive.get_archive_path()[source]

Return a string representing the path to the temporary archive. For archive classes that implement in-line handling this will be the archive file itself. Archives that use a directory based cache prior to packaging should return the path to the temporary directory where the report content is located

Archive.get_tmp_dir()[source]

Return a temporary directory that clients of the archive may use to write content to. The content of the path is guaranteed to be included in the generated archive.

Archive.log = <logging.Logger object at 0x7fd88de20990>
Archive.log_debug(msg)[source]
Archive.log_error(msg)[source]
Archive.log_info(msg)[source]
Archive.log_warn(msg)[source]
Archive.name_max()[source]

Return the maximum file name length this archive can support. This is the lesser of the name length limit of the archive format and any temporary file system based cache.

Archive.set_debug(debug)[source]
class sos.archive.FileCacheArchive(name, tmpdir, policy, threads, enc_opts, sysroot)[source]

Bases: sos.archive.Archive

Abstract superclass for archive types that use a temporary cache directory in the file system.

FileCacheArchive.add_binary(content, dest)[source]
FileCacheArchive.add_dir(path)[source]

Create a directory in the archive.

Parameters:path – the path in the host file system to add
FileCacheArchive.add_file(src, dest=None)[source]
FileCacheArchive.add_link(source, link_name)[source]
FileCacheArchive.add_node(path, mode, device)[source]
FileCacheArchive.add_string(content, dest, mode='w')[source]
FileCacheArchive.cleanup()[source]
FileCacheArchive.dest_path(name)[source]
FileCacheArchive.finalize(method)[source]
FileCacheArchive.get_archive_path()[source]
FileCacheArchive.get_tmp_dir()[source]
FileCacheArchive.join_sysroot(path)[source]
FileCacheArchive.makedirs(path, mode=448)[source]

Create path, including leading components.

Used by sos.sosreport to set up sos_* directories.

FileCacheArchive.name_max()[source]
FileCacheArchive.open_file(path)[source]
class sos.archive.TarFileArchive(name, tmpdir, policy, threads, enc_opts, sysroot)[source]

Bases: sos.archive.FileCacheArchive

archive class using python TarFile to create tar archives

TarFileArchive.copy_permissions_filter(tarinfo)[source]
TarFileArchive.get_selinux_context(path)[source]
TarFileArchive.method = None
TarFileArchive.name()[source]
TarFileArchive.name_max()[source]
TarFileArchive.set_tarinfo_from_stat(tar_info, fstat, mode=None)[source]

Previous topic

sos.plugins — Plugin Interface

Next topic

sos.policies — Policy Interface

This Page