images – Image metadata

This module provides classes for manipulating images.json files. images.json files provide details about images included in composes.

productmd.images.SUPPORTED_IMAGE_TYPES = ['boot', 'cd', 'docker', 'dvd', 'dvd-debuginfo', 'dvd-ostree', 'ec2', 'kvm', 'live', 'netinst', 'p2v', 'qcow2', 'raw-xz', 'rescue', 'rhevm-ova', 'vagrant-libvirt', 'vagrant-virtualbox', 'vpc', 'vsphere-ova']

supported image types

productmd.images.SUPPORTED_IMAGE_FORMATS = ['iso', 'qcow', 'qcow2', 'raw', 'raw.xz', 'rhevm.ova', 'sda.raw', 'tar.gz', 'tar.xz', 'vagrant-libvirt.box', 'vagrant-virtualbox.box', 'vdi', 'vhd', 'vmdk', 'vmx', 'vsphere.ova']

supported image formats, they match with file suffix

productmd.images.UNIQUE_IMAGE_ATTRIBUTES = ['subvariant', 'type', 'format', 'arch', 'disc_number', 'unified', 'additional_variants']

combination of attributes which uniquely identifies an image across composes

class productmd.images.UniqueImage(subvariant, type, format, arch, disc_number, unified, additional_variants)

a namedtuple with unique attributes, use identify_image to create an instance

additional_variants

Alias for field number 6

arch

Alias for field number 3

disc_number

Alias for field number 4

format

Alias for field number 2

subvariant

Alias for field number 0

type

Alias for field number 1

unified

Alias for field number 5

Classes

class productmd.images.Images
add(variant, arch, image)

Assign an Image object to variant and arch.

Parameters:
  • variant (str) – compose variant UID
  • arch (str) – compose architecture
  • image (Image) – image
dump(f)

Dump data to a file.

Parameters:f (file or str) – file-like object or path to file
dumps()

Dump data to a string.

Return type:str
load(f)

Load data from a file.

Parameters:f (file or str) – file-like object or path to file
loads(s)

Load data from a string.

Parameters:s (str) – input data
validate()

Validate attributes by running all self._validate_*() methods.

Raises:
  • TypeError – if an attribute has invalid type
  • ValueError – if an attribute contains invalid value
class productmd.images.Image(parent)
path = None

(str) – relative path to an image, for example: “Server/x86_64/iso/boot.iso”

mtime = None

(int) – image mtime

size = None

(int) – image size

volume_id = None

(str) –

type = None

(str) –

format = None

(str) – Release name, for example: “Fedora”, “Red Hat Enterprise Linux”

arch = None

(str) – image architecture, for example: “x86_64”, “src”

disc_number = None

(int) – Release name, for example: “Fedora”, “Red Hat Enterprise Linux”

disc_count = None

(int) – Release name, for example: “Fedora”, “Red Hat Enterprise Linux”

checksums = None

(str) – Release name, for example: “Fedora”, “Red Hat Enterprise Linux”

implant_md5 = None

(str or None) – value of implanted md5

bootable = None

(bool=False) –

subvariant = None

(str) – image contents, may be same as variant or e.g. ‘KDE’, ‘LXDE’

unified = None

(bool=False) – indicates if the ISO contains content from multiple variants

additional_variants = None

([str]) – indicates which variants are present on the ISO

dump(f)

Dump data to a file.

Parameters:f (file or str) – file-like object or path to file
dumps()

Dump data to a string.

Return type:str
load(f)

Load data from a file.

Parameters:f (file or str) – file-like object or path to file
loads(s)

Load data from a string.

Parameters:s (str) – input data
validate()

Validate attributes by running all self._validate_*() methods.

Raises:
  • TypeError – if an attribute has invalid type
  • ValueError – if an attribute contains invalid value