lorax/docs/html/pylorax.html
Brian C. Lane 14d43a3d47 New lorax documentation - 28.14.21
Related: rhbz#1650295
2019-01-09 10:23:13 -08:00

2253 lines
163 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax package &mdash; Lorax 28.14.21 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="pylorax.api package" href="pylorax.api.html" />
<link rel="prev" title="pylorax" href="modules.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> Lorax
</a>
<div class="version">
28.14.21
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="intro.html">Introduction to Lorax</a></li>
<li class="toctree-l1"><a class="reference internal" href="intro.html#before-lorax">Before Lorax</a></li>
<li class="toctree-l1"><a class="reference internal" href="lorax.html">Lorax</a></li>
<li class="toctree-l1"><a class="reference internal" href="livemedia-creator.html">livemedia-creator</a></li>
<li class="toctree-l1"><a class="reference internal" href="lorax-composer.html">lorax-composer</a></li>
<li class="toctree-l1"><a class="reference internal" href="composer-cli.html">composer-cli</a></li>
<li class="toctree-l1"><a class="reference internal" href="product-images.html">Product and Updates Images</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="modules.html">pylorax</a><ul class="current">
<li class="toctree-l2 current"><a class="current reference internal" href="#">pylorax package</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#subpackages">Subpackages</a><ul>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html">pylorax.api package</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#submodules">Submodules</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-pylorax.base">pylorax.base module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-pylorax.buildstamp">pylorax.buildstamp module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-pylorax.cmdline">pylorax.cmdline module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-pylorax.creator">pylorax.creator module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-pylorax.decorators">pylorax.decorators module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-pylorax.discinfo">pylorax.discinfo module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-pylorax.dnfhelper">pylorax.dnfhelper module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-pylorax.executils">pylorax.executils module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-pylorax.imgutils">pylorax.imgutils module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-pylorax.installer">pylorax.installer module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-pylorax.ltmpl">pylorax.ltmpl module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-pylorax.monitor">pylorax.monitor module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-pylorax.mount">pylorax.mount module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-pylorax.output">pylorax.output module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-pylorax.sysutils">pylorax.sysutils module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-pylorax.treebuilder">pylorax.treebuilder module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-pylorax.treeinfo">pylorax.treeinfo module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-pylorax">Module contents</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Lorax</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li><a href="modules.html">pylorax</a> &raquo;</li>
<li>pylorax package</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/pylorax.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="pylorax-package">
<h1>pylorax package<a class="headerlink" href="#pylorax-package" title="Permalink to this headline"></a></h1>
<div class="section" id="subpackages">
<h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this headline"></a></h2>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="pylorax.api.html">pylorax.api package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="pylorax.api.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.cmdline">pylorax.api.cmdline module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pylorax.api.html#pylorax-api-compose-module">pylorax.api.compose module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.config">pylorax.api.config module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.crossdomain">pylorax.api.crossdomain module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pylorax.api.html#pylorax-api-dnfbase-module">pylorax.api.dnfbase module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.projects">pylorax.api.projects module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pylorax.api.html#pylorax-api-queue-module">pylorax.api.queue module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.recipes">pylorax.api.recipes module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pylorax.api.html#pylorax-api-server-module">pylorax.api.server module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pylorax.api.html#pylorax-api-v0-module">pylorax.api.v0 module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.workspace">pylorax.api.workspace module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pylorax.api.html#module-pylorax.api">Module contents</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-pylorax.base">
<span id="pylorax-base-module"></span><h2>pylorax.base module<a class="headerlink" href="#module-pylorax.base" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="pylorax.base.BaseLoraxClass">
<em class="property">class </em><code class="descclassname">pylorax.base.</code><code class="descname">BaseLoraxClass</code><a class="reference internal" href="_modules/pylorax/base.html#BaseLoraxClass"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.BaseLoraxClass" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<dl class="method">
<dt id="pylorax.base.BaseLoraxClass.pcritical">
<code class="descname">pcritical</code><span class="sig-paren">(</span><em>msg</em>, <em>fobj=&lt;_io.TextIOWrapper name='&lt;stdout&gt;' mode='w' encoding='UTF-8'&gt;</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/base.html#BaseLoraxClass.pcritical"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.BaseLoraxClass.pcritical" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.base.BaseLoraxClass.pdebug">
<code class="descname">pdebug</code><span class="sig-paren">(</span><em>msg</em>, <em>fobj=&lt;_io.TextIOWrapper name='&lt;stdout&gt;' mode='w' encoding='UTF-8'&gt;</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/base.html#BaseLoraxClass.pdebug"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.BaseLoraxClass.pdebug" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.base.BaseLoraxClass.perror">
<code class="descname">perror</code><span class="sig-paren">(</span><em>msg</em>, <em>fobj=&lt;_io.TextIOWrapper name='&lt;stdout&gt;' mode='w' encoding='UTF-8'&gt;</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/base.html#BaseLoraxClass.perror"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.BaseLoraxClass.perror" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.base.BaseLoraxClass.pinfo">
<code class="descname">pinfo</code><span class="sig-paren">(</span><em>msg</em>, <em>fobj=&lt;_io.TextIOWrapper name='&lt;stdout&gt;' mode='w' encoding='UTF-8'&gt;</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/base.html#BaseLoraxClass.pinfo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.BaseLoraxClass.pinfo" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.base.BaseLoraxClass.pwarning">
<code class="descname">pwarning</code><span class="sig-paren">(</span><em>msg</em>, <em>fobj=&lt;_io.TextIOWrapper name='&lt;stdout&gt;' mode='w' encoding='UTF-8'&gt;</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/base.html#BaseLoraxClass.pwarning"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.BaseLoraxClass.pwarning" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="pylorax.base.DataHolder">
<em class="property">class </em><code class="descclassname">pylorax.base.</code><code class="descname">DataHolder</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/base.html#DataHolder"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.DataHolder" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a></p>
<dl class="method">
<dt id="pylorax.base.DataHolder.copy">
<code class="descname">copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; a shallow copy of D<a class="reference internal" href="_modules/pylorax/base.html#DataHolder.copy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.DataHolder.copy" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
<div class="section" id="module-pylorax.buildstamp">
<span id="pylorax-buildstamp-module"></span><h2>pylorax.buildstamp module<a class="headerlink" href="#module-pylorax.buildstamp" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="pylorax.buildstamp.BuildStamp">
<em class="property">class </em><code class="descclassname">pylorax.buildstamp.</code><code class="descname">BuildStamp</code><span class="sig-paren">(</span><em>product</em>, <em>version</em>, <em>bugurl</em>, <em>isfinal</em>, <em>buildarch</em>, <em>variant=''</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/buildstamp.html#BuildStamp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.buildstamp.BuildStamp" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<dl class="method">
<dt id="pylorax.buildstamp.BuildStamp.write">
<code class="descname">write</code><span class="sig-paren">(</span><em>outfile</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/buildstamp.html#BuildStamp.write"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.buildstamp.BuildStamp.write" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
<div class="section" id="module-pylorax.cmdline">
<span id="pylorax-cmdline-module"></span><h2>pylorax.cmdline module<a class="headerlink" href="#module-pylorax.cmdline" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="pylorax.cmdline.lmc_parser">
<code class="descclassname">pylorax.cmdline.</code><code class="descname">lmc_parser</code><span class="sig-paren">(</span><em>dracut_default=''</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/cmdline.html#lmc_parser"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.cmdline.lmc_parser" title="Permalink to this definition"></a></dt>
<dd><p>Return a ArgumentParser object for live-media-creator.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.cmdline.lorax_parser">
<code class="descclassname">pylorax.cmdline.</code><code class="descname">lorax_parser</code><span class="sig-paren">(</span><em>dracut_default=''</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/cmdline.html#lorax_parser"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.cmdline.lorax_parser" title="Permalink to this definition"></a></dt>
<dd><p>Return the ArgumentParser for lorax</p>
</dd></dl>
</div>
<div class="section" id="module-pylorax.creator">
<span id="pylorax-creator-module"></span><h2>pylorax.creator module<a class="headerlink" href="#module-pylorax.creator" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="pylorax.creator.FakeDNF">
<em class="property">class </em><code class="descclassname">pylorax.creator.</code><code class="descname">FakeDNF</code><span class="sig-paren">(</span><em>conf</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/creator.html#FakeDNF"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.creator.FakeDNF" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>A minimal DNF object suitable for passing to RuntimeBuilder</p>
<p>lmc uses RuntimeBuilder to run the arch specific iso creation
templates, so the the installroot config value is the important part of
this. Everything else should be a nop.</p>
<dl class="method">
<dt id="pylorax.creator.FakeDNF.reset">
<code class="descname">reset</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/creator.html#FakeDNF.reset"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.creator.FakeDNF.reset" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="function">
<dt id="pylorax.creator.calculate_disk_size">
<code class="descclassname">pylorax.creator.</code><code class="descname">calculate_disk_size</code><span class="sig-paren">(</span><em>opts</em>, <em>ks</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/creator.html#calculate_disk_size"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.creator.calculate_disk_size" title="Permalink to this definition"></a></dt>
<dd><p>Calculate the disk size from the kickstart</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>opts</strong> (<em>argparse options</em>) options passed to livemedia-creator</li>
<li><strong>ks</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Path to the kickstart to use for the installation</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Disk size in MiB</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)">int</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pylorax.creator.create_pxe_config">
<code class="descclassname">pylorax.creator.</code><code class="descname">create_pxe_config</code><span class="sig-paren">(</span><em>template</em>, <em>images_dir</em>, <em>live_image_name</em>, <em>add_args=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/creator.html#create_pxe_config"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.creator.create_pxe_config" title="Permalink to this definition"></a></dt>
<dd><p>Create template for pxe to live configuration</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>images_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Path of directory with images to be used</li>
<li><strong>live_image_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Name of live rootfs image file</li>
<li><strong>add_args</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.7)"><em>list</em></a>) Arguments to be added to initrd= pxe config</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pylorax.creator.find_ostree_root">
<code class="descclassname">pylorax.creator.</code><code class="descname">find_ostree_root</code><span class="sig-paren">(</span><em>phys_root</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/creator.html#find_ostree_root"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.creator.find_ostree_root" title="Permalink to this definition"></a></dt>
<dd><p>Find root of ostree deployment</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>phys_root</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Path to physical root</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Relative path of ostree deployment root</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)">str</a></td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#Exception" title="(in Python v3.7)"><strong>Exception</strong></a> More than one deployment roots were found</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pylorax.creator.get_arch">
<code class="descclassname">pylorax.creator.</code><code class="descname">get_arch</code><span class="sig-paren">(</span><em>mount_dir</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/creator.html#get_arch"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.creator.get_arch" title="Permalink to this definition"></a></dt>
<dd><p>Get the kernel arch</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Arch of first kernel found at mount_dir/boot/ or i386</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)">str</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pylorax.creator.is_image_mounted">
<code class="descclassname">pylorax.creator.</code><code class="descname">is_image_mounted</code><span class="sig-paren">(</span><em>disk_img</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/creator.html#is_image_mounted"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.creator.is_image_mounted" title="Permalink to this definition"></a></dt>
<dd><p>Check to see if the disk_img is mounted</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">True if disk_img is in /proc/mounts</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)">bool</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pylorax.creator.make_appliance">
<code class="descclassname">pylorax.creator.</code><code class="descname">make_appliance</code><span class="sig-paren">(</span><em>disk_img</em>, <em>name</em>, <em>template</em>, <em>outfile</em>, <em>networks=None</em>, <em>ram=1024</em>, <em>vcpus=1</em>, <em>arch=None</em>, <em>title='Linux'</em>, <em>project='Linux'</em>, <em>releasever='29'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/creator.html#make_appliance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.creator.make_appliance" title="Permalink to this definition"></a></dt>
<dd><p>Generate an appliance description file</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>disk_img</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Full path of the disk image</li>
<li><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Name of the appliance, passed to the template</li>
<li><strong>template</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Full path of Mako template</li>
<li><strong>outfile</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Full path of file to write, using template</li>
<li><strong>networks</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.7)"><em>list</em></a>) List of networks(str) from the kickstart</li>
<li><strong>ram</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) Ram, in MiB, passed to template. Default is 1024</li>
<li><strong>vcpus</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) CPUs, passed to template. Default is 1</li>
<li><strong>arch</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) CPU architecture. Default is x86_64</li>
<li><strong>title</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Title, passed to template. Default is Linux</li>
<li><strong>project</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Project, passed to template. Default is Linux</li>
<li><strong>releasever</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Release version, passed to template. Default is 29</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pylorax.creator.make_image">
<code class="descclassname">pylorax.creator.</code><code class="descname">make_image</code><span class="sig-paren">(</span><em>opts</em>, <em>ks</em>, <em>cancel_func=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/creator.html#make_image"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.creator.make_image" title="Permalink to this definition"></a></dt>
<dd><p>Install to a disk image</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>opts</strong> (<em>argparse options</em>) options passed to livemedia-creator</li>
<li><strong>ks</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Path to the kickstart to use for the installation</li>
<li><strong>cancel_func</strong> (<em>function</em>) Function that returns True to cancel build</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Path of the image created</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)">str</a></p>
</td>
</tr>
</tbody>
</table>
<p>Use qemu+boot.iso or anaconda to install to a disk image.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.creator.make_live_images">
<code class="descclassname">pylorax.creator.</code><code class="descname">make_live_images</code><span class="sig-paren">(</span><em>opts</em>, <em>work_dir</em>, <em>disk_img</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/creator.html#make_live_images"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.creator.make_live_images" title="Permalink to this definition"></a></dt>
<dd><p>Create live images from direcory or rootfs image</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>opts</strong> (<em>argparse options</em>) options passed to livemedia-creator</li>
<li><strong>work_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Directory for storing results</li>
<li><strong>disk_img</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Path to disk image (fsimage or partitioned)</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Path of directory with created images or None</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)">str</a></p>
</td>
</tr>
</tbody>
</table>
<p>fsck.ext4 is run on the rootfs_image to make sure there are no errors and to zero
out any deleted blocks to make it compress better. If this fails for any reason
it will return None and log the error.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.creator.make_livecd">
<code class="descclassname">pylorax.creator.</code><code class="descname">make_livecd</code><span class="sig-paren">(</span><em>opts</em>, <em>mount_dir</em>, <em>work_dir</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/creator.html#make_livecd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.creator.make_livecd" title="Permalink to this definition"></a></dt>
<dd><p>Take the content from the disk image and make a livecd out of it</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>opts</strong> (<em>argparse options</em>) options passed to livemedia-creator</li>
<li><strong>mount_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Directory tree to compress</li>
<li><strong>work_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Output compressed image to work_dir+images/install.img</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="docutils">
<dt>This uses wwoods squashfs live initramfs method:</dt>
<dd><ul class="first last simple">
<li>put the real / into LiveOS/rootfs.img</li>
<li>make a squashfs of the LiveOS/rootfs.img tree</li>
<li>This is loaded by dracut when the cmdline is passed to the kernel:
root=live:CDLABEL=&lt;volid&gt; rd.live.image</li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="pylorax.creator.make_runtime">
<code class="descclassname">pylorax.creator.</code><code class="descname">make_runtime</code><span class="sig-paren">(</span><em>opts</em>, <em>mount_dir</em>, <em>work_dir</em>, <em>size=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/creator.html#make_runtime"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.creator.make_runtime" title="Permalink to this definition"></a></dt>
<dd><p>Make the squashfs image from a directory</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>opts</strong> (<em>argparse options</em>) options passed to livemedia-creator</li>
<li><strong>mount_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Directory tree to compress</li>
<li><strong>work_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Output compressed image to work_dir+images/install.img</li>
<li><strong>size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) Size of disk image, in GiB</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pylorax.creator.make_squashfs">
<code class="descclassname">pylorax.creator.</code><code class="descname">make_squashfs</code><span class="sig-paren">(</span><em>opts</em>, <em>disk_img</em>, <em>work_dir</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/creator.html#make_squashfs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.creator.make_squashfs" title="Permalink to this definition"></a></dt>
<dd><p>Create a squashfs image of an unpartitioned filesystem disk image</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>disk_img</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Path to the unpartitioned filesystem disk image</li>
<li><strong>work_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Output compressed image to work_dir+images/install.img</li>
<li><strong>compression</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Compression type to use</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">True if squashfs creation was successful. False if there was an error.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)">bool</a></p>
</td>
</tr>
</tbody>
</table>
<p>Take disk_img and put it into LiveOS/rootfs.img and squashfs this
tree into work_dir+images/install.img</p>
<p>fsck.ext4 is run on the disk image to make sure there are no errors and to zero
out any deleted blocks to make it compress better. If this fails for any reason
it will return False and log the error.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.creator.mount_boot_part_over_root">
<code class="descclassname">pylorax.creator.</code><code class="descname">mount_boot_part_over_root</code><span class="sig-paren">(</span><em>img_mount</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/creator.html#mount_boot_part_over_root"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.creator.mount_boot_part_over_root" title="Permalink to this definition"></a></dt>
<dd><p>Mount boot partition to /boot of root fs mounted in img_mount</p>
<p>Used for OSTree so it finds deployment configurations on live rootfs</p>
<p>param img_mount: object with mounted disk image root partition
type img_mount: imgutils.PartitionMount</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.creator.rebuild_initrds_for_live">
<code class="descclassname">pylorax.creator.</code><code class="descname">rebuild_initrds_for_live</code><span class="sig-paren">(</span><em>opts</em>, <em>sys_root_dir</em>, <em>results_dir</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/creator.html#rebuild_initrds_for_live"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.creator.rebuild_initrds_for_live" title="Permalink to this definition"></a></dt>
<dd><p>Rebuild intrds for pxe live image (root=live:<a class="reference external" href="http://">http://</a>)</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>opts</strong> (<em>argparse options</em>) options passed to livemedia-creator</li>
<li><strong>sys_root_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Path to root of the system</li>
<li><strong>results_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Path of directory for storing results</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pylorax.creator.run_creator">
<code class="descclassname">pylorax.creator.</code><code class="descname">run_creator</code><span class="sig-paren">(</span><em>opts</em>, <em>cancel_func=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/creator.html#run_creator"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.creator.run_creator" title="Permalink to this definition"></a></dt>
<dd><p>Run the image creator process</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>opts</strong> (<em>Either a DataHolder</em><em> or </em><em>ArgumentParser</em>) Commandline options to control the process</li>
<li><strong>cancel_func</strong> (<em>function</em>) Function that returns True to cancel build</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The result directory and the disk image path.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">Tuple of str</p>
</td>
</tr>
</tbody>
</table>
<p>This function takes the opts arguments and creates the selected output image.
See the cmdline help for livemedia-creator for the possible options</p>
<p>(Yes, this is not ideal, but we can fix that later)</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.creator.squashfs_args">
<code class="descclassname">pylorax.creator.</code><code class="descname">squashfs_args</code><span class="sig-paren">(</span><em>opts</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/creator.html#squashfs_args"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.creator.squashfs_args" title="Permalink to this definition"></a></dt>
<dd><p>Returns the compression type and args to use when making squashfs</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>opts</strong> ArgumentParser object with compression and compressopts</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">tuple of compression type and args</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#tuple" title="(in Python v3.7)">tuple</a></td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="module-pylorax.decorators">
<span id="pylorax-decorators-module"></span><h2>pylorax.decorators module<a class="headerlink" href="#module-pylorax.decorators" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="pylorax.decorators.singleton">
<code class="descclassname">pylorax.decorators.</code><code class="descname">singleton</code><span class="sig-paren">(</span><em>cls</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/decorators.html#singleton"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.decorators.singleton" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
<div class="section" id="module-pylorax.discinfo">
<span id="pylorax-discinfo-module"></span><h2>pylorax.discinfo module<a class="headerlink" href="#module-pylorax.discinfo" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="pylorax.discinfo.DiscInfo">
<em class="property">class </em><code class="descclassname">pylorax.discinfo.</code><code class="descname">DiscInfo</code><span class="sig-paren">(</span><em>release</em>, <em>basearch</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/discinfo.html#DiscInfo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.discinfo.DiscInfo" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<dl class="method">
<dt id="pylorax.discinfo.DiscInfo.write">
<code class="descname">write</code><span class="sig-paren">(</span><em>outfile</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/discinfo.html#DiscInfo.write"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.discinfo.DiscInfo.write" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
<div class="section" id="module-pylorax.dnfhelper">
<span id="pylorax-dnfhelper-module"></span><h2>pylorax.dnfhelper module<a class="headerlink" href="#module-pylorax.dnfhelper" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="pylorax.dnfhelper.LoraxDownloadCallback">
<em class="property">class </em><code class="descclassname">pylorax.dnfhelper.</code><code class="descname">LoraxDownloadCallback</code><a class="reference internal" href="_modules/pylorax/dnfhelper.html#LoraxDownloadCallback"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.dnfhelper.LoraxDownloadCallback" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">DownloadProgress</span></code></p>
<dl class="method">
<dt id="pylorax.dnfhelper.LoraxDownloadCallback.end">
<code class="descname">end</code><span class="sig-paren">(</span><em>payload</em>, <em>status</em>, <em>msg</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/dnfhelper.html#LoraxDownloadCallback.end"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.dnfhelper.LoraxDownloadCallback.end" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.dnfhelper.LoraxDownloadCallback.progress">
<code class="descname">progress</code><span class="sig-paren">(</span><em>payload</em>, <em>done</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/dnfhelper.html#LoraxDownloadCallback.progress"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.dnfhelper.LoraxDownloadCallback.progress" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.dnfhelper.LoraxDownloadCallback.start">
<code class="descname">start</code><span class="sig-paren">(</span><em>total_files</em>, <em>total_size</em>, <em>total_drpms=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/dnfhelper.html#LoraxDownloadCallback.start"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.dnfhelper.LoraxDownloadCallback.start" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="pylorax.dnfhelper.LoraxRpmCallback">
<em class="property">class </em><code class="descclassname">pylorax.dnfhelper.</code><code class="descname">LoraxRpmCallback</code><a class="reference internal" href="_modules/pylorax/dnfhelper.html#LoraxRpmCallback"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.dnfhelper.LoraxRpmCallback" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">TransactionProgress</span></code></p>
<dl class="method">
<dt id="pylorax.dnfhelper.LoraxRpmCallback.error">
<code class="descname">error</code><span class="sig-paren">(</span><em>message</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/dnfhelper.html#LoraxRpmCallback.error"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.dnfhelper.LoraxRpmCallback.error" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.dnfhelper.LoraxRpmCallback.progress">
<code class="descname">progress</code><span class="sig-paren">(</span><em>package</em>, <em>action</em>, <em>ti_done</em>, <em>ti_total</em>, <em>ts_done</em>, <em>ts_total</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/dnfhelper.html#LoraxRpmCallback.progress"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.dnfhelper.LoraxRpmCallback.progress" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
<div class="section" id="module-pylorax.executils">
<span id="pylorax-executils-module"></span><h2>pylorax.executils module<a class="headerlink" href="#module-pylorax.executils" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="pylorax.executils.ExecProduct">
<em class="property">class </em><code class="descclassname">pylorax.executils.</code><code class="descname">ExecProduct</code><span class="sig-paren">(</span><em>rc</em>, <em>stdout</em>, <em>stderr</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/executils.html#ExecProduct"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.executils.ExecProduct" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
</dd></dl>
<dl class="function">
<dt id="pylorax.executils.augmentEnv">
<code class="descclassname">pylorax.executils.</code><code class="descname">augmentEnv</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/executils.html#augmentEnv"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.executils.augmentEnv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pylorax.executils.execReadlines">
<code class="descclassname">pylorax.executils.</code><code class="descname">execReadlines</code><span class="sig-paren">(</span><em>command</em>, <em>argv</em>, <em>stdin=None</em>, <em>root='/'</em>, <em>env_prune=None</em>, <em>filter_stderr=False</em>, <em>callback=&lt;function &lt;lambda&gt;&gt;</em>, <em>env_add=None</em>, <em>reset_handlers=True</em>, <em>reset_lang=True</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/executils.html#execReadlines"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.executils.execReadlines" title="Permalink to this definition"></a></dt>
<dd><p>Execute an external command and return the line output of the command
in real-time.</p>
<p>This method assumes that there is a reasonably low delay between the
end of output and the process exiting. If the child process closes
stdout and then keeps on truckin there will be problems.</p>
<dl class="docutils">
<dt>NOTE/WARNING: UnicodeDecodeError will be raised if the output of the</dt>
<dd>external command cant be decoded as UTF-8.</dd>
</dl>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>command</strong> The command to run</li>
<li><strong>argv</strong> The argument list</li>
<li><strong>stdin</strong> The file object to read stdin from.</li>
<li><strong>stdout</strong> Optional file object to redirect stdout and stderr to.</li>
<li><strong>root</strong> The directory to chroot to before running command.</li>
<li><strong>env_prune</strong> environment variable to remove before execution</li>
<li><strong>filter_stderr</strong> Whether stderr should be excluded from the returned output</li>
<li><strong>callback</strong> method to call while waiting for process to finish, passed Popen object</li>
<li><strong>env_add</strong> environment variables to add before execution</li>
<li><strong>reset_handlers</strong> whether to reset to SIG_DFL any signal handlers set to SIG_IGN</li>
<li><strong>reset_lang</strong> whether to set the locale of the child process to C</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">Iterator of the lines from the command</p>
</td>
</tr>
</tbody>
</table>
<p>Output from the file is not logged to program.log
This returns an iterator with the lines from the command until it has finished</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.executils.execWithCapture">
<code class="descclassname">pylorax.executils.</code><code class="descname">execWithCapture</code><span class="sig-paren">(</span><em>command</em>, <em>argv</em>, <em>stdin=None</em>, <em>root='/'</em>, <em>log_output=True</em>, <em>filter_stderr=False</em>, <em>raise_err=False</em>, <em>callback=None</em>, <em>env_add=None</em>, <em>reset_handlers=True</em>, <em>reset_lang=True</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/executils.html#execWithCapture"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.executils.execWithCapture" title="Permalink to this definition"></a></dt>
<dd><p>Run an external program and capture standard out and err.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>command</strong> The command to run</li>
<li><strong>argv</strong> The argument list</li>
<li><strong>stdin</strong> The file object to read stdin from.</li>
<li><strong>root</strong> The directory to chroot to before running command.</li>
<li><strong>log_output</strong> Whether to log the output of command</li>
<li><strong>filter_stderr</strong> Whether stderr should be excluded from the returned output</li>
<li><strong>callback</strong> method to call while waiting for process to finish, passed Popen object</li>
<li><strong>env_add</strong> environment variables to add before execution</li>
<li><strong>reset_handlers</strong> whether to reset to SIG_DFL any signal handlers set to SIG_IGN</li>
<li><strong>reset_lang</strong> whether to set the locale of the child process to C</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">The output of the command</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pylorax.executils.execWithRedirect">
<code class="descclassname">pylorax.executils.</code><code class="descname">execWithRedirect</code><span class="sig-paren">(</span><em>command</em>, <em>argv</em>, <em>stdin=None</em>, <em>stdout=None</em>, <em>root='/'</em>, <em>env_prune=None</em>, <em>log_output=True</em>, <em>binary_output=False</em>, <em>raise_err=False</em>, <em>callback=None</em>, <em>env_add=None</em>, <em>reset_handlers=True</em>, <em>reset_lang=True</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/executils.html#execWithRedirect"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.executils.execWithRedirect" title="Permalink to this definition"></a></dt>
<dd><p>Run an external program and redirect the output to a file.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>command</strong> The command to run</li>
<li><strong>argv</strong> The argument list</li>
<li><strong>stdin</strong> The file object to read stdin from.</li>
<li><strong>stdout</strong> Optional file object to redirect stdout and stderr to.</li>
<li><strong>root</strong> The directory to chroot to before running command.</li>
<li><strong>env_prune</strong> environment variable to remove before execution</li>
<li><strong>log_output</strong> whether to log the output of command</li>
<li><strong>binary_output</strong> whether to treat the output of command as binary data</li>
<li><strong>raise_err</strong> whether to raise a CalledProcessError if the returncode is non-zero</li>
<li><strong>callback</strong> method to call while waiting for process to finish, passed Popen object</li>
<li><strong>env_add</strong> environment variables to add before execution</li>
<li><strong>reset_handlers</strong> whether to reset to SIG_DFL any signal handlers set to SIG_IGN</li>
<li><strong>reset_lang</strong> whether to set the locale of the child process to C</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">The return code of the command</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pylorax.executils.runcmd">
<code class="descclassname">pylorax.executils.</code><code class="descname">runcmd</code><span class="sig-paren">(</span><em>cmd</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/executils.html#runcmd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.executils.runcmd" title="Permalink to this definition"></a></dt>
<dd><p>run execWithRedirect with raise_err=True</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.executils.runcmd_output">
<code class="descclassname">pylorax.executils.</code><code class="descname">runcmd_output</code><span class="sig-paren">(</span><em>cmd</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/executils.html#runcmd_output"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.executils.runcmd_output" title="Permalink to this definition"></a></dt>
<dd><p>run execWithCapture with raise_err=True</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.executils.setenv">
<code class="descclassname">pylorax.executils.</code><code class="descname">setenv</code><span class="sig-paren">(</span><em>name</em>, <em>value</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/executils.html#setenv"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.executils.setenv" title="Permalink to this definition"></a></dt>
<dd><p>Set an environment variable to be used by child processes.</p>
<p>This method does not modify os.environ for the running process, which
is not thread-safe. If setenv has already been called for a particular
variable name, the old value is overwritten.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) The name of the environment variable</li>
<li><strong>value</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) The value of the environment variable</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pylorax.executils.startProgram">
<code class="descclassname">pylorax.executils.</code><code class="descname">startProgram</code><span class="sig-paren">(</span><em>argv</em>, <em>root='/'</em>, <em>stdin=None</em>, <em>stdout=-1</em>, <em>stderr=-2</em>, <em>env_prune=None</em>, <em>env_add=None</em>, <em>reset_handlers=True</em>, <em>reset_lang=True</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/executils.html#startProgram"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.executils.startProgram" title="Permalink to this definition"></a></dt>
<dd><p>Start an external program and return the Popen object.</p>
<p>The root and reset_handlers arguments are handled by passing a
preexec_fn argument to subprocess.Popen, but an additional preexec_fn
can still be specified and will be run. The user preexec_fn will be run
last.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>argv</strong> The command to run and argument</li>
<li><strong>root</strong> The directory to chroot to before running command.</li>
<li><strong>stdin</strong> The file object to read stdin from.</li>
<li><strong>stdout</strong> The file object to write stdout to.</li>
<li><strong>stderr</strong> The file object to write stderr to.</li>
<li><strong>env_prune</strong> environment variables to remove before execution</li>
<li><strong>env_add</strong> environment variables to add before execution</li>
<li><strong>reset_handlers</strong> whether to reset to SIG_DFL any signal handlers set to SIG_IGN</li>
<li><strong>reset_lang</strong> whether to set the locale of the child process to C</li>
<li><strong>kwargs</strong> Additional parameters to pass to subprocess.Popen</li>
<li><strong>preexec_fn</strong> A function to run before execution starts.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A Popen object for the running command.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="module-pylorax.imgutils">
<span id="pylorax-imgutils-module"></span><h2>pylorax.imgutils module<a class="headerlink" href="#module-pylorax.imgutils" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="pylorax.imgutils.DMDev">
<em class="property">class </em><code class="descclassname">pylorax.imgutils.</code><code class="descname">DMDev</code><span class="sig-paren">(</span><em>dev</em>, <em>size</em>, <em>name=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#DMDev"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.DMDev" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
</dd></dl>
<dl class="class">
<dt id="pylorax.imgutils.LoopDev">
<em class="property">class </em><code class="descclassname">pylorax.imgutils.</code><code class="descname">LoopDev</code><span class="sig-paren">(</span><em>filename</em>, <em>size=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#LoopDev"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.LoopDev" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
</dd></dl>
<dl class="class">
<dt id="pylorax.imgutils.Mount">
<em class="property">class </em><code class="descclassname">pylorax.imgutils.</code><code class="descname">Mount</code><span class="sig-paren">(</span><em>dev</em>, <em>opts=''</em>, <em>mnt=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#Mount"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.Mount" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
</dd></dl>
<dl class="class">
<dt id="pylorax.imgutils.PartitionMount">
<em class="property">class </em><code class="descclassname">pylorax.imgutils.</code><code class="descname">PartitionMount</code><span class="sig-paren">(</span><em>disk_img</em>, <em>mount_ok=None</em>, <em>submount=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#PartitionMount"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.PartitionMount" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>Mount a partitioned image file using kpartx</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.compress">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">compress</code><span class="sig-paren">(</span><em>command</em>, <em>rootdir</em>, <em>outfile</em>, <em>compression='xz'</em>, <em>compressargs=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#compress"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.compress" title="Permalink to this definition"></a></dt>
<dd><p>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.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.copytree">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">copytree</code><span class="sig-paren">(</span><em>src</em>, <em>dest</em>, <em>preserve=True</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#copytree"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.copytree" title="Permalink to this definition"></a></dt>
<dd><p>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.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.default_image_name">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">default_image_name</code><span class="sig-paren">(</span><em>compression</em>, <em>basename</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#default_image_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.default_image_name" title="Permalink to this definition"></a></dt>
<dd><p>Return a default image name with the correct suffix for the compression type.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>compression</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Compression type</li>
<li><strong>basename</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Base filename</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">basename with compression suffix</p>
</td>
</tr>
</tbody>
</table>
<p>If the compression is unknown it defaults to xz</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.dm_attach">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">dm_attach</code><span class="sig-paren">(</span><em>dev</em>, <em>size</em>, <em>name=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#dm_attach"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.dm_attach" title="Permalink to this definition"></a></dt>
<dd><p>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.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.dm_detach">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">dm_detach</code><span class="sig-paren">(</span><em>dev</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#dm_detach"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.dm_detach" title="Permalink to this definition"></a></dt>
<dd><p>Detach the named devicemapper device. Returns False if dmsetup fails.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.do_grafts">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">do_grafts</code><span class="sig-paren">(</span><em>grafts</em>, <em>dest</em>, <em>preserve=True</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#do_grafts"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.do_grafts" title="Permalink to this definition"></a></dt>
<dd><p>Copy each of the items listed in grafts into dest.
If the key ends with / its assumed to be a directory which should be
created, otherwise just the leading directories will be created.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.estimate_size">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">estimate_size</code><span class="sig-paren">(</span><em>rootdir</em>, <em>graft=None</em>, <em>fstype=None</em>, <em>blocksize=4096</em>, <em>overhead=256</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#estimate_size"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.estimate_size" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.get_loop_name">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">get_loop_name</code><span class="sig-paren">(</span><em>path</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#get_loop_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.get_loop_name" title="Permalink to this definition"></a></dt>
<dd><p>Return the loop device associated with the path.
Raises RuntimeError if more than one loop is associated</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.loop_attach">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">loop_attach</code><span class="sig-paren">(</span><em>outfile</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#loop_attach"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.loop_attach" title="Permalink to this definition"></a></dt>
<dd><p>Attach a loop device to the given file. Return the loop device name.
Raises CalledProcessError if losetup fails.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.loop_detach">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">loop_detach</code><span class="sig-paren">(</span><em>loopdev</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#loop_detach"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.loop_detach" title="Permalink to this definition"></a></dt>
<dd><p>Detach the given loop device. Return False on failure.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.loop_waitfor">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">loop_waitfor</code><span class="sig-paren">(</span><em>loop_dev</em>, <em>outfile</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#loop_waitfor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.loop_waitfor" title="Permalink to this definition"></a></dt>
<dd><p>Make sure the loop device is attached to the outfile.</p>
<p>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.</p>
<p>Raise RuntimeError if it isnt setup after 5 tries.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.mkbtrfsimg">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">mkbtrfsimg</code><span class="sig-paren">(</span><em>rootdir</em>, <em>outfile</em>, <em>size=None</em>, <em>label=''</em>, <em>mountargs=''</em>, <em>graft=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#mkbtrfsimg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.mkbtrfsimg" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.mkcpio">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">mkcpio</code><span class="sig-paren">(</span><em>rootdir</em>, <em>outfile</em>, <em>compression='xz'</em>, <em>compressargs=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#mkcpio"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.mkcpio" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.mkdosimg">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">mkdosimg</code><span class="sig-paren">(</span><em>rootdir</em>, <em>outfile</em>, <em>size=None</em>, <em>label=''</em>, <em>mountargs='shortname=winnt</em>, <em>umask=0077'</em>, <em>graft=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#mkdosimg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.mkdosimg" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.mkext4img">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">mkext4img</code><span class="sig-paren">(</span><em>rootdir</em>, <em>outfile</em>, <em>size=None</em>, <em>label=''</em>, <em>mountargs=''</em>, <em>graft=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#mkext4img"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.mkext4img" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.mkfsimage">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">mkfsimage</code><span class="sig-paren">(</span><em>fstype</em>, <em>rootdir</em>, <em>outfile</em>, <em>size=None</em>, <em>mkfsargs=None</em>, <em>mountargs=''</em>, <em>graft=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#mkfsimage"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.mkfsimage" title="Permalink to this definition"></a></dt>
<dd><p>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”};</p>
<blockquote>
<div>if the path ends with a / its assumed to be a directory.</div></blockquote>
<p>Will raise CalledProcessError if something goes wrong.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.mkfsimage_from_disk">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">mkfsimage_from_disk</code><span class="sig-paren">(</span><em>diskimage</em>, <em>fsimage</em>, <em>img_size=None</em>, <em>label='Anaconda'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#mkfsimage_from_disk"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.mkfsimage_from_disk" title="Permalink to this definition"></a></dt>
<dd><p>Copy the / partition of a partitioned disk image to an un-partitioned
disk image.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>diskimage</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) The full path to partitioned disk image with a /</li>
<li><strong>fsimage</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) The full path of the output fs image file</li>
<li><strong>img_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) Optional size of the fsimage in MiB or None to make
it as small as possible</li>
<li><strong>label</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) The label to apply to the image. Defaults to “Anaconda”</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.mkhfsimg">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">mkhfsimg</code><span class="sig-paren">(</span><em>rootdir</em>, <em>outfile</em>, <em>size=None</em>, <em>label=''</em>, <em>mountargs=''</em>, <em>graft=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#mkhfsimg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.mkhfsimg" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.mkqcow2">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">mkqcow2</code><span class="sig-paren">(</span><em>outfile</em>, <em>size</em>, <em>options=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#mkqcow2"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.mkqcow2" title="Permalink to this definition"></a></dt>
<dd><p>use qemu-img to create a file of the given size.
options is a list of options passed to qemu-img</p>
<p>Default format is qcow2, override by passing “-f”, fmt
in options.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.mkqemu_img">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">mkqemu_img</code><span class="sig-paren">(</span><em>outfile</em>, <em>size</em>, <em>options=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#mkqemu_img"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.mkqemu_img" title="Permalink to this definition"></a></dt>
<dd><p>use qemu-img to create a file of the given size.
options is a list of options passed to qemu-img</p>
<p>Default format is qcow2, override by passing “-f”, fmt
in options.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.mkrootfsimg">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">mkrootfsimg</code><span class="sig-paren">(</span><em>rootdir</em>, <em>outfile</em>, <em>label</em>, <em>size=2</em>, <em>sysroot=''</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#mkrootfsimg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.mkrootfsimg" title="Permalink to this definition"></a></dt>
<dd><p>Make rootfs image from a directory</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>rootdir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Root directory</li>
<li><strong>outfile</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Path of output image file</li>
<li><strong>label</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Filesystem label</li>
<li><strong>size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) Size of the image in GiB, if None computed automatically</li>
<li><strong>sysroot</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) path to system (deployment) root relative to physical root</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.mksparse">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">mksparse</code><span class="sig-paren">(</span><em>outfile</em>, <em>size</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#mksparse"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.mksparse" title="Permalink to this definition"></a></dt>
<dd><p>use os.ftruncate to create a sparse file of the given size.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.mksquashfs">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">mksquashfs</code><span class="sig-paren">(</span><em>rootdir</em>, <em>outfile</em>, <em>compression='default'</em>, <em>compressargs=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#mksquashfs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.mksquashfs" title="Permalink to this definition"></a></dt>
<dd><p>Make a squashfs image containing the given rootdir.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.mktar">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">mktar</code><span class="sig-paren">(</span><em>rootdir</em>, <em>outfile</em>, <em>compression='xz'</em>, <em>compressargs=None</em>, <em>selinux=True</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#mktar"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.mktar" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.mount">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">mount</code><span class="sig-paren">(</span><em>dev</em>, <em>opts=''</em>, <em>mnt=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#mount"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.mount" title="Permalink to this definition"></a></dt>
<dd><p>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.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.round_to_blocks">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">round_to_blocks</code><span class="sig-paren">(</span><em>size</em>, <em>blocksize</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#round_to_blocks"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.round_to_blocks" title="Permalink to this definition"></a></dt>
<dd><p>If size isnt a multiple of blocksize, round up to the next multiple</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.imgutils.umount">
<code class="descclassname">pylorax.imgutils.</code><code class="descname">umount</code><span class="sig-paren">(</span><em>mnt</em>, <em>lazy=False</em>, <em>maxretry=3</em>, <em>retrysleep=1.0</em>, <em>delete=True</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#umount"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.umount" title="Permalink to this definition"></a></dt>
<dd><p>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.</p>
</dd></dl>
</div>
<div class="section" id="module-pylorax.installer">
<span id="pylorax-installer-module"></span><h2>pylorax.installer module<a class="headerlink" href="#module-pylorax.installer" title="Permalink to this headline"></a></h2>
<dl class="exception">
<dt id="pylorax.installer.InstallError">
<em class="property">exception </em><code class="descclassname">pylorax.installer.</code><code class="descname">InstallError</code><a class="reference internal" href="_modules/pylorax/installer.html#InstallError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.installer.InstallError" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/exceptions.html#Exception" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></a></p>
</dd></dl>
<dl class="class">
<dt id="pylorax.installer.QEMUInstall">
<em class="property">class </em><code class="descclassname">pylorax.installer.</code><code class="descname">QEMUInstall</code><span class="sig-paren">(</span><em>opts</em>, <em>iso</em>, <em>ks_paths</em>, <em>disk_img</em>, <em>img_size=2048</em>, <em>kernel_args=None</em>, <em>memory=1024</em>, <em>vcpus=None</em>, <em>vnc=None</em>, <em>arch=None</em>, <em>cancel_func=None</em>, <em>virtio_host='127.0.0.1'</em>, <em>virtio_port=6080</em>, <em>image_type=None</em>, <em>boot_uefi=False</em>, <em>ovmf_path=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/installer.html#QEMUInstall"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.installer.QEMUInstall" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>Run qemu using an iso and a kickstart</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.installer.anaconda_cleanup">
<code class="descclassname">pylorax.installer.</code><code class="descname">anaconda_cleanup</code><span class="sig-paren">(</span><em>dirinstall_path</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/installer.html#anaconda_cleanup"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.installer.anaconda_cleanup" title="Permalink to this definition"></a></dt>
<dd><p>Cleanup any leftover mounts from anaconda</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>dirinstall_path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Path where anaconda mounts things</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">True if cleanups were successful. False if any of them failed.</td>
</tr>
</tbody>
</table>
<p>If anaconda crashes it may leave things mounted under this path. It will
typically be set to /mnt/sysimage/</p>
<p>Attempts to cleanup may also fail. Catch these and continue trying the
other mountpoints.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.installer.append_initrd">
<code class="descclassname">pylorax.installer.</code><code class="descname">append_initrd</code><span class="sig-paren">(</span><em>initrd</em>, <em>files</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/installer.html#append_initrd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.installer.append_initrd" title="Permalink to this definition"></a></dt>
<dd><p>Append files to an initrd.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>initrd</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Path to initrd</li>
<li><strong>files</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.7)"><em>list</em></a>) list of file paths to add</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Path to a new initrd</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)">str</a></p>
</td>
</tr>
</tbody>
</table>
<p>The files are added to the initrd by creating a cpio image
of the files (stored at /) and writing the cpio to the end of a
copy of the initrd.</p>
<p>The initrd is not changed, a copy is made before appending the
cpio archive.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.installer.create_vagrant_metadata">
<code class="descclassname">pylorax.installer.</code><code class="descname">create_vagrant_metadata</code><span class="sig-paren">(</span><em>path</em>, <em>size=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/installer.html#create_vagrant_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.installer.create_vagrant_metadata" title="Permalink to this definition"></a></dt>
<dd><p>Create a default Vagrant metadata.json file</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Path to metadata.json file</li>
<li><strong>size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) Disk size in MiB</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pylorax.installer.find_free_port">
<code class="descclassname">pylorax.installer.</code><code class="descname">find_free_port</code><span class="sig-paren">(</span><em>start=5900</em>, <em>end=5999</em>, <em>host='127.0.0.1'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/installer.html#find_free_port"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.installer.find_free_port" title="Permalink to this definition"></a></dt>
<dd><p>Return first free port in range.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>start</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) Starting port number</li>
<li><strong>end</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) Ending port number</li>
<li><strong>host</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Host IP to search</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">First free port or -1 if none found</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)">int</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pylorax.installer.novirt_cancel_check">
<code class="descclassname">pylorax.installer.</code><code class="descname">novirt_cancel_check</code><span class="sig-paren">(</span><em>cancel_funcs</em>, <em>proc</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/installer.html#novirt_cancel_check"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.installer.novirt_cancel_check" title="Permalink to this definition"></a></dt>
<dd><p>Check to see if there has been an error in the logs</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>cancel_funcs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.7)"><em>list</em></a>) list of functions to call, True from any one cancels the build</li>
<li><strong>proc</strong> (<a class="reference external" href="https://docs.python.org/3/library/subprocess.html#subprocess.Popen" title="(in Python v3.7)"><em>subprocess.Popen</em></a>) Popen object for the anaconda process</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">True if the process has been terminated</p>
</td>
</tr>
</tbody>
</table>
<p>The cancel_funcs functions should return a True if an error has been detected.
When an error is detected the process is terminated and this returns True</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.installer.novirt_install">
<code class="descclassname">pylorax.installer.</code><code class="descname">novirt_install</code><span class="sig-paren">(</span><em>opts</em>, <em>disk_img</em>, <em>disk_size</em>, <em>cancel_func=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/installer.html#novirt_install"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.installer.novirt_install" title="Permalink to this definition"></a></dt>
<dd><p>Use Anaconda to install to a disk image</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>opts</strong> (<em>argparse options</em>) options passed to livemedia-creator</li>
<li><strong>disk_img</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) The full path to the disk image to be created</li>
<li><strong>disk_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) The size of the disk_img in MiB</li>
<li><strong>cancel_func</strong> (<em>function</em>) Function that returns True to cancel build</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>This method runs anaconda to create the image and then based on the opts
passed creates a qemu disk image or tarfile.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.installer.update_vagrant_metadata">
<code class="descclassname">pylorax.installer.</code><code class="descname">update_vagrant_metadata</code><span class="sig-paren">(</span><em>path</em>, <em>size</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/installer.html#update_vagrant_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.installer.update_vagrant_metadata" title="Permalink to this definition"></a></dt>
<dd><p>Update the Vagrant metadata.json file</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Path to metadata.json file</li>
<li><strong>size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) Disk size in MiB</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>This function makes sure that the provider, format and virtual size of the
metadata file are set correctly. All other values are left untouched.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.installer.virt_install">
<code class="descclassname">pylorax.installer.</code><code class="descname">virt_install</code><span class="sig-paren">(</span><em>opts</em>, <em>install_log</em>, <em>disk_img</em>, <em>disk_size</em>, <em>cancel_func=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/installer.html#virt_install"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.installer.virt_install" title="Permalink to this definition"></a></dt>
<dd><p>Use qemu to install to a disk image</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>opts</strong> (<em>argparse options</em>) options passed to livemedia-creator</li>
<li><strong>install_log</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) The path to write the log from qemu</li>
<li><strong>disk_img</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) The full path to the disk image to be created</li>
<li><strong>disk_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) The size of the disk_img in MiB</li>
<li><strong>cancel_func</strong> (<em>function</em>) Function that returns True to cancel build</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>This uses qemu with a boot.iso and a kickstart to create a disk
image and then optionally, based on the opts passed, creates tarfile.</p>
</dd></dl>
</div>
<div class="section" id="module-pylorax.ltmpl">
<span id="pylorax-ltmpl-module"></span><h2>pylorax.ltmpl module<a class="headerlink" href="#module-pylorax.ltmpl" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="pylorax.ltmpl.LoraxTemplate">
<em class="property">class </em><code class="descclassname">pylorax.ltmpl.</code><code class="descname">LoraxTemplate</code><span class="sig-paren">(</span><em>directories=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplate" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplate.parse">
<code class="descname">parse</code><span class="sig-paren">(</span><em>template_file</em>, <em>variables</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplate.parse"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplate.parse" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="pylorax.ltmpl.LoraxTemplateRunner">
<em class="property">class </em><code class="descclassname">pylorax.ltmpl.</code><code class="descname">LoraxTemplateRunner</code><span class="sig-paren">(</span><em>inroot</em>, <em>outroot</em>, <em>dbo=None</em>, <em>fatalerrors=True</em>, <em>templatedir=None</em>, <em>defaults=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>This class parses and executes Lorax templates. Sample usage:</p>
<blockquote>
<div><p># install a bunch of packages
runner = LoraxTemplateRunner(inroot=rundir, outroot=rundir, dbo=dnf_obj)
runner.run(“install-packages.ltmpl”)</p>
<p># modify a runtime dir
runner = LoraxTemplateRunner(inroot=rundir, outroot=newrun)
runner.run(“runtime-transmogrify.ltmpl”)</p>
</div></blockquote>
<p>NOTES:</p>
<ul>
<li><p class="first">Parsing procedure is roughly:
1. Mako template expansion (on the whole file)
2. For each line of the result,</p>
<blockquote>
<div><ol class="loweralpha simple">
<li>Whitespace splitting (using shlex.split())</li>
<li>Brace expansion (using brace_expand())</li>
<li>If the first token is the name of a function, call that function
with the rest of the line as arguments</li>
</ol>
</div></blockquote>
</li>
<li><p class="first">Parsing and execution are <em>separate</em> passes - so you cant use the result
of a command in an %if statement (or any other control statements)!</p>
</li>
<li><p class="first">Commands that run external programs (e.g. systemctl) currently use
the <em>host</em>s copy of that program, which may cause problems if theres a
big enough difference between the host and the image youre modifying.</p>
</li>
<li><p class="first">The commands are not executed under a real chroot, so absolute symlinks
will point <em>outside</em> the inroot/outroot. Be careful with symlinks!</p>
</li>
</ul>
<p>ADDING NEW COMMANDS:</p>
<ul class="simple">
<li>Each template command is just a method of the LoraxTemplateRunner
object - so adding a new command is as easy as adding a new function.</li>
<li>Each function gets arguments that correspond to the rest of the tokens
on that line (after word splitting and brace expansion)</li>
<li>Commands should raise exceptions for errors - dont use sys.exit()</li>
</ul>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.append">
<code class="descname">append</code><span class="sig-paren">(</span><em>filename</em>, <em>data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.append"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.append" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>append FILE STRING</dt>
<dd><p class="first">Append STRING (followed by a newline character) to FILE.
Python character escape sequences (n, t, etc.) will be
converted to the appropriate characters.
Examples:</p>
<blockquote class="last">
<div>append /etc/depmod.d/dd.conf “search updates built-in”
append /etc/resolv.conf “”</div></blockquote>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.chmod">
<code class="descname">chmod</code><span class="sig-paren">(</span><em>fileglob</em>, <em>mode</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.chmod"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.chmod" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>chmod FILEGLOB OCTALMODE</dt>
<dd>Change the mode of all the files matching FILEGLOB to OCTALMODE.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.copy">
<code class="descname">copy</code><span class="sig-paren">(</span><em>src</em>, <em>dest</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.copy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.copy" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>copy SRC DEST</dt>
<dd>Copy SRC to DEST.
If DEST is a directory, SRC will be copied inside it.
If DEST doesnt exist, SRC will be copied to a file with
that name, if the path leading to it exists.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.createaddrsize">
<code class="descname">createaddrsize</code><span class="sig-paren">(</span><em>addr</em>, <em>src</em>, <em>dest</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.createaddrsize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.createaddrsize" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>createaddrsize INITRD_ADDRESS INITRD ADDRSIZE</dt>
<dd><p class="first">Create the initrd.addrsize file required in LPAR boot process.
Examples:</p>
<blockquote class="last">
<div>createaddrsize ${INITRD_ADDRESS} ${outroot}/${BOOTDIR}/initrd.img ${outroot}/${BOOTDIR}/initrd.addrsize</div></blockquote>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.hardlink">
<code class="descname">hardlink</code><span class="sig-paren">(</span><em>src</em>, <em>dest</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.hardlink"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.hardlink" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>hardlink SRC DEST</dt>
<dd>Create a hardlink at DEST which is linked to SRC.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.install">
<code class="descname">install</code><span class="sig-paren">(</span><em>srcglob</em>, <em>dest</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.install"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.install" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>install SRC DEST</dt>
<dd><p class="first">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 doesnt 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:</p>
<blockquote class="last">
<div>install usr/share/myconfig/grub.conf /boot
install /usr/share/myconfig/grub.conf.in /boot/grub.conf</div></blockquote>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.installimg">
<code class="descname">installimg</code><span class="sig-paren">(</span><em>*args</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.installimg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.installimg" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>installimg [xz|gzip|bzip2|lzma] [-ARG|ARG=OPTION] SRCDIR DESTFILE</dt>
<dd><p class="first">Create a compressed cpio archive of the contents of SRCDIR and place
it in DESTFILE.</p>
<p>If SRCDIR doesnt exist or is empty nothing is created.</p>
<dl class="docutils">
<dt>Examples:</dt>
<dd>installimg ${LORAXDIR}/product/ images/product.img
installimg ${LORAXDIR}/updates/ images/updates.img
installimg xz -6 ${LORAXDIR}/updates/ images/updates.img
installimg xz -9 memlimit-compress=3700MiB ${LORAXDIR}/updates/ images/updates.img</dd>
</dl>
<p class="last">Optionally use a different compression type and override the default args
passed to it. The default is xz -9</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.installinitrd">
<code class="descname">installinitrd</code><span class="sig-paren">(</span><em>section</em>, <em>src</em>, <em>dest</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.installinitrd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.installinitrd" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>installinitrd SECTION SRC DEST</dt>
<dd>Same as installkernel, but for “initrd”.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.installkernel">
<code class="descname">installkernel</code><span class="sig-paren">(</span><em>section</em>, <em>src</em>, <em>dest</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.installkernel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.installkernel" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>installkernel SECTION SRC DEST</dt>
<dd><p class="first">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.</p>
<dl class="last docutils">
<dt>Equivalent to:</dt>
<dd>install SRC DEST
treeinfo SECTION kernel DEST</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.installpkg">
<code class="descname">installpkg</code><span class="sig-paren">(</span><em>*pkgs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.installpkg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.installpkg" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>installpkg [required|optional] [except PKGGLOB [except PKGGLOB …]] PKGGLOB [PKGGLOB …]</dt>
<dd><p class="first">Request installation of all packages matching the given globs.
Note that this is just a <em>request</em> - nothing is <em>actually</em> installed
until the run_pkg_transaction command is given.</p>
<p class="last">required is now the default. If the PKGGLOB can be missing pass optional</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.installupgradeinitrd">
<code class="descname">installupgradeinitrd</code><span class="sig-paren">(</span><em>section</em>, <em>src</em>, <em>dest</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.installupgradeinitrd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.installupgradeinitrd" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>installupgradeinitrd SECTION SRC DEST</dt>
<dd>Same as installkernel, but for “upgrade”.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.log">
<code class="descname">log</code><span class="sig-paren">(</span><em>msg</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.log"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.log" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>log MESSAGE</dt>
<dd><p class="first">Emit the given log message. Be sure to put it in quotes!
Example:</p>
<blockquote class="last">
<div>log “Reticulating splines, please wait…”</div></blockquote>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.mkdir">
<code class="descname">mkdir</code><span class="sig-paren">(</span><em>*dirs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.mkdir"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.mkdir" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>mkdir DIR [DIR …]</dt>
<dd><p class="first">Create the named DIR(s). Will create leading directories as needed.
Example:</p>
<blockquote class="last">
<div>mkdir /images</div></blockquote>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.move">
<code class="descname">move</code><span class="sig-paren">(</span><em>src</em>, <em>dest</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.move"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.move" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>move SRC DEST</dt>
<dd>Move SRC to DEST.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.remove">
<code class="descname">remove</code><span class="sig-paren">(</span><em>*fileglobs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.remove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.remove" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>remove FILEGLOB [FILEGLOB …]</dt>
<dd>Remove all the named files or directories.
Will <em>not</em> raise exceptions if the file(s) are not found.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.removefrom">
<code class="descname">removefrom</code><span class="sig-paren">(</span><em>pkg</em>, <em>*globs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.removefrom"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.removefrom" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>removefrom PKGGLOB [allbut] FILEGLOB [FILEGLOB…]</dt>
<dd><p class="first">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 <em>except</em> the ones which match the file globs.
Examples:</p>
<blockquote class="last">
<div>removefrom usbutils /usr/bin/*
removefrom xfsprogs allbut /sbin/*</div></blockquote>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.removekmod">
<code class="descname">removekmod</code><span class="sig-paren">(</span><em>*globs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.removekmod"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.removekmod" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>removekmod GLOB [GLOB…] [allbut] KEEPGLOB [KEEPGLOB…]</dt>
<dd><p class="first">Remove all files and directories matching the given file globs from the kernel
modules directory.</p>
<p>If allbut is used, all the files from the modules will be removed <em>except</em>
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 <em>KEEPGLOB</em>
so that it will match anywhere in the path.</p>
<p>This only removes files from under /lib/modules/<a href="#id1"><span class="problematic" id="id2">*</span></a>/kernel/</p>
<dl class="last docutils">
<dt>Examples:</dt>
<dd>removekmod sound drivers/media drivers/hwmon drivers/video
removekmod drivers/char allbut virtio_console hw_random</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.removepkg">
<code class="descname">removepkg</code><span class="sig-paren">(</span><em>*pkgs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.removepkg"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.removepkg" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>removepkg PKGGLOB [PKGGLOB…]</dt>
<dd><p class="first">Delete the named package(s).
IMPLEMENTATION NOTES:</p>
<blockquote class="last">
<div>RPM scriptlets (%preun/%postun) are <em>not</em> run.
Files are deleted, but directories are left behind.</div></blockquote>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.replace">
<code class="descname">replace</code><span class="sig-paren">(</span><em>pat</em>, <em>repl</em>, <em>*fileglobs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.replace"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.replace" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>replace PATTERN REPLACEMENT FILEGLOB [FILEGLOB …]</dt>
<dd><p class="first">Find-and-replace the given PATTERN (Python-style regex) with the given
REPLACEMENT string for each of the files listed.
Example:</p>
<blockquote class="last">
<div>replace &#64;VERSION&#64; ${product.version} /boot/grub.conf /boot/isolinux.cfg</div></blockquote>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.run">
<code class="descname">run</code><span class="sig-paren">(</span><em>templatefile</em>, <em>**variables</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.run"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.run" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.run_pkg_transaction">
<code class="descname">run_pkg_transaction</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.run_pkg_transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.run_pkg_transaction" title="Permalink to this definition"></a></dt>
<dd><p>Actually install all the packages requested by previous installpkg
commands.</p>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.runcmd">
<code class="descname">runcmd</code><span class="sig-paren">(</span><em>*cmdlist</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.runcmd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.runcmd" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>runcmd CMD [ARG …]</dt>
<dd><p class="first">Run the given command with the given arguments.</p>
<p>NOTE: All paths given MUST be COMPLETE, ABSOLUTE PATHS to the file
or files mentioned. ${root}/${inroot}/${outroot} are good for
constructing these paths.</p>
<p>FURTHER NOTE: Please use this command only as a last resort!
Whenever possible, you should use the existing template commands.
If the existing commands dont do what you need, fix them!</p>
<dl class="last docutils">
<dt>Examples:</dt>
<dd><p class="first">(this should be replaced with a “find” function)
runcmd find ${root} -name “<em>.pyo” -type f -delete
%for f in find(root, name=”</em>.pyo”):</p>
<blockquote>
<div>remove ${f}</div></blockquote>
<p class="last">%endfor</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.symlink">
<code class="descname">symlink</code><span class="sig-paren">(</span><em>target</em>, <em>dest</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.symlink"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.symlink" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>symlink SRC DEST</dt>
<dd>Create a symlink at DEST which points to SRC.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.systemctl">
<code class="descname">systemctl</code><span class="sig-paren">(</span><em>cmd</em>, <em>*units</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.systemctl"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.systemctl" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>systemctl [enable|disable|mask] UNIT [UNIT…]</dt>
<dd><p class="first">Enable, disable, or mask the given systemd units.
Examples:</p>
<blockquote class="last">
<div>systemctl disable lvm2-monitor.service
systemctl mask fedora-storage-init.service fedora-configure.service</div></blockquote>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pylorax.ltmpl.LoraxTemplateRunner.treeinfo">
<code class="descname">treeinfo</code><span class="sig-paren">(</span><em>section</em>, <em>key</em>, <em>*valuetoks</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner.treeinfo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner.treeinfo" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>treeinfo SECTION KEY ARG [ARG …]</dt>
<dd><p class="first">Add an item to the treeinfo data store.
The given SECTION will have a new item added where
KEY = ARG ARG …
Example:</p>
<blockquote class="last">
<div>treeinfo images-${kernel.arch} boot.iso images/boot.iso</div></blockquote>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="pylorax.ltmpl.brace_expand">
<code class="descclassname">pylorax.ltmpl.</code><code class="descname">brace_expand</code><span class="sig-paren">(</span><em>s</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#brace_expand"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.brace_expand" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pylorax.ltmpl.rexists">
<code class="descclassname">pylorax.ltmpl.</code><code class="descname">rexists</code><span class="sig-paren">(</span><em>pathname</em>, <em>root=''</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#rexists"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.rexists" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pylorax.ltmpl.rglob">
<code class="descclassname">pylorax.ltmpl.</code><code class="descname">rglob</code><span class="sig-paren">(</span><em>pathname</em>, <em>root='/'</em>, <em>fatal=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#rglob"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.rglob" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pylorax.ltmpl.split_and_expand">
<code class="descclassname">pylorax.ltmpl.</code><code class="descname">split_and_expand</code><span class="sig-paren">(</span><em>line</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#split_and_expand"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.split_and_expand" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
<div class="section" id="module-pylorax.monitor">
<span id="pylorax-monitor-module"></span><h2>pylorax.monitor module<a class="headerlink" href="#module-pylorax.monitor" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="pylorax.monitor.LogMonitor">
<em class="property">class </em><code class="descclassname">pylorax.monitor.</code><code class="descname">LogMonitor</code><span class="sig-paren">(</span><em>log_path=None</em>, <em>host='localhost'</em>, <em>port=0</em>, <em>timeout=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/monitor.html#LogMonitor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.monitor.LogMonitor" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>Setup a server to monitor the logs output by the installation</p>
<p>This needs to be running before the virt-install runs, it expects
there to be a listener on the port used for the virtio log port.</p>
<dl class="method">
<dt id="pylorax.monitor.LogMonitor.shutdown">
<code class="descname">shutdown</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/monitor.html#LogMonitor.shutdown"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.monitor.LogMonitor.shutdown" title="Permalink to this definition"></a></dt>
<dd><p>Force shutdown of the monitoring thread</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pylorax.monitor.LogRequestHandler">
<em class="property">class </em><code class="descclassname">pylorax.monitor.</code><code class="descname">LogRequestHandler</code><span class="sig-paren">(</span><em>request</em>, <em>client_address</em>, <em>server</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/monitor.html#LogRequestHandler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.monitor.LogRequestHandler" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/socketserver.html#socketserver.BaseRequestHandler" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">socketserver.BaseRequestHandler</span></code></a></p>
<p>Handle monitoring and saving the logfiles from the virtual install</p>
<p>Incoming data is written to self.server.log_path and each line is checked
for patterns that would indicate that the installation failed.
self.server.log_error is set True when this happens.</p>
<dl class="method">
<dt id="pylorax.monitor.LogRequestHandler.finish">
<code class="descname">finish</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/monitor.html#LogRequestHandler.finish"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.monitor.LogRequestHandler.finish" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.monitor.LogRequestHandler.handle">
<code class="descname">handle</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/monitor.html#LogRequestHandler.handle"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.monitor.LogRequestHandler.handle" title="Permalink to this definition"></a></dt>
<dd><p>Write incoming data to a logfile and check for errors</p>
<p>Split incoming data into lines and check for any Tracebacks or other
errors that indicate that the install failed.</p>
<p>Loops until self.server.kill is True</p>
</dd></dl>
<dl class="method">
<dt id="pylorax.monitor.LogRequestHandler.iserror">
<code class="descname">iserror</code><span class="sig-paren">(</span><em>line</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/monitor.html#LogRequestHandler.iserror"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.monitor.LogRequestHandler.iserror" title="Permalink to this definition"></a></dt>
<dd><p>Check a line to see if it contains an error indicating installation failure</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>line</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) log line to check for failure</td>
</tr>
</tbody>
</table>
<p>If the line contains IGNORED it will be skipped.</p>
</dd></dl>
<dl class="method">
<dt id="pylorax.monitor.LogRequestHandler.setup">
<code class="descname">setup</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/monitor.html#LogRequestHandler.setup"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.monitor.LogRequestHandler.setup" title="Permalink to this definition"></a></dt>
<dd><p>Start writing to self.server.log_path</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pylorax.monitor.LogServer">
<em class="property">class </em><code class="descclassname">pylorax.monitor.</code><code class="descname">LogServer</code><span class="sig-paren">(</span><em>log_path</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/monitor.html#LogServer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.monitor.LogServer" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/socketserver.html#socketserver.TCPServer" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">socketserver.TCPServer</span></code></a></p>
<p>A TCP Server that listens for log data</p>
<dl class="method">
<dt id="pylorax.monitor.LogServer.log_check">
<code class="descname">log_check</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/monitor.html#LogServer.log_check"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.monitor.LogServer.log_check" title="Permalink to this definition"></a></dt>
<dd><p>Check to see if an error has been found in the log</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">True if there has been an error</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)">bool</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pylorax.monitor.LogServer.timeout">
<code class="descname">timeout</code><em class="property"> = 60</em><a class="headerlink" href="#pylorax.monitor.LogServer.timeout" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
<div class="section" id="module-pylorax.mount">
<span id="pylorax-mount-module"></span><h2>pylorax.mount module<a class="headerlink" href="#module-pylorax.mount" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="pylorax.mount.IsoMountpoint">
<em class="property">class </em><code class="descclassname">pylorax.mount.</code><code class="descname">IsoMountpoint</code><span class="sig-paren">(</span><em>iso_path</em>, <em>initrd_path=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/mount.html#IsoMountpoint"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.mount.IsoMountpoint" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>Mount the iso and check to make sure the vmlinuz and initrd.img files exist</p>
<p>Also check the iso for a a stage2 image and set a flag and extract the
isos label.</p>
<p>stage2 can be either LiveOS/squashfs.img or images/install.img</p>
<dl class="method">
<dt id="pylorax.mount.IsoMountpoint.get_iso_label">
<code class="descname">get_iso_label</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/mount.html#IsoMountpoint.get_iso_label"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.mount.IsoMountpoint.get_iso_label" title="Permalink to this definition"></a></dt>
<dd><p>Get the isos label using isoinfo</p>
<p>Sets self.label if one is found</p>
</dd></dl>
<dl class="method">
<dt id="pylorax.mount.IsoMountpoint.umount">
<code class="descname">umount</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/mount.html#IsoMountpoint.umount"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.mount.IsoMountpoint.umount" title="Permalink to this definition"></a></dt>
<dd><p>Unmount the iso</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="module-pylorax.output">
<span id="pylorax-output-module"></span><h2>pylorax.output module<a class="headerlink" href="#module-pylorax.output" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-pylorax.sysutils">
<span id="pylorax-sysutils-module"></span><h2>pylorax.sysutils module<a class="headerlink" href="#module-pylorax.sysutils" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="pylorax.sysutils.joinpaths">
<code class="descclassname">pylorax.sysutils.</code><code class="descname">joinpaths</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/sysutils.html#joinpaths"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.sysutils.joinpaths" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pylorax.sysutils.touch">
<code class="descclassname">pylorax.sysutils.</code><code class="descname">touch</code><span class="sig-paren">(</span><em>fname</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/sysutils.html#touch"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.sysutils.touch" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pylorax.sysutils.replace">
<code class="descclassname">pylorax.sysutils.</code><code class="descname">replace</code><span class="sig-paren">(</span><em>fname</em>, <em>find</em>, <em>sub</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/sysutils.html#replace"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.sysutils.replace" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pylorax.sysutils.chown_">
<code class="descclassname">pylorax.sysutils.</code><code class="descname">chown_</code><span class="sig-paren">(</span><em>path</em>, <em>user=None</em>, <em>group=None</em>, <em>recursive=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/sysutils.html#chown_"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.sysutils.chown_" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pylorax.sysutils.chmod_">
<code class="descclassname">pylorax.sysutils.</code><code class="descname">chmod_</code><span class="sig-paren">(</span><em>path</em>, <em>mode</em>, <em>recursive=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/sysutils.html#chmod_"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.sysutils.chmod_" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pylorax.sysutils.remove">
<code class="descclassname">pylorax.sysutils.</code><code class="descname">remove</code><span class="sig-paren">(</span><em>target</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/sysutils.html#remove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.sysutils.remove" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pylorax.sysutils.linktree">
<code class="descclassname">pylorax.sysutils.</code><code class="descname">linktree</code><span class="sig-paren">(</span><em>src</em>, <em>dst</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/sysutils.html#linktree"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.sysutils.linktree" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
<div class="section" id="module-pylorax.treebuilder">
<span id="pylorax-treebuilder-module"></span><h2>pylorax.treebuilder module<a class="headerlink" href="#module-pylorax.treebuilder" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="pylorax.treebuilder.RuntimeBuilder">
<em class="property">class </em><code class="descclassname">pylorax.treebuilder.</code><code class="descname">RuntimeBuilder</code><span class="sig-paren">(</span><em>product</em>, <em>arch</em>, <em>dbo</em>, <em>templatedir=None</em>, <em>installpkgs=None</em>, <em>excludepkgs=None</em>, <em>add_templates=None</em>, <em>add_template_vars=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#RuntimeBuilder"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.RuntimeBuilder" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>Builds the anaconda runtime image.</p>
<dl class="method">
<dt id="pylorax.treebuilder.RuntimeBuilder.cleanup">
<code class="descname">cleanup</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#RuntimeBuilder.cleanup"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.RuntimeBuilder.cleanup" title="Permalink to this definition"></a></dt>
<dd><p>Remove unneeded packages and files with runtime-cleanup.tmpl</p>
</dd></dl>
<dl class="method">
<dt id="pylorax.treebuilder.RuntimeBuilder.create_runtime">
<code class="descname">create_runtime</code><span class="sig-paren">(</span><em>outfile='/var/tmp/squashfs.img'</em>, <em>compression='xz'</em>, <em>compressargs=None</em>, <em>size=2</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#RuntimeBuilder.create_runtime"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.RuntimeBuilder.create_runtime" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.treebuilder.RuntimeBuilder.finished">
<code class="descname">finished</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#RuntimeBuilder.finished"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.RuntimeBuilder.finished" title="Permalink to this definition"></a></dt>
<dd><p>Done using RuntimeBuilder</p>
<p>Close the dnf base object</p>
</dd></dl>
<dl class="method">
<dt id="pylorax.treebuilder.RuntimeBuilder.generate_module_data">
<code class="descname">generate_module_data</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#RuntimeBuilder.generate_module_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.RuntimeBuilder.generate_module_data" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.treebuilder.RuntimeBuilder.install">
<code class="descname">install</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#RuntimeBuilder.install"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.RuntimeBuilder.install" title="Permalink to this definition"></a></dt>
<dd><p>Install packages and do initial setup with runtime-install.tmpl</p>
</dd></dl>
<dl class="method">
<dt id="pylorax.treebuilder.RuntimeBuilder.postinstall">
<code class="descname">postinstall</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#RuntimeBuilder.postinstall"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.RuntimeBuilder.postinstall" title="Permalink to this definition"></a></dt>
<dd><p>Do some post-install setup work with runtime-postinstall.tmpl</p>
</dd></dl>
<dl class="method">
<dt id="pylorax.treebuilder.RuntimeBuilder.verify">
<code class="descname">verify</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#RuntimeBuilder.verify"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.RuntimeBuilder.verify" title="Permalink to this definition"></a></dt>
<dd><p>Ensure that contents of the installroot can run</p>
</dd></dl>
<dl class="method">
<dt id="pylorax.treebuilder.RuntimeBuilder.writepkglists">
<code class="descname">writepkglists</code><span class="sig-paren">(</span><em>pkglistdir</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#RuntimeBuilder.writepkglists"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.RuntimeBuilder.writepkglists" title="Permalink to this definition"></a></dt>
<dd><p>debugging data: write out lists of package contents</p>
</dd></dl>
<dl class="method">
<dt id="pylorax.treebuilder.RuntimeBuilder.writepkgsizes">
<code class="descname">writepkgsizes</code><span class="sig-paren">(</span><em>pkgsizefile</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#RuntimeBuilder.writepkgsizes"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.RuntimeBuilder.writepkgsizes" title="Permalink to this definition"></a></dt>
<dd><p>debugging data: write a big list of pkg sizes</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pylorax.treebuilder.TreeBuilder">
<em class="property">class </em><code class="descclassname">pylorax.treebuilder.</code><code class="descname">TreeBuilder</code><span class="sig-paren">(</span><em>product</em>, <em>arch</em>, <em>inroot</em>, <em>outroot</em>, <em>runtime</em>, <em>isolabel</em>, <em>domacboot=True</em>, <em>doupgrade=True</em>, <em>templatedir=None</em>, <em>add_templates=None</em>, <em>add_template_vars=None</em>, <em>workdir=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#TreeBuilder"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.TreeBuilder" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>Builds the arch-specific boot images.
inroot should be the installtree root (the newly-built runtime dir)</p>
<dl class="method">
<dt id="pylorax.treebuilder.TreeBuilder.build">
<code class="descname">build</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#TreeBuilder.build"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.TreeBuilder.build" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.treebuilder.TreeBuilder.copy_dracut_hooks">
<code class="descname">copy_dracut_hooks</code><span class="sig-paren">(</span><em>hooks</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#TreeBuilder.copy_dracut_hooks"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.TreeBuilder.copy_dracut_hooks" title="Permalink to this definition"></a></dt>
<dd><p>Copy the hook scripts in hooks into the installroots /tmp/
and return a list of commands to pass to dracut when creating the
initramfs</p>
<p>hooks is a list of tuples with the name of the hook script and the
target dracut hook directory
(eg. [(“99anaconda-copy-ks.sh”, “/lib/dracut/hooks/pre-pivot”)])</p>
</dd></dl>
<dl class="attribute">
<dt id="pylorax.treebuilder.TreeBuilder.dracut_hooks_path">
<code class="descname">dracut_hooks_path</code><a class="headerlink" href="#pylorax.treebuilder.TreeBuilder.dracut_hooks_path" title="Permalink to this definition"></a></dt>
<dd><p>Return the path to the lorax dracut hooks scripts</p>
<p>Use the configured share dir if it is setup,
otherwise default to /usr/share/lorax/dracut_hooks</p>
</dd></dl>
<dl class="method">
<dt id="pylorax.treebuilder.TreeBuilder.implantisomd5">
<code class="descname">implantisomd5</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#TreeBuilder.implantisomd5"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.TreeBuilder.implantisomd5" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="pylorax.treebuilder.TreeBuilder.kernels">
<code class="descname">kernels</code><a class="headerlink" href="#pylorax.treebuilder.TreeBuilder.kernels" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.treebuilder.TreeBuilder.rebuild_initrds">
<code class="descname">rebuild_initrds</code><span class="sig-paren">(</span><em>add_args=None</em>, <em>backup=''</em>, <em>prefix=''</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#TreeBuilder.rebuild_initrds"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.TreeBuilder.rebuild_initrds" title="Permalink to this definition"></a></dt>
<dd><p>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”</p>
<p>If the initrd doesnt exist its name will be created based on the
name of the kernel.</p>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="pylorax.treebuilder.findkernels">
<code class="descclassname">pylorax.treebuilder.</code><code class="descname">findkernels</code><span class="sig-paren">(</span><em>root='/'</em>, <em>kdir='boot'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#findkernels"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.findkernels" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pylorax.treebuilder.generate_module_info">
<code class="descclassname">pylorax.treebuilder.</code><code class="descname">generate_module_info</code><span class="sig-paren">(</span><em>moddir</em>, <em>outfile=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#generate_module_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.generate_module_info" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pylorax.treebuilder.string_lower">
<code class="descclassname">pylorax.treebuilder.</code><code class="descname">string_lower</code><span class="sig-paren">(</span><em>string</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#string_lower"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.string_lower" title="Permalink to this definition"></a></dt>
<dd><p>Return a lowercase string.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>string</strong> String to lowercase</td>
</tr>
</tbody>
</table>
<p>This is used as a filter in the templates.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.treebuilder.udev_escape">
<code class="descclassname">pylorax.treebuilder.</code><code class="descname">udev_escape</code><span class="sig-paren">(</span><em>label</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#udev_escape"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.udev_escape" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
<div class="section" id="module-pylorax.treeinfo">
<span id="pylorax-treeinfo-module"></span><h2>pylorax.treeinfo module<a class="headerlink" href="#module-pylorax.treeinfo" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="pylorax.treeinfo.TreeInfo">
<em class="property">class </em><code class="descclassname">pylorax.treeinfo.</code><code class="descname">TreeInfo</code><span class="sig-paren">(</span><em>product</em>, <em>version</em>, <em>variant</em>, <em>basearch</em>, <em>packagedir=''</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treeinfo.html#TreeInfo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treeinfo.TreeInfo" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<dl class="method">
<dt id="pylorax.treeinfo.TreeInfo.add_section">
<code class="descname">add_section</code><span class="sig-paren">(</span><em>section</em>, <em>data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treeinfo.html#TreeInfo.add_section"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treeinfo.TreeInfo.add_section" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.treeinfo.TreeInfo.write">
<code class="descname">write</code><span class="sig-paren">(</span><em>outfile</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treeinfo.html#TreeInfo.write"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treeinfo.TreeInfo.write" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
<div class="section" id="module-pylorax">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-pylorax" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="pylorax.ArchData">
<em class="property">class </em><code class="descclassname">pylorax.</code><code class="descname">ArchData</code><span class="sig-paren">(</span><em>buildarch</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax.html#ArchData"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ArchData" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#pylorax.base.DataHolder" title="pylorax.base.DataHolder"><code class="xref py py-class docutils literal notranslate"><span class="pre">pylorax.base.DataHolder</span></code></a></p>
<dl class="attribute">
<dt id="pylorax.ArchData.bcj_arch">
<code class="descname">bcj_arch</code><em class="property"> = {'arm': 'arm', 'armhfp': 'arm', 'i386': 'x86', 'ppc': 'powerpc', 'ppc64': 'powerpc', 'ppc64le': 'powerpc', 'x86_64': 'x86'}</em><a class="headerlink" href="#pylorax.ArchData.bcj_arch" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="pylorax.ArchData.lib64_arches">
<code class="descname">lib64_arches</code><em class="property"> = ('x86_64', 'ppc64', 'ppc64le', 's390x', 'ia64', 'aarch64')</em><a class="headerlink" href="#pylorax.ArchData.lib64_arches" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="pylorax.Lorax">
<em class="property">class </em><code class="descclassname">pylorax.</code><code class="descname">Lorax</code><a class="reference internal" href="_modules/pylorax.html#Lorax"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.Lorax" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#pylorax.base.BaseLoraxClass" title="pylorax.base.BaseLoraxClass"><code class="xref py py-class docutils literal notranslate"><span class="pre">pylorax.base.BaseLoraxClass</span></code></a></p>
<dl class="method">
<dt id="pylorax.Lorax.configure">
<code class="descname">configure</code><span class="sig-paren">(</span><em>conf_file='/etc/lorax/lorax.conf'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax.html#Lorax.configure"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.Lorax.configure" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.Lorax.init_file_logging">
<code class="descname">init_file_logging</code><span class="sig-paren">(</span><em>logdir</em>, <em>logname='pylorax.log'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax.html#Lorax.init_file_logging"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.Lorax.init_file_logging" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.Lorax.init_stream_logging">
<code class="descname">init_stream_logging</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax.html#Lorax.init_stream_logging"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.Lorax.init_stream_logging" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.Lorax.run">
<code class="descname">run</code><span class="sig-paren">(</span><em>dbo</em>, <em>product</em>, <em>version</em>, <em>release</em>, <em>variant=''</em>, <em>bugurl=''</em>, <em>isfinal=False</em>, <em>workdir=None</em>, <em>outputdir=None</em>, <em>buildarch=None</em>, <em>volid=None</em>, <em>domacboot=True</em>, <em>doupgrade=True</em>, <em>remove_temp=False</em>, <em>installpkgs=None</em>, <em>excludepkgs=None</em>, <em>size=2</em>, <em>add_templates=None</em>, <em>add_template_vars=None</em>, <em>add_arch_templates=None</em>, <em>add_arch_template_vars=None</em>, <em>verify=True</em>, <em>user_dracut_args=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax.html#Lorax.run"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.Lorax.run" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="pylorax.Lorax.templatedir">
<code class="descname">templatedir</code><a class="headerlink" href="#pylorax.Lorax.templatedir" title="Permalink to this definition"></a></dt>
<dd><p>Find the template directory.</p>
<p>Pick the first directory under sharedir/templates.d/ if it exists.
Otherwise use the sharedir</p>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="pylorax.find_templates">
<code class="descclassname">pylorax.</code><code class="descname">find_templates</code><span class="sig-paren">(</span><em>templatedir='/usr/share/lorax'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax.html#find_templates"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.find_templates" title="Permalink to this definition"></a></dt>
<dd><p>Find the templates to use.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>templatedir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Top directory to search for templates</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Path to templates</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)">str</a></td>
</tr>
</tbody>
</table>
<p>If there is a templates.d directory under templatedir the
lowest numbered directory entry is returned.</p>
<p>eg. /usr/share/lorax/templates.d/99-generic/</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.get_buildarch">
<code class="descclassname">pylorax.</code><code class="descname">get_buildarch</code><span class="sig-paren">(</span><em>dbo</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax.html#get_buildarch"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.get_buildarch" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pylorax.log_selinux_state">
<code class="descclassname">pylorax.</code><code class="descname">log_selinux_state</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax.html#log_selinux_state"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.log_selinux_state" title="Permalink to this definition"></a></dt>
<dd><p>Log the current state of selinux</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.setup_logging">
<code class="descclassname">pylorax.</code><code class="descname">setup_logging</code><span class="sig-paren">(</span><em>logfile</em>, <em>theLogger</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax.html#setup_logging"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.setup_logging" title="Permalink to this definition"></a></dt>
<dd><p>Setup the various logs</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>logfile</strong> (<em>string</em>) filename to write the log to</li>
<li><strong>theLogger</strong> (<a class="reference external" href="https://docs.python.org/3/library/logging.html#logging.Logger" title="(in Python v3.7)"><em>logging.Logger</em></a>) top-level logger</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="pylorax.api.html" class="btn btn-neutral float-right" title="pylorax.api package" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="modules.html" class="btn btn-neutral" title="pylorax" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2018, Red Hat, Inc.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'28.14.21',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>