The elbevalidate module
Utility to validate the contents of a created image. The image is not booted but only mounted safely through libguestfs.
Example usage:
with Image.from_file('sda.img') as image:
for partition in image.partitions:
print(partition)
with image.files() as root:
print(root.joinpath('etc', 'hostname').read_text())
- class elbevalidate.BlockDevice
The abstract interface for block devices.
- abstract blkid() dict
Device attributes as detected by blkid.
For common tags, see libblkid(3).
- abstract files() ContextManager[Path]
Access to the files as found inside the block device.
- class elbevalidate.Image(gfs)
A full system image, containing a
PartitionTable
withPartition
.- blkid() dict
Device attributes as detected by blkid.
For common tags, see libblkid(3).
- property partitions: PartitionTable
Partitions contained in this image.
- class elbevalidate.Partition(_parent: BlockDevice, number: int, type: str, start: int, _size: int)
A single partition
- blkid() dict
Device attributes as detected by blkid.
For common tags, see libblkid(3).
- type: str
Type of the partition. One of
a GPT UUID (see
elbevalidate.constants.GPTPartitionType
)a DOS partition type number, formatted as hex
- class elbevalidate.PartitionTable(label: PartitionLabel, sector_size: int, _partitions: list[Partition])
List of
Partition
inside anImage
.- len(table)
Number of partitions.
- table[index]
Partition at index.
- partition in table
Iterate over partitions.
- label: PartitionLabel
Type of the partition table.
- elbevalidate.statvfs(path: Path)
An equivalent of
os.statvfs()
working withelbevalidate.path.Path
.
- class elbevalidate.path.Path(*pathsegments, device, guestfs, root=None)
Reference to a path inside a
elbevalidate.BlockDevice
.For documentation see
pathlib
.- exists()
- is_block_device()
- is_char_device()
- is_dir()
- is_fifo()
- is_file()
- is_mount()
- is_socket()
- is_symlink()
- iterdir()
- lstat()
- open(mode='r', buffering=-1, encoding=None, errors=None, newline=None)
- owner()
- read_bytes()
- read_text(encoding=None, errors=None)
- readlink()
- stat()