pylorax Package

pylorax Package

class pylorax.ArchData(buildarch)[source]

Bases: pylorax.base.DataHolder

bcj_arch = {'ppc': 'powerpc', 'x86_64': 'x86', 'i386': 'x86', 'armhfp': 'arm', 'ppc64le': 'powerpc', 'ppc64': 'powerpc', 'arm': 'arm'}
lib64_arches = ('x86_64', 'ppc64', 'ppc64le', 's390x', 'ia64', 'aarch64')
class pylorax.Lorax[source]

Bases: pylorax.base.BaseLoraxClass

init_file_logging(logdir, logname='pylorax.log')[source]
run(ybo, product, version, release, variant='', bugurl='', isfinal=False, workdir=None, outputdir=None, buildarch=None, volid=None, domacboot=False, doupgrade=True, remove_temp=False, installpkgs=None, size=2, add_templates=None, add_template_vars=None, add_arch_templates=None, add_arch_template_vars=None, template_tempdir=None, user_dracut_args=None)[source]

Log the current state of selinux

base Module

class pylorax.base.BaseLoraxClass[source]

Bases: object

pcritical(msg, fobj=<open file '<stdout>', mode 'w' at 0x7f44874d0150>)[source]
pdebug(msg, fobj=<open file '<stdout>', mode 'w' at 0x7f44874d0150>)[source]
perror(msg, fobj=<open file '<stdout>', mode 'w' at 0x7f44874d0150>)[source]
pinfo(msg, fobj=<open file '<stdout>', mode 'w' at 0x7f44874d0150>)[source]
pwarning(msg, fobj=<open file '<stdout>', mode 'w' at 0x7f44874d0150>)[source]
class pylorax.base.DataHolder(**kwargs)[source]

Bases: dict


buildstamp Module

class pylorax.buildstamp.BuildStamp(product, version, bugurl, isfinal, buildarch)[source]

Bases: object


creator Module

class pylorax.creator.KernelInfo(boot_dir)[source]

Bases: object

Info about the kernels in boot_dir


Get the arch of the first kernel in boot_dir

Defaults to i386


Get a list of the kernels in the boot_dir

Examine the vmlinuz-* versions and return a list of them

Ignore any with -rescue- in them, these are dracut rescue images. The user shoud add -dracut-config-rescue to the kickstart to remove them, but catch it here as well.

pylorax.creator.create_pxe_config(template, images_dir, live_image_name, add_args=None)[source]

Create template for pxe to live configuration

  • images_dir (str) – Path of directory with images to be used
  • live_image_name (str) – Name of live rootfs image file
  • add_args (list) – Arguments to be added to initrd= pxe config

Find root of ostree deployment

Parameters:phys_root (str) – Path to physical root
Returns:Relative path of ostree deployment root
Return type:str
Raises Exception:
 More than one deployment roots were found

Return the size of the kickstart’s disk partitions

Parameters:ks (Kickstart object) – The kickstart
Returns:The size of the disk, in GiB

Return True if the disk_img is mounted

pylorax.creator.make_appliance(disk_img, name, template, outfile, networks=None, ram=1024, vcpus=1, arch=None, title='Linux', project='Linux', releasever='7')[source]

Generate an appliance description file

disk_img Full path of the disk image name Name of the appliance, passed to the template template Full path of Mako template outfile Full path of file to write, using template networks List of networks from the kickstart ram Ram, in MB, passed to template. Default is 1024 vcpus CPUs, passed to template. Default is 1 arch CPU architecture. Default is ‘x86_64’ title Title, passed to template. Default is ‘Linux’ project Project, passed to template. Default is ‘Linux’ releasever Release version, passed to template. Default is 17

pylorax.creator.make_image(opts, ks, cancel_func=None)[source]

Install to an image

Use virt or anaconda to install to an image.

Returns the full path of of the image created.

pylorax.creator.make_live_images(opts, work_dir, root_dir, rootfs_image=None, size=None)[source]

Create live images from direcory or rootfs image

  • opts (argparse options) – options passed to livemedia-creator
  • work_dir (str) – Directory for storing results
  • root_dir (str) – Root directory of live filesystem tree
  • rootfs_image (str) – Path to live rootfs image to be used

Path of directory with created images

Return type:


pylorax.creator.make_livecd(opts, mount_dir, work_dir)[source]

Take the content from the disk image and make a livecd out of it

This uses wwood’s squashfs live initramfs method:
  • put the real / into LiveOS/rootfs.img
  • make a squashfs of the LiveOS/rootfs.img tree
  • make a simple initramfs with the squashfs.img and /etc/cmdline in it
  • make a cpio of that tree
  • append the squashfs.cpio to a dracut initramfs for each kernel installed

Then on boot dracut reads /etc/cmdline which points to the squashfs.img mounts that and then mounts LiveOS/rootfs.img as /

pylorax.creator.make_runtime(opts, mount_dir, work_dir)[source]

Make the squashfs image from a directory

Result is in work_dir+RUNTIME

pylorax.creator.make_squashfs(disk_img, work_dir, compression='xz')[source]

Take disk_img and put it into LiveOS/rootfs.img and squashfs this tree into work_dir+RUNTIME


Mount boot partition to /boot of root fs mounted in img_mount

Used for OSTree so it finds deployment configurations on live rootfs

param img_mount: object with mounted disk image root partition type img_mount: imgutils.PartitionMount

pylorax.creator.rebuild_initrds_for_live(opts, sys_root_dir, results_dir)[source]

Rebuild intrds for pxe live image (root=live:http://)

  • opts (argparse options) – options passed to livemedia-creator
  • sys_root_dir (str) – Path to root of the system
  • results_dir (str) – Path of directory for storing results
pylorax.creator.run_creator(opts, cancel_func=None)[source]

Run the image creator process

Parameters:opts (Either a DataHolder or ArgumentParser) – Commandline options to control the process
Returns:The result directory and the disk image path.
Return type:Tuple of str

This function takes the opts arguments and creates the selected output image. See the cmdline –help for livemedia-creator for the possible options

(Yes, this is not ideal, but we can fix that later)

decorators Module


discinfo Module

class pylorax.discinfo.DiscInfo(release, basearch)[source]

Bases: object


executils Module

class pylorax.executils.ExecProduct(rc, stdout, stderr)[source]

Bases: object

pylorax.executils.execWithCallback(command, argv, stdin=None, stdout=None, stderr=None, echo=True, callback=None, callback_data=None, root='/')[source]
pylorax.executils.execWithCapture(command, argv, stdin=None, stderr=None, root=None, preexec_fn=None, cwd=None, raise_err=False)[source]

Run an external program and capture standard out. @param command The command to run. @param argv A list of arguments. @param stdin The file descriptor to read stdin from. @param stderr The file descriptor to redirect stderr to. @param root The directory to chroot to before running command. @param preexec_fn function to pass to Popen @param cwd working directory to pass to Popen @param raise_err raise CalledProcessError when the returncode is not 0 @return The output of command from stdout.

pylorax.executils.execWithPulseProgress(command, argv, stdin=None, stdout=None, stderr=None, echo=True, progress=None, root='/')[source]
pylorax.executils.execWithRedirect(command, argv, stdin=None, stdout=None, stderr=None, root=None, preexec_fn=None, cwd=None, raise_err=False, callback_func=None, callback_args=None)[source]

Run an external program and redirect the output to a file. @param command The command to run. @param argv A list of arguments. @param stdin The file descriptor to read stdin from. @param stdout The file descriptor to redirect stdout to. @param stderr The file descriptor to redirect stderr to. @param root The directory to chroot to before running command. @param preexec_fn function to pass to Popen @param cwd working directory to pass to Popen @param raise_err raise CalledProcessError when the returncode is not 0 @return The return code of command.

pylorax.executils.runcmd(cmd, **kwargs)[source]

run execWithRedirect with raise_err=True

pylorax.executils.runcmd_output(cmd, **kwargs)[source]

run execWithCapture with raise_err=True

class pylorax.executils.tee(inputdesc, outputdesc, logmethod, command)[source]

Bases: threading.Thread

Python reimplementation of the shell tee process, so we can feed the pipe output into two places at the same time


imgutils Module

class pylorax.imgutils.DMDev(dev, size, name=None)[source]

Bases: object

class pylorax.imgutils.LoopDev(filename, size=None)[source]

Bases: object

class pylorax.imgutils.Mount(dev, opts='', mnt=None)[source]

Bases: object

class pylorax.imgutils.PartitionMount(disk_img, mount_ok=None)[source]

Bases: object

Mount a partitioned image file using kpartx

pylorax.imgutils.compress(command, rootdir, outfile, compression='xz', compressargs=None)[source]

Make a compressed archive of the given rootdir. command is a list of the archiver commands to run compression should be “xz”, “gzip”, “lzma”, “bzip2”, or None. compressargs will be used on the compression commandline.

pylorax.imgutils.copytree(src, dest, preserve=True)[source]

Copy a tree of files using cp -a, thus preserving modes, timestamps, links, acls, sparse files, xattrs, selinux contexts, etc. If preserve is False, uses cp -R (useful for modeless filesystems) raises CalledProcessError if copy fails.

pylorax.imgutils.default_image_name(compression, basename)[source]

Return a default image name with the correct suffix for the compression type.

  • compression (str) – Compression type
  • basename (str) – Base filename

basename with compression suffix

If the compression is unknown it defaults to xz

pylorax.imgutils.dm_attach(dev, size, name=None)[source]

Attach a devicemapper device to the given device, with the given size. If name is None, a random name will be chosen. Returns the device name. raises CalledProcessError if dmsetup fails.


Detach the named devicemapper device. Returns False if dmsetup fails.

pylorax.imgutils.do_grafts(grafts, dest, preserve=True)[source]

Copy each of the items listed in grafts into dest. If the key ends with ‘/’ it’s assumed to be a directory which should be created, otherwise just the leading directories will be created.

pylorax.imgutils.estimate_size(rootdir, graft=None, fstype=None, blocksize=4096, overhead=128)[source]

Return the loop device associated with the path. Raises RuntimeError if more than one loop is associated


Attach a loop device to the given file. Return the loop device name.

On rare occasions it appears that the device never shows up, some experiments seem to indicate that it may be a race with another process using /dev/loop* devices.

So we now try 3 times before actually failing.

Raises CalledProcessError if losetup fails.


Detach the given loop device. Return False on failure.

pylorax.imgutils.loop_waitfor(loop_dev, outfile)[source]

Make sure the loop device is attached to the outfile.

It seems that on rare occasions losetup can return before the /dev/loopX is ready for use, causing problems with mkfs. This tries to make sure that the loop device really is associated with the backing file before continuing.

Raise RuntimeError if it isn’t setup after 5 tries.

pylorax.imgutils.mkbtrfsimg(rootdir, outfile, size=None, label='', mountargs='', graft=None)[source]
pylorax.imgutils.mkcpio(rootdir, outfile, compression='xz', compressargs=None)[source]
pylorax.imgutils.mkdiskfsimage(diskimage, fsimage, label='Anaconda')[source]

Copy the / partition of a partitioned disk image to an un-partitioned disk image.

diskimage is the full path to partitioned disk image with a / fsimage is the full path of the output fs image file label is the label to apply to the image. Defaults to “Anaconda”

pylorax.imgutils.mkdosimg(rootdir, outfile, size=None, label='', mountargs='shortname=winnt, umask=0077', graft=None)[source]
pylorax.imgutils.mkext4img(rootdir, outfile, size=None, label='', mountargs='', graft=None)[source]
pylorax.imgutils.mkfsimage(fstype, rootdir, outfile, size=None, mkfsargs=None, mountargs='', graft=None)[source]

Generic filesystem image creation function. fstype should be a filesystem type - “mkfs.${fstype}” must exist. graft should be a dict: {“some/path/in/image”: “local/file/or/dir”};

if the path ends with a ‘/’ it’s assumed to be a directory.

Will raise CalledProcessError if something goes wrong.

pylorax.imgutils.mkhfsimg(rootdir, outfile, size=None, label='', mountargs='', graft=None)[source]
pylorax.imgutils.mkqcow2(outfile, size, options=None)[source]

use qemu-img to create a file of the given size. options is a list of options passed to qemu-img

Default format is qcow2, override by passing “-f”, fmt in options.

pylorax.imgutils.mkrootfsimg(rootdir, outfile, label, size=2, sysroot='')[source]

Make rootfs image from a directory

  • rootdir (str) – Root directory
  • outfile (str) – Path of output image file
  • label (str) – Filesystem label
  • size (int) – Size of the image in GiB, if None computed automatically
  • sysroot (str) – path to system (deployment) root relative to physical root
pylorax.imgutils.mksparse(outfile, size)[source]

use os.ftruncate to create a sparse file of the given size.

pylorax.imgutils.mksquashfs(rootdir, outfile, compression='default', compressargs=None)[source]

Make a squashfs image containing the given rootdir.

pylorax.imgutils.mktar(rootdir, outfile, compression='xz', compressargs=None)[source]
pylorax.imgutils.mount(dev, opts='', mnt=None)[source]

Mount the given device at the given mountpoint, using the given opts. opts should be a comma-separated string of mount options. if mnt is none, a temporary directory will be created and its path will be returned. raises CalledProcessError if mount fails.

pylorax.imgutils.round_to_blocks(size, blocksize)[source]

If size isn’t a multiple of blocksize, round up to the next multiple

pylorax.imgutils.umount(mnt, lazy=False, maxretry=3, retrysleep=1.0)[source]

Unmount the given mountpoint. If lazy is True, do a lazy umount (-l). If the mount was a temporary dir created by mount, it will be deleted. raises CalledProcessError if umount fails.

installer Module

exception pylorax.installer.InstallError[source]

Bases: exceptions.Exception

class pylorax.installer.IsoMountpoint(iso_path, initrd_path=None)[source]

Bases: object

Mount the iso on a temporary directory and check to make sure the vmlinuz and initrd.img files exist Check the iso for a LiveOS directory and set a flag. Extract the iso’s label.

initrd_path can be used to point to a boot.iso tree with a newer initrd.img than the iso has. The iso is still used for stage2.


Get the iso’s label using isoinfo

class pylorax.installer.VirtualInstall(iso, ks_paths, disk_img, img_size=2, kernel_args=None, memory=1024, vnc=None, arch=None, cancel_func=None, virtio_host='', virtio_port=6080, qcow2=False, boot_uefi=False, ovmf_path=None)[source]

Bases: object

Run virt-install using an iso and kickstart(s)


Make sure the virt has been shut down and destroyed

Could use libvirt for this instead.

pylorax.installer.novirt_install(opts, disk_img, disk_size, repo_url, cancel_func=None)[source]

Use Anaconda to install to a disk image

pylorax.installer.virt_install(opts, install_log, disk_img, disk_size, cancel_func=None)[source]

Use virt-install to install to a disk image

install_log is the path to write the log from virt-install disk_img is the full path to the final disk or filesystem image disk_size is the size of the disk to create in GiB

logmonitor Module

class pylorax.logmonitor.LogMonitor(log_path, host='localhost', port=0)[source]

Bases: object

Contains all the stuff needed to setup a thread to listen to the logs from the virtual install

class pylorax.logmonitor.LogRequestHandler(request, client_address, server)[source]

Bases: SocketServer.BaseRequestHandler

Handle monitoring and saving the logfiles from the virtual install


Handle writing incoming data to a logfile and checking the logs for any Tracebacks or other errors that indicate that the install failed.


Check a line to see if it contains an error indicating install failure

class pylorax.logmonitor.LogServer(log_path, *args, **kwargs)[source]

Bases: SocketServer.TCPServer

Add path to logfile Add log error flag Add a kill switch


ltmpl Module

class pylorax.ltmpl.LoraxTemplate(directories=None)[source]

Bases: object

parse(template_file, variables)[source]
class pylorax.ltmpl.LoraxTemplateRunner(inroot, outroot, yum_obj=None, fatalerrors=True, templatedir=None, defaults=None)[source]

Bases: object

This class parses and executes Lorax templates. Sample usage:

# install a bunch of packages runner = LoraxTemplateRunner(inroot=rundir, outroot=rundir, yum=yum_obj)“install-packages.ltmpl”)

# modify a runtime dir runner = LoraxTemplateRunner(inroot=rundir, outroot=newrun)“runtime-transmogrify.ltmpl”)


  • Parsing procedure is roughly: 1. Mako template expansion (on the whole file) 2. For each line of the result,

    1. Whitespace splitting (using shlex.split())
    2. Brace expansion (using brace_expand())
    3. If the first token is the name of a function, call that function with the rest of the line as arguments
  • Parsing and execution are separate passes - so you can’t use the result of a command in an %if statement (or any other control statements)!

  • Commands that run external programs (systemctl, gconfset) currently use the host‘s copy of that program, which may cause problems if there’s a big enough difference between the host and the image you’re modifying.

  • The commands are not executed under a real chroot, so absolute symlinks will point outside the inroot/outroot. Be careful with symlinks!


  • Each template command is just a method of the LoraxTemplateRunner object - so adding a new command is as easy as adding a new function.
  • Each function gets arguments that correspond to the rest of the tokens on that line (after word splitting and brace expansion)
  • Commands should raise exceptions for errors - don’t use sys.exit()
append(filename, data)[source]

append FILE STRING Append STRING (followed by a newline character) to FILE. Python character escape sequences (‘n’, ‘t’, etc.) will be converted to the appropriate characters. Examples:

append /etc/depmod.d/dd.conf “search updates built-in” append /etc/resolv.conf “”
chmod(fileglob, mode)[source]

chmod FILEGLOB OCTALMODE Change the mode of all the files matching FILEGLOB to OCTALMODE.

copy(src, dest)[source]

copy SRC DEST Copy SRC to DEST. If DEST is a directory, SRC will be copied inside it. If DEST doesn’t exist, SRC will be copied to a file with that name, if the path leading to it exists.

createaddrsize(addr, src, dest)[source]

createaddrsize INITRD_ADDRESS INITRD ADDRSIZE Create the initrd.addrsize file required in LPAR boot process. Examples:

createaddrsize ${INITRD_ADDRESS} ${outroot}/${BOOTDIR}/initrd.img ${outroot}/${BOOTDIR}/initrd.addrsize
gconfset(path, keytype, value, outfile=None)[source]

gconfset PATH KEYTYPE VALUE [OUTFILE] Set the given gconf PATH, with type KEYTYPE, to the given value. OUTFILE defaults to /etc/gconf/gconf.xml.defaults if not given. Example:

gconfset /apps/metacity/general/num_workspaces int 1

hardlink SRC DEST Create a hardlink at DEST which is linked to SRC.

install(srcglob, dest)[source]

install SRC DEST Copy the given file (or files, if a glob is used) from the input tree to the given destination in the output tree. The path to DEST must exist in the output tree. If DEST is a directory, SRC will be copied into that directory. If DEST doesn’t exist, SRC will be copied to a file with that name, assuming the rest of the path exists. This is pretty much like how the ‘cp’ command works. Examples:

install usr/share/myconfig/grub.conf /boot install /usr/share/myconfig/ /boot/grub.conf
installimg(srcdir, destfile)[source]

installimg SRCDIR DESTFILE Create a compressed cpio archive of the contents of SRCDIR and place it in DESTFILE.

If SRCDIR doesn’t exist or is empty nothing is created.

installimg ${LORAXDIR}/product/ images/product.img installimg ${LORAXDIR}/updates/ images/updates.img
installinitrd(section, src, dest)[source]

installinitrd SECTION SRC DEST Same as installkernel, but for “initrd”.

installkernel(section, src, dest)[source]

installkernel SECTION SRC DEST Install the kernel from SRC in the input tree to DEST in the output tree, and then add an item to the treeinfo data store, in the named SECTION, where “kernel” = DEST.

Equivalent to:
install SRC DEST treeinfo SECTION kernel DEST

installpkg [–required] PKGGLOB [PKGGLOB ...] Request installation of all packages matching the given globs. Note that this is just a request - nothing is actually installed until the ‘run_pkg_transaction’ command is given.

installupgradeinitrd(section, src, dest)[source]

installupgradeinitrd SECTION SRC DEST Same as installkernel, but for “upgrade”.


log MESSAGE Emit the given log message. Be sure to put it in quotes! Example:

log “Reticulating splines, please wait...”

mkdir DIR [DIR ...] Create the named DIR(s). Will create leading directories as needed. Example:

mkdir /images
move(src, dest)[source]

move SRC DEST Move SRC to DEST.


remove FILEGLOB [FILEGLOB ...] Remove all the named files or directories. Will not raise exceptions if the file(s) are not found.

removefrom(pkg, *globs)[source]

removefrom PKGGLOB [–allbut] FILEGLOB [FILEGLOB...] Remove all files matching the given file globs from the package (or packages) named. If ‘–allbut’ is used, all the files from the given package(s) will be removed except the ones which match the file globs. Examples:

removefrom usbutils /usr/bin/* removefrom xfsprogs –allbut /sbin/*

removekmod GLOB [GLOB...] [–allbut] KEEPGLOB [KEEPGLOB...] Remove all files and directories matching the given file globs from the kernel modules directory.

If ‘–allbut’ is used, all the files from the modules will be removed except the ones which match the file globs. There must be at least one initial GLOB to search and one KEEPGLOB to keep. The KEEPGLOB is expanded to be KEEPGLOB so that it will match anywhere in the path.

This only removes files from under /lib/modules/*/kernel/

removekmod sound drivers/media drivers/hwmon drivers/video removekmod drivers/char –allbut virtio_console hw_random

removepkg PKGGLOB [PKGGLOB...] Delete the named package(s). IMPLEMENTATION NOTES:

RPM scriptlets (%preun/%postun) are not run. Files are deleted, but directories are left behind.
replace(pat, repl, *fileglobs)[source]

replace PATTERN REPLACEMENT FILEGLOB [FILEGLOB ...] Find-and-replace the given PATTERN (Python-style regex) with the given REPLACEMENT string for each of the files listed. Example:

replace @VERSION@ ${product.version} /boot/grub.conf /boot/isolinux.cfg
run(templatefile, **variables)[source]

Actually install all the packages requested by previous ‘installpkg’ commands.


runcmd CMD [–chdir=DIR] [ARG ...] Run the given command with the given arguments. If “–chdir=DIR” is given, change to the named directory before executing the command.

NOTE: All paths given MUST be COMPLETE, ABSOLUTE PATHS to the file or files mentioned. ${root}/${inroot}/${outroot} are good for constructing these paths.

FURTHER NOTE: Please use this command only as a last resort! Whenever possible, you should use the existing template commands. If the existing commands don’t do what you need, fix them!


(this should be replaced with a “find” function) runcmd find ${root} -name “.pyo” -type f -delete %for f in find(root, name=”.pyo”):

remove ${f}


symlink SRC DEST Create a symlink at DEST which points to SRC.

systemctl(cmd, *units)[source]

systemctl [enable|disable|mask] UNIT [UNIT...] Enable, disable, or mask the given systemd units. Examples:

systemctl disable lvm2-monitor.service systemctl mask fedora-storage-init.service fedora-configure.service
treeinfo(section, key, *valuetoks)[source]

treeinfo SECTION KEY ARG [ARG ...] Add an item to the treeinfo data store. The given SECTION will have a new item added where KEY = ARG ARG ... Example:

treeinfo images-${kernel.arch} boot.iso images/boot.iso
pylorax.ltmpl.rexists(pathname, root='')[source]
pylorax.ltmpl.rglob(pathname, root='/', fatal=False)[source]

output Module

sysutils Module

pylorax.sysutils.joinpaths(*args, **kwargs)[source]
pylorax.sysutils.replace(fname, find, substitute)[source]
pylorax.sysutils.chown_(path, user=None, group=None, recursive=False)[source]
pylorax.sysutils.chmod_(path, mode, recursive=False)[source]
pylorax.sysutils.linktree(src, dst)[source]

treebuilder Module

class pylorax.treebuilder.RuntimeBuilder(product, arch, yum, templatedir=None, installpkgs=None, add_templates=None, add_template_vars=None)[source]

Bases: object

Builds the anaconda runtime image.


Remove unneeded packages and files with runtime-cleanup.tmpl

create_runtime(outfile='/var/tmp/squashfs.img', compression='xz', compressargs=None, size=2)[source]

Install packages and do initial setup with runtime-install.tmpl


Do some post-install setup work with runtime-postinstall.tmpl


debugging data: write out lists of package contents


debugging data: write a big list of pkg sizes

class pylorax.treebuilder.TreeBuilder(product, arch, inroot, outroot, runtime, isolabel, domacboot=False, doupgrade=True, templatedir=None, add_templates=None, add_template_vars=None, workdir=None, extra_boot_args='')[source]

Bases: object

Builds the arch-specific boot images. inroot should be the installtree root (the newly-built runtime dir)


Copy the hook scripts in hooks into the installroot’s /tmp/ and return a list of commands to pass to dracut when creating the initramfs

hooks is a list of tuples with the name of the hook script and the target dracut hook directory (eg. [(“”, “/lib/dracut/hooks/pre-pivot”)])


Return the path to the lorax dracut hooks scripts

Use the configured share dir if it is setup, otherwise default to /usr/share/lorax/dracut_hooks

rebuild_initrds(add_args=None, backup='', prefix='')[source]

Rebuild all the initrds in the tree. If backup is specified, each initrd will be renamed with backup as a suffix before rebuilding. If backup is empty, the existing initrd files will be overwritten. If suffix is specified, the existing initrd is untouched and a new image is built with the filename “${prefix}-${kernel.version}.img”

pylorax.treebuilder.findkernels(root='/', kdir='boot')[source]
pylorax.treebuilder.generate_module_info(moddir, outfile=None)[source]

treeinfo Module

class pylorax.treeinfo.TreeInfo(product, version, variant, basearch, packagedir='')[source]

Bases: object

add_section(section, data)[source]

yumhelper Module

class pylorax.yumhelper.LoraxDownloadCallback[source]

Bases: yum.callbacks.DownloadBaseCallback

updateProgress(name, frac, fread, ftime)[source]

Update the progress bar @param name: filename @param frac: progress fraction (0 -> 1) @param fread: formated string containing BytesRead @param ftime: formated string containing remaining or elapsed time

class pylorax.yumhelper.LoraxTransactionCallback[source]

Bases: object

event(state, data=None)[source]
class pylorax.yumhelper.LoraxRpmCallback[source]

Bases: yum.rpmtrans.RPMBaseCallback

event(package, action, te_current, te_total, ts_current, ts_total)[source]
filelog(package, action)[source]
scriptout(package, msgs)[source]