New lorax documentation - 29.28

This commit is contained in:
Brian C. Lane 2019-05-07 15:46:06 -07:00
parent 4b87dc09d0
commit 48ba83b67b
99 changed files with 4520 additions and 1376 deletions

View File

@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: f75ad3ae64910413db55774b9b88758b
config: 1bf42a3192ec6a62d96115c18e727069
tags: 645f666f9bcd5a90fca523b33c5a78b7

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>composer.cli &mdash; Lorax 29.21 documentation</title>
<title>composer.cli &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -244,7 +244,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>composer.cli.blueprints &mdash; Lorax 29.21 documentation</title>
<title>composer.cli.blueprints &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -701,7 +701,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>composer.cli.cmdline &mdash; Lorax 29.21 documentation</title>
<title>composer.cli.cmdline &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -240,7 +240,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>composer.cli.compose &mdash; Lorax 29.21 documentation</title>
<title>composer.cli.compose &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -704,7 +704,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>composer.cli.modules &mdash; Lorax 29.21 documentation</title>
<title>composer.cli.modules &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -238,7 +238,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>composer.cli.projects &mdash; Lorax 29.21 documentation</title>
<title>composer.cli.projects &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -300,7 +300,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>composer.cli.sources &mdash; Lorax 29.21 documentation</title>
<title>composer.cli.sources &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -342,7 +342,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>composer.cli.status &mdash; Lorax 29.21 documentation</title>
<title>composer.cli.status &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -246,7 +246,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>composer.cli.utilities &mdash; Lorax 29.21 documentation</title>
<title>composer.cli.utilities &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -285,7 +285,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>composer.http_client &mdash; Lorax 29.21 documentation</title>
<title>composer.http_client &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -448,7 +448,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>composer.unix_socket &mdash; Lorax 29.21 documentation</title>
<title>composer.unix_socket &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -249,7 +249,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Overview: module code &mdash; Lorax 29.21 documentation</title>
<title>Overview: module code &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -162,12 +162,14 @@
</ul><li><a href="composer/http_client.html">composer.http_client</a></li>
<li><a href="composer/unix_socket.html">composer.unix_socket</a></li>
<li><a href="pylorax.html">pylorax</a></li>
<ul><li><a href="pylorax/api/checkparams.html">pylorax.api.checkparams</a></li>
<ul><li><a href="pylorax/api/bisect.html">pylorax.api.bisect</a></li>
<li><a href="pylorax/api/checkparams.html">pylorax.api.checkparams</a></li>
<li><a href="pylorax/api/cmdline.html">pylorax.api.cmdline</a></li>
<li><a href="pylorax/api/compose.html">pylorax.api.compose</a></li>
<li><a href="pylorax/api/config.html">pylorax.api.config</a></li>
<li><a href="pylorax/api/crossdomain.html">pylorax.api.crossdomain</a></li>
<li><a href="pylorax/api/dnfbase.html">pylorax.api.dnfbase</a></li>
<li><a href="pylorax/api/gitrpm.html">pylorax.api.gitrpm</a></li>
<li><a href="pylorax/api/projects.html">pylorax.api.projects</a></li>
<li><a href="pylorax/api/queue.html">pylorax.api.queue</a></li>
<li><a href="pylorax/api/recipes.html">pylorax.api.recipes</a></li>
@ -228,7 +230,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax &mdash; Lorax 29.21 documentation</title>
<title>pylorax &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -340,7 +340,8 @@
<span class="n">add_arch_templates</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">add_arch_template_vars</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">verify</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="n">user_dracut_args</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="n">user_dracut_args</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">squashfs_only</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
<span class="k">assert</span> <span class="bp">self</span><span class="o">.</span><span class="n">_configured</span>
@ -472,9 +473,16 @@
<span class="n">compressargs</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;-Xbcj&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">arch</span><span class="o">.</span><span class="n">bcj</span><span class="p">]</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;no BCJ filter for arch </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">arch</span><span class="o">.</span><span class="n">basearch</span><span class="p">)</span>
<span class="n">rb</span><span class="o">.</span><span class="n">create_runtime</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">installroot</span><span class="p">,</span><span class="n">runtime</span><span class="p">),</span>
<span class="n">compression</span><span class="o">=</span><span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="n">compressargs</span><span class="p">,</span>
<span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">)</span>
<span class="k">if</span> <span class="n">squashfs_only</span><span class="p">:</span>
<span class="c1"># Create an ext4 rootfs.img and compress it with squashfs</span>
<span class="n">rb</span><span class="o">.</span><span class="n">create_squashfs_runtime</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">installroot</span><span class="p">,</span><span class="n">runtime</span><span class="p">),</span>
<span class="n">compression</span><span class="o">=</span><span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="n">compressargs</span><span class="p">,</span>
<span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># Create an ext4 rootfs.img and compress it with squashfs</span>
<span class="n">rb</span><span class="o">.</span><span class="n">create_ext4_runtime</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">installroot</span><span class="p">,</span><span class="n">runtime</span><span class="p">),</span>
<span class="n">compression</span><span class="o">=</span><span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="n">compressargs</span><span class="p">,</span>
<span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">)</span>
<span class="n">rb</span><span class="o">.</span><span class="n">finished</span><span class="p">()</span>
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;preparing to build output tree and boot images&quot;</span><span class="p">)</span>
@ -575,6 +583,8 @@
<span class="n">f</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">logfile</span><span class="p">))</span><span class="o">+</span><span class="s2">&quot;/program.log&quot;</span>
<span class="n">fh</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">FileHandler</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="n">f</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s2">&quot;w&quot;</span><span class="p">)</span>
<span class="n">fh</span><span class="o">.</span><span class="n">setLevel</span><span class="p">(</span><span class="n">logging</span><span class="o">.</span><span class="n">DEBUG</span><span class="p">)</span>
<span class="n">fmt</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">Formatter</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">%(asctime)s</span><span class="s2"> </span><span class="si">%(levelname)s</span><span class="s2">: </span><span class="si">%(message)s</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="n">fh</span><span class="o">.</span><span class="n">setFormatter</span><span class="p">(</span><span class="n">fmt</span><span class="p">)</span>
<span class="n">program_log</span><span class="o">.</span><span class="n">addHandler</span><span class="p">(</span><span class="n">fh</span><span class="p">)</span></div>
@ -642,7 +652,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -0,0 +1,266 @@
<!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.api.bisect &mdash; Lorax 29.28 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" />
<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">
29.28
</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>
<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"><a class="reference internal" href="../../../modules.html">src</a></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="../../index.html">Module code</a> &raquo;</li>
<li><a href="../../pylorax.html">pylorax</a> &raquo;</li>
<li>pylorax.api.bisect</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<h1>Source code for pylorax.api.bisect</h1><div class="highlight"><pre>
<span></span><span class="c1">#</span>
<span class="c1"># Copyright (C) 2018 Red Hat, Inc.</span>
<span class="c1">#</span>
<span class="c1"># This program is free software; you can redistribute it and/or modify</span>
<span class="c1"># it under the terms of the GNU General Public License as published by</span>
<span class="c1"># the Free Software Foundation; either version 2 of the License, or</span>
<span class="c1"># (at your option) any later version.</span>
<span class="c1">#</span>
<span class="c1"># This program is distributed in the hope that it will be useful,</span>
<span class="c1"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<span class="c1"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
<span class="c1"># GNU General Public License for more details.</span>
<span class="c1">#</span>
<span class="c1"># You should have received a copy of the GNU General Public License</span>
<span class="c1"># along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
<span class="c1">#</span>
<div class="viewcode-block" id="insort_left"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.bisect.insort_left">[docs]</a><span class="k">def</span> <span class="nf">insort_left</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">lo</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">hi</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Insert item x in list a, and keep it sorted assuming a is sorted.</span>
<span class="sd"> :param a: sorted list</span>
<span class="sd"> :type a: list</span>
<span class="sd"> :param x: item to insert into the list</span>
<span class="sd"> :type x: object</span>
<span class="sd"> :param key: Function to use to compare items in the list</span>
<span class="sd"> :type key: function</span>
<span class="sd"> :returns: index where the item was inserted</span>
<span class="sd"> :rtype: int</span>
<span class="sd"> If x is already in a, insert it to the left of the leftmost x.</span>
<span class="sd"> Optional args lo (default 0) and hi (default len(a)) bound the</span>
<span class="sd"> slice of a to be searched.</span>
<span class="sd"> This is a modified version of bisect.insort_left that can use a</span>
<span class="sd"> function for the compare, and returns the index position where it</span>
<span class="sd"> was inserted.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="n">key</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">key</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span>
<span class="k">if</span> <span class="n">lo</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;lo must be non-negative&#39;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">hi</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">hi</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>
<span class="k">while</span> <span class="n">lo</span> <span class="o">&lt;</span> <span class="n">hi</span><span class="p">:</span>
<span class="n">mid</span> <span class="o">=</span> <span class="p">(</span><span class="n">lo</span><span class="o">+</span><span class="n">hi</span><span class="p">)</span><span class="o">//</span><span class="mi">2</span>
<span class="k">if</span> <span class="n">key</span><span class="p">(</span><span class="n">a</span><span class="p">[</span><span class="n">mid</span><span class="p">])</span> <span class="o">&lt;</span> <span class="n">key</span><span class="p">(</span><span class="n">x</span><span class="p">):</span> <span class="n">lo</span> <span class="o">=</span> <span class="n">mid</span><span class="o">+</span><span class="mi">1</span>
<span class="k">else</span><span class="p">:</span> <span class="n">hi</span> <span class="o">=</span> <span class="n">mid</span>
<span class="n">a</span><span class="o">.</span><span class="n">insert</span><span class="p">(</span><span class="n">lo</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span>
<span class="k">return</span> <span class="n">lo</span></div>
</pre></div>
</div>
</div>
<footer>
<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:'29.28',
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>

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.api.checkparams &mdash; Lorax 29.21 documentation</title>
<title>pylorax.api.checkparams &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -234,7 +234,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.api.cmdline &mdash; Lorax 29.21 documentation</title>
<title>pylorax.api.cmdline &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -178,6 +178,9 @@
<span class="kn">from</span> <span class="nn">pylorax</span> <span class="k">import</span> <span class="n">vernum</span>
<span class="n">DEFAULT_USER</span> <span class="o">=</span> <span class="s2">&quot;root&quot;</span>
<span class="n">DEFAULT_GROUP</span> <span class="o">=</span> <span class="s2">&quot;weldr&quot;</span>
<span class="n">version</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="si">{0}</span><span class="s2">-</span><span class="si">{1}</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">0</span><span class="p">]),</span> <span class="n">vernum</span><span class="p">)</span>
<div class="viewcode-block" id="lorax_composer_parser"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.cmdline.lorax_composer_parser">[docs]</a><span class="k">def</span> <span class="nf">lorax_composer_parser</span><span class="p">():</span>
@ -188,9 +191,9 @@
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--socket&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s2">&quot;/run/weldr/api.socket&quot;</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">&quot;SOCKET&quot;</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Path to the socket file to listen on&quot;</span><span class="p">)</span>
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--user&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s2">&quot;weldr&quot;</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">&quot;USER&quot;</span><span class="p">,</span>
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--user&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="n">DEFAULT_USER</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">&quot;USER&quot;</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;User to use for reduced permissions&quot;</span><span class="p">)</span>
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--group&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s2">&quot;weldr&quot;</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">&quot;GROUP&quot;</span><span class="p">,</span>
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--group&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="n">DEFAULT_GROUP</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">&quot;GROUP&quot;</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Group to set ownership of the socket to&quot;</span><span class="p">)</span>
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--log&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;logfile&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s2">&quot;/var/log/lorax-composer/composer.log&quot;</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">&quot;LOG&quot;</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Path to logfile (/var/log/lorax-composer/composer.log)&quot;</span><span class="p">)</span>
@ -250,7 +253,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.api.compose &mdash; Lorax 29.21 documentation</title>
<title>pylorax.api.compose &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -154,7 +154,7 @@
<div itemprop="articleBody">
<h1>Source code for pylorax.api.compose</h1><div class="highlight"><pre>
<span></span><span class="c1"># Copyright (C) 2018 Red Hat, Inc.</span>
<span></span><span class="c1"># Copyright (C) 2018-2019 Red Hat, Inc.</span>
<span class="c1">#</span>
<span class="c1"># This program is free software; you can redistribute it and/or modify</span>
<span class="c1"># it under the terms of the GNU General Public License as published by</span>
@ -191,6 +191,7 @@
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">from</span> <span class="nn">glob</span> <span class="k">import</span> <span class="n">glob</span>
<span class="kn">from</span> <span class="nn">io</span> <span class="k">import</span> <span class="n">StringIO</span>
<span class="kn">from</span> <span class="nn">math</span> <span class="k">import</span> <span class="n">ceil</span>
<span class="kn">import</span> <span class="nn">pytoml</span> <span class="k">as</span> <span class="nn">toml</span>
<span class="kn">import</span> <span class="nn">shutil</span>
@ -200,11 +201,15 @@
<span class="kn">from</span> <span class="nn">pykickstart.parser</span> <span class="k">import</span> <span class="n">KickstartParser</span>
<span class="kn">from</span> <span class="nn">pykickstart.version</span> <span class="k">import</span> <span class="n">makeVersion</span>
<span class="kn">from</span> <span class="nn">pylorax</span> <span class="k">import</span> <span class="n">ArchData</span><span class="p">,</span> <span class="n">find_templates</span><span class="p">,</span> <span class="n">get_buildarch</span>
<span class="kn">from</span> <span class="nn">pylorax.api.gitrpm</span> <span class="k">import</span> <span class="n">create_gitrpm_repo</span>
<span class="kn">from</span> <span class="nn">pylorax.api.projects</span> <span class="k">import</span> <span class="n">projects_depsolve</span><span class="p">,</span> <span class="n">projects_depsolve_with_size</span><span class="p">,</span> <span class="n">dep_nevra</span>
<span class="kn">from</span> <span class="nn">pylorax.api.projects</span> <span class="k">import</span> <span class="n">ProjectsError</span>
<span class="kn">from</span> <span class="nn">pylorax.api.recipes</span> <span class="k">import</span> <span class="n">read_recipe_and_id</span>
<span class="kn">from</span> <span class="nn">pylorax.api.timestamp</span> <span class="k">import</span> <span class="n">TS_CREATED</span><span class="p">,</span> <span class="n">write_timestamp</span>
<span class="kn">from</span> <span class="nn">pylorax.base</span> <span class="k">import</span> <span class="n">DataHolder</span>
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="k">import</span> <span class="n">default_image_name</span>
<span class="kn">from</span> <span class="nn">pylorax.ltmpl</span> <span class="k">import</span> <span class="n">LiveTemplateRunner</span>
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="k">import</span> <span class="n">joinpaths</span><span class="p">,</span> <span class="n">flatconfig</span>
@ -231,7 +236,7 @@
<span class="n">pkgs</span> <span class="o">=</span> <span class="p">[(</span><span class="n">name</span><span class="p">,</span> <span class="s2">&quot;*&quot;</span><span class="p">)</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">packages</span><span class="o">.</span><span class="n">packageList</span><span class="p">]</span>
<span class="n">grps</span> <span class="o">=</span> <span class="p">[</span><span class="n">grp</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">grp</span> <span class="ow">in</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">packages</span><span class="o">.</span><span class="n">groupList</span><span class="p">]</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">_</span> <span class="o">=</span> <span class="n">projects_depsolve</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">pkgs</span><span class="p">,</span> <span class="n">grps</span><span class="p">)</span>
<span class="n">projects_depsolve</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">pkgs</span><span class="p">,</span> <span class="n">grps</span><span class="p">)</span>
<span class="k">except</span> <span class="n">ProjectsError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">template_errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">&quot;Error depsolving </span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">compose_type</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)))</span>
@ -266,9 +271,365 @@
<span class="k">if</span> <span class="ow">not</span> <span class="n">r</span><span class="o">.</span><span class="n">sslverify</span><span class="p">:</span>
<span class="n">cmd</span> <span class="o">+=</span> <span class="s1">&#39;--noverifyssl&#39;</span>
<span class="k">if</span> <span class="n">r</span><span class="o">.</span><span class="n">sslcacert</span><span class="p">:</span>
<span class="n">cmd</span> <span class="o">+=</span> <span class="s1">&#39; --sslcacert=&quot;</span><span class="si">%s</span><span class="s1">&quot;&#39;</span> <span class="o">%</span> <span class="n">r</span><span class="o">.</span><span class="n">sslcacert</span>
<span class="k">if</span> <span class="n">r</span><span class="o">.</span><span class="n">sslclientcert</span><span class="p">:</span>
<span class="n">cmd</span> <span class="o">+=</span> <span class="s1">&#39; --sslclientcert=&quot;</span><span class="si">%s</span><span class="s1">&quot;&#39;</span> <span class="o">%</span> <span class="n">r</span><span class="o">.</span><span class="n">sslclientcert</span>
<span class="k">if</span> <span class="n">r</span><span class="o">.</span><span class="n">sslclientkey</span><span class="p">:</span>
<span class="n">cmd</span> <span class="o">+=</span> <span class="s1">&#39; --sslclientkey=&quot;</span><span class="si">%s</span><span class="s1">&quot;&#39;</span> <span class="o">%</span> <span class="n">r</span><span class="o">.</span><span class="n">sslclientkey</span>
<span class="k">return</span> <span class="n">cmd</span></div>
<div class="viewcode-block" id="bootloader_append"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.compose.bootloader_append">[docs]</a><span class="k">def</span> <span class="nf">bootloader_append</span><span class="p">(</span><span class="n">line</span><span class="p">,</span> <span class="n">kernel_append</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; Insert the kernel_append string into the --append argument</span>
<span class="sd"> :param line: The bootloader ... line</span>
<span class="sd"> :type line: str</span>
<span class="sd"> :param kernel_append: The arguments to append to the --append section</span>
<span class="sd"> :type kernel_append: str</span>
<span class="sd"> Using pykickstart to process the line is the best way to make sure it</span>
<span class="sd"> is parsed correctly, and re-assembled for inclusion into the final kickstart</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">ks_version</span> <span class="o">=</span> <span class="n">makeVersion</span><span class="p">()</span>
<span class="n">ks</span> <span class="o">=</span> <span class="n">KickstartParser</span><span class="p">(</span><span class="n">ks_version</span><span class="p">,</span> <span class="n">errorsAreFatal</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">missingIncludeIsFatal</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="n">ks</span><span class="o">.</span><span class="n">readKickstartFromString</span><span class="p">(</span><span class="n">line</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">bootloader</span><span class="o">.</span><span class="n">appendLine</span><span class="p">:</span>
<span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">bootloader</span><span class="o">.</span><span class="n">appendLine</span> <span class="o">+=</span> <span class="s2">&quot; </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">kernel_append</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">bootloader</span><span class="o">.</span><span class="n">appendLine</span> <span class="o">=</span> <span class="n">kernel_append</span>
<span class="c1"># Converting back to a string includes a comment, return just the bootloader line</span>
<span class="k">return</span> <span class="nb">str</span><span class="p">(</span><span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">bootloader</span><span class="p">)</span><span class="o">.</span><span class="n">splitlines</span><span class="p">()[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span></div>
<div class="viewcode-block" id="get_kernel_append"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.compose.get_kernel_append">[docs]</a><span class="k">def</span> <span class="nf">get_kernel_append</span><span class="p">(</span><span class="n">recipe</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return the customizations.kernel append value</span>
<span class="sd"> :param recipe:</span>
<span class="sd"> :type recipe: Recipe object</span>
<span class="sd"> :returns: append value or empty string</span>
<span class="sd"> :rtype: str</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="s2">&quot;customizations&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">recipe</span> <span class="ow">or</span> \
<span class="s2">&quot;kernel&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">]</span> <span class="ow">or</span> \
<span class="s2">&quot;append&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">][</span><span class="s2">&quot;kernel&quot;</span><span class="p">]:</span>
<span class="k">return</span> <span class="s2">&quot;&quot;</span>
<span class="k">return</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">][</span><span class="s2">&quot;kernel&quot;</span><span class="p">][</span><span class="s2">&quot;append&quot;</span><span class="p">]</span></div>
<div class="viewcode-block" id="timezone_cmd"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.compose.timezone_cmd">[docs]</a><span class="k">def</span> <span class="nf">timezone_cmd</span><span class="p">(</span><span class="n">line</span><span class="p">,</span> <span class="n">settings</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; Update the timezone line with the settings</span>
<span class="sd"> :param line: The timezone ... line</span>
<span class="sd"> :type line: str</span>
<span class="sd"> :param settings: A dict with timezone and/or ntpservers list</span>
<span class="sd"> :type settings: dict</span>
<span class="sd"> Using pykickstart to process the line is the best way to make sure it</span>
<span class="sd"> is parsed correctly, and re-assembled for inclusion into the final kickstart</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">ks_version</span> <span class="o">=</span> <span class="n">makeVersion</span><span class="p">()</span>
<span class="n">ks</span> <span class="o">=</span> <span class="n">KickstartParser</span><span class="p">(</span><span class="n">ks_version</span><span class="p">,</span> <span class="n">errorsAreFatal</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">missingIncludeIsFatal</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="n">ks</span><span class="o">.</span><span class="n">readKickstartFromString</span><span class="p">(</span><span class="n">line</span><span class="p">)</span>
<span class="k">if</span> <span class="s2">&quot;timezone&quot;</span> <span class="ow">in</span> <span class="n">settings</span><span class="p">:</span>
<span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">timezone</span><span class="o">.</span><span class="n">timezone</span> <span class="o">=</span> <span class="n">settings</span><span class="p">[</span><span class="s2">&quot;timezone&quot;</span><span class="p">]</span>
<span class="k">if</span> <span class="s2">&quot;ntpservers&quot;</span> <span class="ow">in</span> <span class="n">settings</span><span class="p">:</span>
<span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">timezone</span><span class="o">.</span><span class="n">ntpservers</span> <span class="o">=</span> <span class="n">settings</span><span class="p">[</span><span class="s2">&quot;ntpservers&quot;</span><span class="p">]</span>
<span class="c1"># Converting back to a string includes a comment, return just the timezone line</span>
<span class="k">return</span> <span class="nb">str</span><span class="p">(</span><span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">timezone</span><span class="p">)</span><span class="o">.</span><span class="n">splitlines</span><span class="p">()[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span></div>
<div class="viewcode-block" id="get_timezone_settings"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.compose.get_timezone_settings">[docs]</a><span class="k">def</span> <span class="nf">get_timezone_settings</span><span class="p">(</span><span class="n">recipe</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return the customizations.timezone dict</span>
<span class="sd"> :param recipe:</span>
<span class="sd"> :type recipe: Recipe object</span>
<span class="sd"> :returns: append value or empty string</span>
<span class="sd"> :rtype: dict</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="s2">&quot;customizations&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">recipe</span> <span class="ow">or</span> \
<span class="s2">&quot;timezone&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">]:</span>
<span class="k">return</span> <span class="p">{}</span>
<span class="k">return</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">][</span><span class="s2">&quot;timezone&quot;</span><span class="p">]</span></div>
<div class="viewcode-block" id="lang_cmd"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.compose.lang_cmd">[docs]</a><span class="k">def</span> <span class="nf">lang_cmd</span><span class="p">(</span><span class="n">line</span><span class="p">,</span> <span class="n">languages</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; Update the lang line with the languages</span>
<span class="sd"> :param line: The lang ... line</span>
<span class="sd"> :type line: str</span>
<span class="sd"> :param settings: The list of languages</span>
<span class="sd"> :type settings: list</span>
<span class="sd"> Using pykickstart to process the line is the best way to make sure it</span>
<span class="sd"> is parsed correctly, and re-assembled for inclusion into the final kickstart</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">ks_version</span> <span class="o">=</span> <span class="n">makeVersion</span><span class="p">()</span>
<span class="n">ks</span> <span class="o">=</span> <span class="n">KickstartParser</span><span class="p">(</span><span class="n">ks_version</span><span class="p">,</span> <span class="n">errorsAreFatal</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">missingIncludeIsFatal</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="n">ks</span><span class="o">.</span><span class="n">readKickstartFromString</span><span class="p">(</span><span class="n">line</span><span class="p">)</span>
<span class="k">if</span> <span class="n">languages</span><span class="p">:</span>
<span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">lang</span><span class="o">.</span><span class="n">lang</span> <span class="o">=</span> <span class="n">languages</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">languages</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
<span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">lang</span><span class="o">.</span><span class="n">addsupport</span> <span class="o">=</span> <span class="n">languages</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
<span class="c1"># Converting back to a string includes a comment, return just the lang line</span>
<span class="k">return</span> <span class="nb">str</span><span class="p">(</span><span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">lang</span><span class="p">)</span><span class="o">.</span><span class="n">splitlines</span><span class="p">()[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span></div>
<div class="viewcode-block" id="get_languages"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.compose.get_languages">[docs]</a><span class="k">def</span> <span class="nf">get_languages</span><span class="p">(</span><span class="n">recipe</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return the customizations.locale.languages list</span>
<span class="sd"> :param recipe: The recipe</span>
<span class="sd"> :type recipe: Recipe object</span>
<span class="sd"> :returns: list of language strings</span>
<span class="sd"> :rtype: list</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="s2">&quot;customizations&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">recipe</span> <span class="ow">or</span> \
<span class="s2">&quot;locale&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">]</span> <span class="ow">or</span> \
<span class="s2">&quot;languages&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">][</span><span class="s2">&quot;locale&quot;</span><span class="p">]:</span>
<span class="k">return</span> <span class="p">[]</span>
<span class="k">return</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">][</span><span class="s2">&quot;locale&quot;</span><span class="p">][</span><span class="s2">&quot;languages&quot;</span><span class="p">]</span></div>
<div class="viewcode-block" id="keyboard_cmd"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.compose.keyboard_cmd">[docs]</a><span class="k">def</span> <span class="nf">keyboard_cmd</span><span class="p">(</span><span class="n">line</span><span class="p">,</span> <span class="n">layout</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; Update the keyboard line with the layout</span>
<span class="sd"> :param line: The keyboard ... line</span>
<span class="sd"> :type line: str</span>
<span class="sd"> :param settings: The keyboard layout</span>
<span class="sd"> :type settings: str</span>
<span class="sd"> Using pykickstart to process the line is the best way to make sure it</span>
<span class="sd"> is parsed correctly, and re-assembled for inclusion into the final kickstart</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">ks_version</span> <span class="o">=</span> <span class="n">makeVersion</span><span class="p">()</span>
<span class="n">ks</span> <span class="o">=</span> <span class="n">KickstartParser</span><span class="p">(</span><span class="n">ks_version</span><span class="p">,</span> <span class="n">errorsAreFatal</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">missingIncludeIsFatal</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="n">ks</span><span class="o">.</span><span class="n">readKickstartFromString</span><span class="p">(</span><span class="n">line</span><span class="p">)</span>
<span class="k">if</span> <span class="n">layout</span><span class="p">:</span>
<span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">keyboard</span><span class="o">.</span><span class="n">keyboard</span> <span class="o">=</span> <span class="n">layout</span>
<span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">keyboard</span><span class="o">.</span><span class="n">vc_keymap</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span>
<span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">keyboard</span><span class="o">.</span><span class="n">x_layouts</span> <span class="o">=</span> <span class="p">[]</span>
<span class="c1"># Converting back to a string includes a comment, return just the keyboard line</span>
<span class="k">return</span> <span class="nb">str</span><span class="p">(</span><span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">keyboard</span><span class="p">)</span><span class="o">.</span><span class="n">splitlines</span><span class="p">()[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span></div>
<div class="viewcode-block" id="get_keyboard_layout"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.compose.get_keyboard_layout">[docs]</a><span class="k">def</span> <span class="nf">get_keyboard_layout</span><span class="p">(</span><span class="n">recipe</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return the customizations.locale.keyboard list</span>
<span class="sd"> :param recipe: The recipe</span>
<span class="sd"> :type recipe: Recipe object</span>
<span class="sd"> :returns: The keyboard layout string</span>
<span class="sd"> :rtype: str</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="s2">&quot;customizations&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">recipe</span> <span class="ow">or</span> \
<span class="s2">&quot;locale&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">]</span> <span class="ow">or</span> \
<span class="s2">&quot;keyboard&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">][</span><span class="s2">&quot;locale&quot;</span><span class="p">]:</span>
<span class="k">return</span> <span class="p">[]</span>
<span class="k">return</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">][</span><span class="s2">&quot;locale&quot;</span><span class="p">][</span><span class="s2">&quot;keyboard&quot;</span><span class="p">]</span></div>
<div class="viewcode-block" id="firewall_cmd"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.compose.firewall_cmd">[docs]</a><span class="k">def</span> <span class="nf">firewall_cmd</span><span class="p">(</span><span class="n">line</span><span class="p">,</span> <span class="n">settings</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; Update the firewall line with the new ports and services</span>
<span class="sd"> :param line: The firewall ... line</span>
<span class="sd"> :type line: str</span>
<span class="sd"> :param settings: A dict with the list of services and ports to enable and disable</span>
<span class="sd"> :type settings: dict</span>
<span class="sd"> Using pykickstart to process the line is the best way to make sure it</span>
<span class="sd"> is parsed correctly, and re-assembled for inclusion into the final kickstart</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">ks_version</span> <span class="o">=</span> <span class="n">makeVersion</span><span class="p">()</span>
<span class="n">ks</span> <span class="o">=</span> <span class="n">KickstartParser</span><span class="p">(</span><span class="n">ks_version</span><span class="p">,</span> <span class="n">errorsAreFatal</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">missingIncludeIsFatal</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="n">ks</span><span class="o">.</span><span class="n">readKickstartFromString</span><span class="p">(</span><span class="n">line</span><span class="p">)</span>
<span class="c1"># Do not override firewall --disabled</span>
<span class="k">if</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">firewall</span><span class="o">.</span><span class="n">enabled</span> <span class="o">!=</span> <span class="kc">False</span> <span class="ow">and</span> <span class="n">settings</span><span class="p">:</span>
<span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">firewall</span><span class="o">.</span><span class="n">ports</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">settings</span><span class="p">[</span><span class="s2">&quot;ports&quot;</span><span class="p">]</span> <span class="o">+</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">firewall</span><span class="o">.</span><span class="n">ports</span><span class="p">))</span>
<span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">firewall</span><span class="o">.</span><span class="n">services</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">settings</span><span class="p">[</span><span class="s2">&quot;enabled&quot;</span><span class="p">]</span> <span class="o">+</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">firewall</span><span class="o">.</span><span class="n">services</span><span class="p">))</span>
<span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">firewall</span><span class="o">.</span><span class="n">remove_services</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">settings</span><span class="p">[</span><span class="s2">&quot;disabled&quot;</span><span class="p">]</span> <span class="o">+</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">firewall</span><span class="o">.</span><span class="n">remove_services</span><span class="p">))</span>
<span class="c1"># Converting back to a string includes a comment, return just the keyboard line</span>
<span class="k">return</span> <span class="nb">str</span><span class="p">(</span><span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">firewall</span><span class="p">)</span><span class="o">.</span><span class="n">splitlines</span><span class="p">()[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span></div>
<div class="viewcode-block" id="get_firewall_settings"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.compose.get_firewall_settings">[docs]</a><span class="k">def</span> <span class="nf">get_firewall_settings</span><span class="p">(</span><span class="n">recipe</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return the customizations.firewall settings</span>
<span class="sd"> :param recipe: The recipe</span>
<span class="sd"> :type recipe: Recipe object</span>
<span class="sd"> :returns: A dict of settings</span>
<span class="sd"> :rtype: dict</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">settings</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;ports&quot;</span><span class="p">:</span> <span class="p">[],</span> <span class="s2">&quot;enabled&quot;</span><span class="p">:</span> <span class="p">[],</span> <span class="s2">&quot;disabled&quot;</span><span class="p">:</span> <span class="p">[]}</span>
<span class="k">if</span> <span class="s2">&quot;customizations&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">recipe</span> <span class="ow">or</span> \
<span class="s2">&quot;firewall&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">]:</span>
<span class="k">return</span> <span class="n">settings</span>
<span class="n">settings</span><span class="p">[</span><span class="s2">&quot;ports&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">][</span><span class="s2">&quot;firewall&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;ports&quot;</span><span class="p">,</span> <span class="p">[])</span>
<span class="k">if</span> <span class="s2">&quot;services&quot;</span> <span class="ow">in</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">][</span><span class="s2">&quot;firewall&quot;</span><span class="p">]:</span>
<span class="n">settings</span><span class="p">[</span><span class="s2">&quot;enabled&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">][</span><span class="s2">&quot;firewall&quot;</span><span class="p">][</span><span class="s2">&quot;services&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;enabled&quot;</span><span class="p">,</span> <span class="p">[])</span>
<span class="n">settings</span><span class="p">[</span><span class="s2">&quot;disabled&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">][</span><span class="s2">&quot;firewall&quot;</span><span class="p">][</span><span class="s2">&quot;services&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;disabled&quot;</span><span class="p">,</span> <span class="p">[])</span>
<span class="k">return</span> <span class="n">settings</span></div>
<div class="viewcode-block" id="services_cmd"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.compose.services_cmd">[docs]</a><span class="k">def</span> <span class="nf">services_cmd</span><span class="p">(</span><span class="n">line</span><span class="p">,</span> <span class="n">settings</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; Update the services line with additional services to enable/disable</span>
<span class="sd"> :param line: The services ... line</span>
<span class="sd"> :type line: str</span>
<span class="sd"> :param settings: A dict with the list of services to enable and disable</span>
<span class="sd"> :type settings: dict</span>
<span class="sd"> Using pykickstart to process the line is the best way to make sure it</span>
<span class="sd"> is parsed correctly, and re-assembled for inclusion into the final kickstart</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># Empty services and no additional settings, return an empty string</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">line</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">settings</span><span class="p">[</span><span class="s2">&quot;enabled&quot;</span><span class="p">]</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">settings</span><span class="p">[</span><span class="s2">&quot;disabled&quot;</span><span class="p">]:</span>
<span class="k">return</span> <span class="s2">&quot;&quot;</span>
<span class="n">ks_version</span> <span class="o">=</span> <span class="n">makeVersion</span><span class="p">()</span>
<span class="n">ks</span> <span class="o">=</span> <span class="n">KickstartParser</span><span class="p">(</span><span class="n">ks_version</span><span class="p">,</span> <span class="n">errorsAreFatal</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">missingIncludeIsFatal</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="c1"># Allow passing in a &#39;default&#39; so that the enable/disable may be applied to it, without</span>
<span class="c1"># parsing it and emitting a kickstart error message</span>
<span class="k">if</span> <span class="n">line</span> <span class="o">!=</span> <span class="s2">&quot;services&quot;</span><span class="p">:</span>
<span class="n">ks</span><span class="o">.</span><span class="n">readKickstartFromString</span><span class="p">(</span><span class="n">line</span><span class="p">)</span>
<span class="c1"># Add to any existing services, removing any duplicates</span>
<span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">services</span><span class="o">.</span><span class="n">enabled</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">settings</span><span class="p">[</span><span class="s2">&quot;enabled&quot;</span><span class="p">]</span> <span class="o">+</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">services</span><span class="o">.</span><span class="n">enabled</span><span class="p">))</span>
<span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">services</span><span class="o">.</span><span class="n">disabled</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">settings</span><span class="p">[</span><span class="s2">&quot;disabled&quot;</span><span class="p">]</span> <span class="o">+</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">services</span><span class="o">.</span><span class="n">disabled</span><span class="p">))</span>
<span class="c1"># Converting back to a string includes a comment, return just the keyboard line</span>
<span class="k">return</span> <span class="nb">str</span><span class="p">(</span><span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">services</span><span class="p">)</span><span class="o">.</span><span class="n">splitlines</span><span class="p">()[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span></div>
<div class="viewcode-block" id="get_services"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.compose.get_services">[docs]</a><span class="k">def</span> <span class="nf">get_services</span><span class="p">(</span><span class="n">recipe</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return the customizations.services settings</span>
<span class="sd"> :param recipe: The recipe</span>
<span class="sd"> :type recipe: Recipe object</span>
<span class="sd"> :returns: A dict of settings</span>
<span class="sd"> :rtype: dict</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">settings</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;enabled&quot;</span><span class="p">:</span> <span class="p">[],</span> <span class="s2">&quot;disabled&quot;</span><span class="p">:</span> <span class="p">[]}</span>
<span class="k">if</span> <span class="s2">&quot;customizations&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">recipe</span> <span class="ow">or</span> \
<span class="s2">&quot;services&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">]:</span>
<span class="k">return</span> <span class="n">settings</span>
<span class="n">settings</span><span class="p">[</span><span class="s2">&quot;enabled&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">][</span><span class="s2">&quot;services&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;enabled&quot;</span><span class="p">,</span> <span class="p">[]))</span>
<span class="n">settings</span><span class="p">[</span><span class="s2">&quot;disabled&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">][</span><span class="s2">&quot;services&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;disabled&quot;</span><span class="p">,</span> <span class="p">[]))</span>
<span class="k">return</span> <span class="n">settings</span></div>
<div class="viewcode-block" id="get_default_services"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.compose.get_default_services">[docs]</a><span class="k">def</span> <span class="nf">get_default_services</span><span class="p">(</span><span class="n">recipe</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Get the default string for services, based on recipe</span>
<span class="sd"> :param recipe: The recipe</span>
<span class="sd"> :type recipe: Recipe object</span>
<span class="sd"> :returns: string with &quot;services&quot; or &quot;&quot;</span>
<span class="sd"> :rtype: str</span>
<span class="sd"> When no services have been selected we don&#39;t need to add anything to the kickstart</span>
<span class="sd"> so return an empty string. Otherwise return &quot;services&quot; which will be updated with</span>
<span class="sd"> the settings.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">services</span> <span class="o">=</span> <span class="n">get_services</span><span class="p">(</span><span class="n">recipe</span><span class="p">)</span>
<span class="k">if</span> <span class="n">services</span><span class="p">[</span><span class="s2">&quot;enabled&quot;</span><span class="p">]</span> <span class="ow">or</span> <span class="n">services</span><span class="p">[</span><span class="s2">&quot;disabled&quot;</span><span class="p">]:</span>
<span class="k">return</span> <span class="s2">&quot;services&quot;</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="s2">&quot;&quot;</span></div>
<div class="viewcode-block" id="customize_ks_template"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.compose.customize_ks_template">[docs]</a><span class="k">def</span> <span class="nf">customize_ks_template</span><span class="p">(</span><span class="n">ks_template</span><span class="p">,</span> <span class="n">recipe</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; Customize the kickstart template and return it</span>
<span class="sd"> :param ks_template: The kickstart template</span>
<span class="sd"> :type ks_template: str</span>
<span class="sd"> :param recipe:</span>
<span class="sd"> :type recipe: Recipe object</span>
<span class="sd"> Apply customizations to existing template commands, or add defaults for ones that are</span>
<span class="sd"> missing and required.</span>
<span class="sd"> Apply customizations.kernel.append to the bootloader argument in the template.</span>
<span class="sd"> Add bootloader line if it is missing.</span>
<span class="sd"> Add default timezone if needed. It does NOT replace an existing timezone entry</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># Commands to be modified [NEW-COMMAND-FUNC, NEW-VALUE, DEFAULT, REPLACE]</span>
<span class="c1"># The function is called with a kickstart command string and the value to replace</span>
<span class="c1"># The value is specific to the command, and is understood by the function</span>
<span class="c1"># The default is a complete kickstart command string, suitable for writing to the template</span>
<span class="c1"># If REPLACE is False it will not change an existing entry only add a missing one</span>
<span class="n">commands</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;bootloader&quot;</span><span class="p">:</span> <span class="p">[</span><span class="n">bootloader_append</span><span class="p">,</span>
<span class="n">get_kernel_append</span><span class="p">(</span><span class="n">recipe</span><span class="p">),</span>
<span class="s1">&#39;bootloader --location=none&#39;</span><span class="p">,</span> <span class="kc">True</span><span class="p">],</span>
<span class="s2">&quot;timezone&quot;</span><span class="p">:</span> <span class="p">[</span><span class="n">timezone_cmd</span><span class="p">,</span>
<span class="n">get_timezone_settings</span><span class="p">(</span><span class="n">recipe</span><span class="p">),</span>
<span class="s1">&#39;timezone UTC&#39;</span><span class="p">,</span> <span class="kc">False</span><span class="p">],</span>
<span class="s2">&quot;lang&quot;</span><span class="p">:</span> <span class="p">[</span><span class="n">lang_cmd</span><span class="p">,</span>
<span class="n">get_languages</span><span class="p">(</span><span class="n">recipe</span><span class="p">),</span>
<span class="s1">&#39;lang en_US.UTF-8&#39;</span><span class="p">,</span> <span class="kc">True</span><span class="p">],</span>
<span class="s2">&quot;keyboard&quot;</span><span class="p">:</span> <span class="p">[</span><span class="n">keyboard_cmd</span><span class="p">,</span>
<span class="n">get_keyboard_layout</span><span class="p">(</span><span class="n">recipe</span><span class="p">),</span>
<span class="s1">&#39;keyboard --xlayouts us --vckeymap us&#39;</span><span class="p">,</span> <span class="kc">True</span><span class="p">],</span>
<span class="s2">&quot;firewall&quot;</span><span class="p">:</span> <span class="p">[</span><span class="n">firewall_cmd</span><span class="p">,</span>
<span class="n">get_firewall_settings</span><span class="p">(</span><span class="n">recipe</span><span class="p">),</span>
<span class="s1">&#39;firewall --enabled&#39;</span><span class="p">,</span> <span class="kc">True</span><span class="p">],</span>
<span class="s2">&quot;services&quot;</span><span class="p">:</span> <span class="p">[</span><span class="n">services_cmd</span><span class="p">,</span>
<span class="n">get_services</span><span class="p">(</span><span class="n">recipe</span><span class="p">),</span>
<span class="n">get_default_services</span><span class="p">(</span><span class="n">recipe</span><span class="p">),</span> <span class="kc">True</span><span class="p">]</span>
<span class="p">}</span>
<span class="n">found</span> <span class="o">=</span> <span class="p">{}</span>
<span class="n">output</span> <span class="o">=</span> <span class="n">StringIO</span><span class="p">()</span>
<span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">ks_template</span><span class="o">.</span><span class="n">splitlines</span><span class="p">():</span>
<span class="k">for</span> <span class="n">cmd</span> <span class="ow">in</span> <span class="n">commands</span><span class="p">:</span>
<span class="p">(</span><span class="n">new_command</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">default</span><span class="p">,</span> <span class="n">replace</span><span class="p">)</span> <span class="o">=</span> <span class="n">commands</span><span class="p">[</span><span class="n">cmd</span><span class="p">]</span>
<span class="k">if</span> <span class="n">line</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="n">cmd</span><span class="p">):</span>
<span class="n">found</span><span class="p">[</span><span class="n">cmd</span><span class="p">]</span> <span class="o">=</span> <span class="kc">True</span>
<span class="k">if</span> <span class="n">value</span> <span class="ow">and</span> <span class="n">replace</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;Replacing </span><span class="si">%s</span><span class="s2"> with </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">cmd</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">new_command</span><span class="p">(</span><span class="n">line</span><span class="p">,</span> <span class="n">value</span><span class="p">),</span> <span class="n">file</span><span class="o">=</span><span class="n">output</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;Skipping </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">cmd</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">line</span><span class="p">,</span> <span class="n">file</span><span class="o">=</span><span class="n">output</span><span class="p">)</span>
<span class="k">break</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># No matches, write the line as-is</span>
<span class="nb">print</span><span class="p">(</span><span class="n">line</span><span class="p">,</span> <span class="n">file</span><span class="o">=</span><span class="n">output</span><span class="p">)</span>
<span class="c1"># Write out defaults for the ones not found</span>
<span class="c1"># These must go FIRST because the template still needs to have the packages added</span>
<span class="n">defaults</span> <span class="o">=</span> <span class="n">StringIO</span><span class="p">()</span>
<span class="k">for</span> <span class="n">cmd</span> <span class="ow">in</span> <span class="n">commands</span><span class="p">:</span>
<span class="k">if</span> <span class="n">cmd</span> <span class="ow">in</span> <span class="n">found</span><span class="p">:</span>
<span class="k">continue</span>
<span class="p">(</span><span class="n">new_command</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">default</span><span class="p">,</span> <span class="n">_</span><span class="p">)</span> <span class="o">=</span> <span class="n">commands</span><span class="p">[</span><span class="n">cmd</span><span class="p">]</span>
<span class="k">if</span> <span class="n">value</span> <span class="ow">and</span> <span class="n">default</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;Setting </span><span class="si">%s</span><span class="s2"> to use </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">cmd</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">new_command</span><span class="p">(</span><span class="n">default</span><span class="p">,</span> <span class="n">value</span><span class="p">),</span> <span class="n">file</span><span class="o">=</span><span class="n">defaults</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">default</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;Setting </span><span class="si">%s</span><span class="s2"> to </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">cmd</span><span class="p">,</span> <span class="n">default</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">default</span><span class="p">,</span> <span class="n">file</span><span class="o">=</span><span class="n">defaults</span><span class="p">)</span>
<span class="k">return</span> <span class="n">defaults</span><span class="o">.</span><span class="n">getvalue</span><span class="p">()</span> <span class="o">+</span> <span class="n">output</span><span class="o">.</span><span class="n">getvalue</span><span class="p">()</span></div>
<div class="viewcode-block" id="write_ks_root"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.compose.write_ks_root">[docs]</a><span class="k">def</span> <span class="nf">write_ks_root</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="n">user</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; Write kickstart root password and sshkey entry</span>
@ -387,6 +748,10 @@
<span class="k">return</span>
<span class="n">customizations</span> <span class="o">=</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">]</span>
<span class="c1"># allow customizations to be incorrectly specified as [[customizations]] instead of [customizations]</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">customizations</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span>
<span class="n">customizations</span> <span class="o">=</span> <span class="n">customizations</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="k">if</span> <span class="s2">&quot;hostname&quot;</span> <span class="ow">in</span> <span class="n">customizations</span><span class="p">:</span>
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">&quot;network --hostname=</span><span class="si">%s</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">customizations</span><span class="p">[</span><span class="s2">&quot;hostname&quot;</span><span class="p">])</span>
@ -428,6 +793,40 @@
<span class="k">if</span> <span class="ow">not</span> <span class="n">wrote_rootpw</span><span class="p">:</span>
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s1">&#39;rootpw --lock</span><span class="se">\n</span><span class="s1">&#39;</span><span class="p">)</span></div>
<div class="viewcode-block" id="get_extra_pkgs"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.compose.get_extra_pkgs">[docs]</a><span class="k">def</span> <span class="nf">get_extra_pkgs</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">share_dir</span><span class="p">,</span> <span class="n">compose_type</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return extra packages needed for the output type</span>
<span class="sd"> :param dbo: dnf base object</span>
<span class="sd"> :type dbo: dnf.Base</span>
<span class="sd"> :param share_dir: Path to the top level share directory</span>
<span class="sd"> :type share_dir: str</span>
<span class="sd"> :param compose_type: The type of output to create from the recipe</span>
<span class="sd"> :type compose_type: str</span>
<span class="sd"> :returns: List of package names (name only, not NEVRA)</span>
<span class="sd"> :rtype: list</span>
<span class="sd"> Currently this is only needed by live-iso, it reads ./live/live-install.tmpl and</span>
<span class="sd"> processes only the installpkg lines. It lists the packages needed to complete creation of the</span>
<span class="sd"> iso using the templates such as x86.tmpl</span>
<span class="sd"> Keep in mind that the live-install.tmpl is shared between livemedia-creator and lorax-composer,</span>
<span class="sd"> even though the results are applied differently.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="n">compose_type</span> <span class="o">!=</span> <span class="s2">&quot;live-iso&quot;</span><span class="p">:</span>
<span class="k">return</span> <span class="p">[]</span>
<span class="c1"># get the arch information to pass to the runner</span>
<span class="n">arch</span> <span class="o">=</span> <span class="n">ArchData</span><span class="p">(</span><span class="n">get_buildarch</span><span class="p">(</span><span class="n">dbo</span><span class="p">))</span>
<span class="n">defaults</span> <span class="o">=</span> <span class="n">DataHolder</span><span class="p">(</span><span class="n">basearch</span><span class="o">=</span><span class="n">arch</span><span class="o">.</span><span class="n">basearch</span><span class="p">)</span>
<span class="n">templatedir</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">find_templates</span><span class="p">(</span><span class="n">share_dir</span><span class="p">),</span> <span class="s2">&quot;live&quot;</span><span class="p">)</span>
<span class="n">runner</span> <span class="o">=</span> <span class="n">LiveTemplateRunner</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">templatedir</span><span class="o">=</span><span class="n">templatedir</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="n">defaults</span><span class="p">)</span>
<span class="n">runner</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="s2">&quot;live-install.tmpl&quot;</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;extra pkgs = </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">runner</span><span class="o">.</span><span class="n">pkgs</span><span class="p">)</span>
<span class="k">return</span> <span class="n">runner</span><span class="o">.</span><span class="n">pkgnames</span></div>
<div class="viewcode-block" id="start_build"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.compose.start_build">[docs]</a><span class="k">def</span> <span class="nf">start_build</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">dnflock</span><span class="p">,</span> <span class="n">gitlock</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">recipe_name</span><span class="p">,</span> <span class="n">compose_type</span><span class="p">,</span> <span class="n">test_mode</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; Start the build</span>
@ -449,15 +848,22 @@
<span class="k">if</span> <span class="n">compose_type</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">compose_types</span><span class="p">(</span><span class="n">share_dir</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">&quot;Invalid compose type (</span><span class="si">%s</span><span class="s2">), must be one of </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">compose_type</span><span class="p">,</span> <span class="n">compose_types</span><span class="p">(</span><span class="n">share_dir</span><span class="p">)))</span>
<span class="c1"># Some image types (live-iso) need extra packages for composer to execute the output template</span>
<span class="k">with</span> <span class="n">dnflock</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
<span class="n">extra_pkgs</span> <span class="o">=</span> <span class="n">get_extra_pkgs</span><span class="p">(</span><span class="n">dnflock</span><span class="o">.</span><span class="n">dbo</span><span class="p">,</span> <span class="n">share_dir</span><span class="p">,</span> <span class="n">compose_type</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;Extra packages needed for </span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">compose_type</span><span class="p">,</span> <span class="n">extra_pkgs</span><span class="p">)</span>
<span class="k">with</span> <span class="n">gitlock</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
<span class="p">(</span><span class="n">commit_id</span><span class="p">,</span> <span class="n">recipe</span><span class="p">)</span> <span class="o">=</span> <span class="n">read_recipe_and_id</span><span class="p">(</span><span class="n">gitlock</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">recipe_name</span><span class="p">)</span>
<span class="c1"># Combine modules and packages and depsolve the list</span>
<span class="c1"># TODO include the version/glob in the depsolving</span>
<span class="n">module_nver</span> <span class="o">=</span> <span class="n">recipe</span><span class="o">.</span><span class="n">module_nver</span>
<span class="n">package_nver</span> <span class="o">=</span> <span class="n">recipe</span><span class="o">.</span><span class="n">package_nver</span>
<span class="n">package_nver</span><span class="o">.</span><span class="n">extend</span><span class="p">([(</span><span class="n">name</span><span class="p">,</span> <span class="s1">&#39;*&#39;</span><span class="p">)</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">extra_pkgs</span><span class="p">])</span>
<span class="n">projects</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">module_nver</span><span class="o">+</span><span class="n">package_nver</span><span class="p">),</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="n">p</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
<span class="n">deps</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;depsolving </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;name&quot;</span><span class="p">])</span>
<span class="k">try</span><span class="p">:</span>
<span class="c1"># This can possibly update repodata and reset the YumBase object.</span>
<span class="k">with</span> <span class="n">dnflock</span><span class="o">.</span><span class="n">lock_check</span><span class="p">:</span>
@ -485,9 +891,7 @@
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;installed_size = </span><span class="si">%d</span><span class="s2">, template_size=</span><span class="si">%d</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">installed_size</span><span class="p">,</span> <span class="n">template_size</span><span class="p">)</span>
<span class="c1"># Minimum LMC disk size is 1GiB, and anaconda bumps the estimated size up by 10% (which doesn&#39;t always work).</span>
<span class="c1"># XXX BUT Anaconda has a bug, it won&#39;t execute a kickstart on a disk smaller than 3000 MB</span>
<span class="c1"># XXX There is an upstream patch pending, but until then, use that as the minimum</span>
<span class="n">installed_size</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="mf">3e9</span><span class="p">,</span> <span class="nb">int</span><span class="p">((</span><span class="n">installed_size</span><span class="o">+</span><span class="n">template_size</span><span class="p">)))</span> <span class="o">*</span> <span class="mf">1.2</span>
<span class="n">installed_size</span> <span class="o">=</span> <span class="nb">int</span><span class="p">((</span><span class="n">installed_size</span><span class="o">+</span><span class="n">template_size</span><span class="p">))</span> <span class="o">*</span> <span class="mf">1.2</span>
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;/ partition size = </span><span class="si">%d</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">installed_size</span><span class="p">)</span>
<span class="c1"># Create the results directory</span>
@ -524,6 +928,9 @@
<span class="k">if</span> <span class="ow">not</span> <span class="n">repos</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">&quot;No enabled repos, canceling build.&quot;</span><span class="p">)</span>
<span class="c1"># Create the git rpms, if any, and return the path to the repo under results_dir</span>
<span class="n">gitrpm_repo</span> <span class="o">=</span> <span class="n">create_gitrpm_repo</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="n">recipe</span><span class="p">)</span>
<span class="c1"># Create the final kickstart with repos and package list</span>
<span class="n">ks_path</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="s2">&quot;final-kickstart.ks&quot;</span><span class="p">)</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">ks_path</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
@ -535,6 +942,10 @@
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;repo composer-</span><span class="si">%s</span><span class="s2"> = </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">idx</span><span class="p">,</span> <span class="n">ks_repo</span><span class="p">)</span>
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s1">&#39;repo --name=&quot;composer-</span><span class="si">%s</span><span class="s1">&quot; </span><span class="si">%s</span><span class="se">\n</span><span class="s1">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">idx</span><span class="p">,</span> <span class="n">ks_repo</span><span class="p">))</span>
<span class="k">if</span> <span class="n">gitrpm_repo</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;repo gitrpms = </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">gitrpm_repo</span><span class="p">)</span>
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s1">&#39;repo --name=&quot;gitrpms&quot; --baseurl=&quot;file://</span><span class="si">%s</span><span class="s1">&quot;</span><span class="se">\n</span><span class="s1">&#39;</span> <span class="o">%</span> <span class="n">gitrpm_repo</span><span class="p">)</span>
<span class="c1"># Setup the disk for booting</span>
<span class="c1"># TODO Add GPT and UEFI boot support</span>
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s1">&#39;clearpart --all --initlabel</span><span class="se">\n</span><span class="s1">&#39;</span><span class="p">)</span>
@ -542,12 +953,20 @@
<span class="c1"># Write the root partition and it&#39;s size in MB (rounded up)</span>
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s1">&#39;part / --size=</span><span class="si">%d</span><span class="se">\n</span><span class="s1">&#39;</span> <span class="o">%</span> <span class="n">ceil</span><span class="p">(</span><span class="n">installed_size</span> <span class="o">/</span> <span class="mi">1024</span><span class="o">**</span><span class="mi">2</span><span class="p">))</span>
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">ks_template</span><span class="p">)</span>
<span class="c1"># Some customizations modify the template before writing it</span>
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">customize_ks_template</span><span class="p">(</span><span class="n">ks_template</span><span class="p">,</span> <span class="n">recipe</span><span class="p">))</span>
<span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="n">deps</span><span class="p">:</span>
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">dep_nevra</span><span class="p">(</span><span class="n">d</span><span class="p">)</span><span class="o">+</span><span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="c1"># Include the rpms from the gitrpm repo directory</span>
<span class="k">if</span> <span class="n">gitrpm_repo</span><span class="p">:</span>
<span class="k">for</span> <span class="n">rpm</span> <span class="ow">in</span> <span class="n">glob</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">gitrpm_repo</span><span class="p">,</span> <span class="s2">&quot;*.rpm&quot;</span><span class="p">)):</span>
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">rpm</span><span class="p">)[:</span><span class="o">-</span><span class="mi">4</span><span class="p">]</span><span class="o">+</span><span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">%e</span><span class="s2">nd</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="c1"># Other customizations can be appended to the kickstart</span>
<span class="n">add_customizations</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="n">recipe</span><span class="p">)</span>
<span class="c1"># Setup the config to pass to novirt_install</span>
@ -565,10 +984,15 @@
<span class="n">cfg_args</span><span class="p">[</span><span class="s2">&quot;project&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">os_release</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;NAME&quot;</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">)</span>
<span class="n">cfg_args</span><span class="p">[</span><span class="s2">&quot;releasever&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">os_release</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;VERSION_ID&quot;</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">)</span>
<span class="n">cfg_args</span><span class="p">[</span><span class="s2">&quot;volid&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span>
<span class="n">cfg_args</span><span class="p">[</span><span class="s2">&quot;extra_boot_args&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">get_kernel_append</span><span class="p">(</span><span class="n">recipe</span><span class="p">)</span>
<span class="k">if</span> <span class="s2">&quot;compression&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">cfg_args</span><span class="p">:</span>
<span class="n">cfg_args</span><span class="p">[</span><span class="s2">&quot;compression&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="s2">&quot;xz&quot;</span>
<span class="k">if</span> <span class="s2">&quot;compress_args&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">cfg_args</span><span class="p">:</span>
<span class="n">cfg_args</span><span class="p">[</span><span class="s2">&quot;compress_args&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">cfg_args</span><span class="o">.</span><span class="n">update</span><span class="p">({</span>
<span class="s2">&quot;compression&quot;</span><span class="p">:</span> <span class="s2">&quot;xz&quot;</span><span class="p">,</span>
<span class="s2">&quot;compress_args&quot;</span><span class="p">:</span> <span class="p">[],</span>
<span class="s2">&quot;ks&quot;</span><span class="p">:</span> <span class="p">[</span><span class="n">ks_path</span><span class="p">],</span>
<span class="s2">&quot;logfile&quot;</span><span class="p">:</span> <span class="n">log_dir</span><span class="p">,</span>
<span class="s2">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">60</span><span class="p">,</span> <span class="c1"># 60 minute timeout</span>
@ -613,6 +1037,7 @@
<span class="s2">&quot;make_appliance&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ami&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
<span class="s2">&quot;make_tar_disk&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_pxe_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ostree_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_oci&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
@ -620,9 +1045,11 @@
<span class="s2">&quot;ostree&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_keep_size&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_size&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_size_align&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_type&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="c1"># False instead of None because of TOML</span>
<span class="s2">&quot;qemu_args&quot;</span><span class="p">:</span> <span class="p">[],</span>
<span class="s2">&quot;image_name&quot;</span><span class="p">:</span> <span class="n">default_image_name</span><span class="p">(</span><span class="s2">&quot;xz&quot;</span><span class="p">,</span> <span class="s2">&quot;root.tar&quot;</span><span class="p">),</span>
<span class="s2">&quot;tar_disk_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="s2">&quot;image_only&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
<span class="s2">&quot;app_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="s2">&quot;app_template&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
@ -634,6 +1061,7 @@
<span class="s2">&quot;make_appliance&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ami&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar_disk&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_pxe_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ostree_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_oci&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
@ -641,9 +1069,11 @@
<span class="s2">&quot;ostree&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_keep_size&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_size&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_size_align&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_type&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="c1"># False instead of None because of TOML</span>
<span class="s2">&quot;qemu_args&quot;</span><span class="p">:</span> <span class="p">[],</span>
<span class="s2">&quot;image_name&quot;</span><span class="p">:</span> <span class="s2">&quot;live.iso&quot;</span><span class="p">,</span>
<span class="s2">&quot;tar_disk_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="s2">&quot;fs_label&quot;</span><span class="p">:</span> <span class="s2">&quot;Anaconda&quot;</span><span class="p">,</span> <span class="c1"># Live booting may expect this to be &#39;Anaconda&#39;</span>
<span class="s2">&quot;image_only&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;app_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
@ -658,6 +1088,7 @@
<span class="s2">&quot;make_appliance&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ami&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar_disk&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_pxe_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ostree_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_oci&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
@ -665,9 +1096,11 @@
<span class="s2">&quot;ostree&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_keep_size&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_size&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_size_align&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_type&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="c1"># False instead of None because of TOML</span>
<span class="s2">&quot;qemu_args&quot;</span><span class="p">:</span> <span class="p">[],</span>
<span class="s2">&quot;image_name&quot;</span><span class="p">:</span> <span class="s2">&quot;disk.img&quot;</span><span class="p">,</span>
<span class="s2">&quot;tar_disk_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="s2">&quot;fs_label&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
<span class="s2">&quot;image_only&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
<span class="s2">&quot;app_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
@ -680,6 +1113,7 @@
<span class="s2">&quot;make_appliance&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ami&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar_disk&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_pxe_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ostree_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_oci&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
@ -687,9 +1121,11 @@
<span class="s2">&quot;ostree&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_keep_size&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_size&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_size_align&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_type&quot;</span><span class="p">:</span> <span class="s2">&quot;qcow2&quot;</span><span class="p">,</span>
<span class="s2">&quot;qemu_args&quot;</span><span class="p">:</span> <span class="p">[],</span>
<span class="s2">&quot;image_name&quot;</span><span class="p">:</span> <span class="s2">&quot;disk.qcow2&quot;</span><span class="p">,</span>
<span class="s2">&quot;tar_disk_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="s2">&quot;fs_label&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
<span class="s2">&quot;image_only&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
<span class="s2">&quot;app_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
@ -702,6 +1138,7 @@
<span class="s2">&quot;make_appliance&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ami&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar_disk&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_pxe_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ostree_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_oci&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
@ -709,9 +1146,11 @@
<span class="s2">&quot;ostree&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_keep_size&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_size&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_size_align&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_type&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="c1"># False instead of None because of TOML</span>
<span class="s2">&quot;qemu_args&quot;</span><span class="p">:</span> <span class="p">[],</span>
<span class="s2">&quot;image_name&quot;</span><span class="p">:</span> <span class="s2">&quot;filesystem.img&quot;</span><span class="p">,</span>
<span class="s2">&quot;tar_disk_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="s2">&quot;fs_label&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
<span class="s2">&quot;image_only&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
<span class="s2">&quot;app_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
@ -724,6 +1163,7 @@
<span class="s2">&quot;make_appliance&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ami&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar_disk&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_pxe_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ostree_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_oci&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
@ -731,9 +1171,11 @@
<span class="s2">&quot;ostree&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_keep_size&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_size&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_size_align&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_type&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;qemu_args&quot;</span><span class="p">:</span> <span class="p">[],</span>
<span class="s2">&quot;image_name&quot;</span><span class="p">:</span> <span class="s2">&quot;disk.ami&quot;</span><span class="p">,</span>
<span class="s2">&quot;tar_disk_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="s2">&quot;fs_label&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
<span class="s2">&quot;image_only&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
<span class="s2">&quot;app_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
@ -746,6 +1188,7 @@
<span class="s2">&quot;make_appliance&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ami&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar_disk&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_pxe_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ostree_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_oci&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
@ -753,9 +1196,11 @@
<span class="s2">&quot;ostree&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_keep_size&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_size&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_size_align&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_type&quot;</span><span class="p">:</span> <span class="s2">&quot;vpc&quot;</span><span class="p">,</span>
<span class="s2">&quot;qemu_args&quot;</span><span class="p">:</span> <span class="p">[</span><span class="s2">&quot;-o&quot;</span><span class="p">,</span> <span class="s2">&quot;subformat=fixed,force_size&quot;</span><span class="p">],</span>
<span class="s2">&quot;image_name&quot;</span><span class="p">:</span> <span class="s2">&quot;disk.vhd&quot;</span><span class="p">,</span>
<span class="s2">&quot;tar_disk_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="s2">&quot;fs_label&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
<span class="s2">&quot;image_only&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
<span class="s2">&quot;app_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
@ -768,6 +1213,7 @@
<span class="s2">&quot;make_appliance&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ami&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar_disk&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_pxe_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ostree_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_oci&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
@ -775,9 +1221,11 @@
<span class="s2">&quot;ostree&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_keep_size&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_size&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_size_align&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_type&quot;</span><span class="p">:</span> <span class="s2">&quot;vmdk&quot;</span><span class="p">,</span>
<span class="s2">&quot;qemu_args&quot;</span><span class="p">:</span> <span class="p">[],</span>
<span class="s2">&quot;image_name&quot;</span><span class="p">:</span> <span class="s2">&quot;disk.vmdk&quot;</span><span class="p">,</span>
<span class="s2">&quot;tar_disk_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="s2">&quot;fs_label&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
<span class="s2">&quot;image_only&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
<span class="s2">&quot;app_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
@ -790,6 +1238,7 @@
<span class="s2">&quot;make_appliance&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ami&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar_disk&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_pxe_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ostree_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_oci&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
@ -797,9 +1246,88 @@
<span class="s2">&quot;ostree&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_keep_size&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_size&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_size_align&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_type&quot;</span><span class="p">:</span> <span class="s2">&quot;qcow2&quot;</span><span class="p">,</span>
<span class="s2">&quot;qemu_args&quot;</span><span class="p">:</span> <span class="p">[],</span>
<span class="s2">&quot;image_name&quot;</span><span class="p">:</span> <span class="s2">&quot;disk.qcow2&quot;</span><span class="p">,</span>
<span class="s2">&quot;tar_disk_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="s2">&quot;fs_label&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
<span class="s2">&quot;image_only&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
<span class="s2">&quot;app_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="s2">&quot;app_template&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="s2">&quot;app_file&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="p">},</span>
<span class="s2">&quot;google&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;make_iso&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_disk&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
<span class="s2">&quot;make_fsimage&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_appliance&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ami&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar_disk&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
<span class="s2">&quot;make_pxe_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ostree_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_oci&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_vagrant&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;ostree&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_keep_size&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_size&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_size_align&quot;</span><span class="p">:</span> <span class="mi">1024</span><span class="p">,</span>
<span class="s2">&quot;image_type&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="c1"># False instead of None because of TOML</span>
<span class="s2">&quot;qemu_args&quot;</span><span class="p">:</span> <span class="p">[],</span>
<span class="s2">&quot;image_name&quot;</span><span class="p">:</span> <span class="s2">&quot;disk.tar.gz&quot;</span><span class="p">,</span>
<span class="s2">&quot;tar_disk_name&quot;</span><span class="p">:</span> <span class="s2">&quot;disk.raw&quot;</span><span class="p">,</span>
<span class="s2">&quot;compression&quot;</span><span class="p">:</span> <span class="s2">&quot;gzip&quot;</span><span class="p">,</span>
<span class="s2">&quot;compress_args&quot;</span><span class="p">:</span> <span class="p">[</span><span class="s2">&quot;-9&quot;</span><span class="p">],</span>
<span class="s2">&quot;fs_label&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
<span class="s2">&quot;image_only&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
<span class="s2">&quot;app_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="s2">&quot;app_template&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="s2">&quot;app_file&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="p">},</span>
<span class="s2">&quot;hyper-v&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;make_iso&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_disk&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
<span class="s2">&quot;make_fsimage&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_appliance&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ami&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar_disk&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_pxe_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ostree_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_oci&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_vagrant&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;ostree&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_keep_size&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_size&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_size_align&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_type&quot;</span><span class="p">:</span> <span class="s2">&quot;vhdx&quot;</span><span class="p">,</span>
<span class="s2">&quot;qemu_args&quot;</span><span class="p">:</span> <span class="p">[],</span>
<span class="s2">&quot;image_name&quot;</span><span class="p">:</span> <span class="s2">&quot;disk.vhdx&quot;</span><span class="p">,</span>
<span class="s2">&quot;tar_disk_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="s2">&quot;fs_label&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
<span class="s2">&quot;image_only&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
<span class="s2">&quot;app_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="s2">&quot;app_template&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="s2">&quot;app_file&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="p">},</span>
<span class="s2">&quot;alibaba&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;make_iso&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_disk&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
<span class="s2">&quot;make_fsimage&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_appliance&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ami&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_tar_disk&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_pxe_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_ostree_live&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_oci&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;make_vagrant&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;ostree&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_keep_size&quot;</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
<span class="s2">&quot;live_rootfs_size&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_size_align&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;image_type&quot;</span><span class="p">:</span> <span class="s2">&quot;qcow2&quot;</span><span class="p">,</span>
<span class="s2">&quot;qemu_args&quot;</span><span class="p">:</span> <span class="p">[],</span>
<span class="s2">&quot;image_name&quot;</span><span class="p">:</span> <span class="s2">&quot;disk.qcow2&quot;</span><span class="p">,</span>
<span class="s2">&quot;tar_disk_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="s2">&quot;fs_label&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
<span class="s2">&quot;image_only&quot;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
<span class="s2">&quot;app_name&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
@ -867,7 +1395,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.api.config &mdash; Lorax 29.21 documentation</title>
<title>pylorax.api.config &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -328,7 +328,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.api.crossdomain &mdash; Lorax 29.21 documentation</title>
<title>pylorax.api.crossdomain &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -254,7 +254,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.api.dnfbase &mdash; Lorax 29.21 documentation</title>
<title>pylorax.api.dnfbase &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -292,6 +292,38 @@
<span class="n">shutil</span><span class="o">.</span><span class="n">copy2</span><span class="p">(</span><span class="n">repo_file</span><span class="p">,</span> <span class="n">repodir</span><span class="p">)</span>
<span class="n">dbo</span><span class="o">.</span><span class="n">read_all_repos</span><span class="p">()</span>
<span class="c1"># Remove any duplicate repo entries. These can cause problems with Anaconda, which will fail</span>
<span class="c1"># with space problems.</span>
<span class="n">repos</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">id</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">dbo</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">iter_enabled</span><span class="p">()))</span>
<span class="n">seen</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;baseurl&quot;</span><span class="p">:</span> <span class="p">[],</span> <span class="s2">&quot;mirrorlist&quot;</span><span class="p">:</span> <span class="p">[],</span> <span class="s2">&quot;metalink&quot;</span><span class="p">:</span> <span class="p">[]}</span>
<span class="k">for</span> <span class="n">source_name</span> <span class="ow">in</span> <span class="n">repos</span><span class="p">:</span>
<span class="n">remove</span> <span class="o">=</span> <span class="kc">False</span>
<span class="n">repo</span> <span class="o">=</span> <span class="n">dbo</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">source_name</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="k">if</span> <span class="n">repo</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s2">&quot;repo </span><span class="si">%s</span><span class="s2"> vanished while removing duplicates&quot;</span><span class="p">,</span> <span class="n">source_name</span><span class="p">)</span>
<span class="k">continue</span>
<span class="k">if</span> <span class="n">repo</span><span class="o">.</span><span class="n">baseurl</span><span class="p">:</span>
<span class="k">if</span> <span class="n">repo</span><span class="o">.</span><span class="n">baseurl</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">in</span> <span class="n">seen</span><span class="p">[</span><span class="s2">&quot;baseurl&quot;</span><span class="p">]:</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Removing duplicate repo: </span><span class="si">%s</span><span class="s2"> baseurl=</span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">source_name</span><span class="p">,</span> <span class="n">repo</span><span class="o">.</span><span class="n">baseurl</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="n">remove</span> <span class="o">=</span> <span class="kc">True</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">seen</span><span class="p">[</span><span class="s2">&quot;baseurl&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">repo</span><span class="o">.</span><span class="n">baseurl</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="k">elif</span> <span class="n">repo</span><span class="o">.</span><span class="n">mirrorlist</span><span class="p">:</span>
<span class="k">if</span> <span class="n">repo</span><span class="o">.</span><span class="n">mirrorlist</span> <span class="ow">in</span> <span class="n">seen</span><span class="p">[</span><span class="s2">&quot;mirrorlist&quot;</span><span class="p">]:</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Removing duplicate repo: </span><span class="si">%s</span><span class="s2"> mirrorlist=</span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">source_name</span><span class="p">,</span> <span class="n">repo</span><span class="o">.</span><span class="n">mirrorlist</span><span class="p">)</span>
<span class="n">remove</span> <span class="o">=</span> <span class="kc">True</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">seen</span><span class="p">[</span><span class="s2">&quot;mirrorlist&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">repo</span><span class="o">.</span><span class="n">mirrorlist</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">repo</span><span class="o">.</span><span class="n">metalink</span><span class="p">:</span>
<span class="k">if</span> <span class="n">repo</span><span class="o">.</span><span class="n">metalink</span> <span class="ow">in</span> <span class="n">seen</span><span class="p">[</span><span class="s2">&quot;metalink&quot;</span><span class="p">]:</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Removing duplicate repo: </span><span class="si">%s</span><span class="s2"> metalink=</span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">source_name</span><span class="p">,</span> <span class="n">repo</span><span class="o">.</span><span class="n">metalink</span><span class="p">)</span>
<span class="n">remove</span> <span class="o">=</span> <span class="kc">True</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">seen</span><span class="p">[</span><span class="s2">&quot;metalink&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">repo</span><span class="o">.</span><span class="n">metalink</span><span class="p">)</span>
<span class="k">if</span> <span class="n">remove</span><span class="p">:</span>
<span class="k">del</span> <span class="n">dbo</span><span class="o">.</span><span class="n">repos</span><span class="p">[</span><span class="n">source_name</span><span class="p">]</span>
<span class="c1"># Update the metadata from the enabled repos to speed up later operations</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Updating repository metadata&quot;</span><span class="p">)</span>
<span class="k">try</span><span class="p">:</span>
@ -339,7 +371,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -0,0 +1,438 @@
<!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.api.gitrpm &mdash; Lorax 29.28 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" />
<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">
29.28
</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>
<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"><a class="reference internal" href="../../../modules.html">src</a></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="../../index.html">Module code</a> &raquo;</li>
<li><a href="../../pylorax.html">pylorax</a> &raquo;</li>
<li>pylorax.api.gitrpm</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<h1>Source code for pylorax.api.gitrpm</h1><div class="highlight"><pre>
<span></span><span class="c1"># Copyright (C) 2019 Red Hat, Inc.</span>
<span class="c1">#</span>
<span class="c1"># This program is free software; you can redistribute it and/or modify</span>
<span class="c1"># it under the terms of the GNU General Public License as published by</span>
<span class="c1"># the Free Software Foundation; either version 2 of the License, or</span>
<span class="c1"># (at your option) any later version.</span>
<span class="c1">#</span>
<span class="c1"># This program is distributed in the hope that it will be useful,</span>
<span class="c1"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<span class="c1"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
<span class="c1"># GNU General Public License for more details.</span>
<span class="c1">#</span>
<span class="c1"># You should have received a copy of the GNU General Public License</span>
<span class="c1"># along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
<span class="c1">#</span>
<span class="sd">&quot;&quot;&quot; Clone a git repository and package it as an rpm</span>
<span class="sd">This module contains functions for cloning a git repo, creating a tar archive of</span>
<span class="sd">the selected commit, branch, or tag, and packaging the files into an rpm that will</span>
<span class="sd">be installed by anaconda when creating the image.</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">import</span> <span class="nn">logging</span>
<span class="n">log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">&quot;lorax-composer&quot;</span><span class="p">)</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">from</span> <span class="nn">rpmfluff</span> <span class="k">import</span> <span class="n">SimpleRpmBuild</span>
<span class="kn">import</span> <span class="nn">shutil</span>
<span class="kn">import</span> <span class="nn">subprocess</span>
<span class="kn">import</span> <span class="nn">tempfile</span>
<span class="kn">import</span> <span class="nn">time</span>
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="k">import</span> <span class="n">joinpaths</span>
<div class="viewcode-block" id="get_repo_description"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.gitrpm.get_repo_description">[docs]</a><span class="k">def</span> <span class="nf">get_repo_description</span><span class="p">(</span><span class="n">gitRepo</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; Return a description including the git repo and reference</span>
<span class="sd"> :param gitRepo: A dict with the repository details</span>
<span class="sd"> :type gitRepo: dict</span>
<span class="sd"> :returns: A string with the git repo url and reference</span>
<span class="sd"> :rtype: str</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="s2">&quot;Created from </span><span class="si">%s</span><span class="s2">, reference &#39;</span><span class="si">%s</span><span class="s2">&#39;, on </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">gitRepo</span><span class="p">[</span><span class="s2">&quot;repo&quot;</span><span class="p">],</span> <span class="n">gitRepo</span><span class="p">[</span><span class="s2">&quot;ref&quot;</span><span class="p">],</span> <span class="n">time</span><span class="o">.</span><span class="n">ctime</span><span class="p">())</span></div>
<div class="viewcode-block" id="GitArchiveTarball"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.gitrpm.GitArchiveTarball">[docs]</a><span class="k">class</span> <span class="nc">GitArchiveTarball</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;Create a git archive of the selected git repo and reference&quot;&quot;&quot;</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">gitRepo</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_gitRepo</span> <span class="o">=</span> <span class="n">gitRepo</span>
<span class="bp">self</span><span class="o">.</span><span class="n">sourceName</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_gitRepo</span><span class="p">[</span><span class="s2">&quot;rpmname&quot;</span><span class="p">]</span><span class="o">+</span><span class="s2">&quot;.tar.xz&quot;</span>
<div class="viewcode-block" id="GitArchiveTarball.write_file"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.gitrpm.GitArchiveTarball.write_file">[docs]</a> <span class="k">def</span> <span class="nf">write_file</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sourcesDir</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; Create the tar archive</span>
<span class="sd"> :param sourcesDir: Path to use for creating the archive</span>
<span class="sd"> :type sourcesDir: str</span>
<span class="sd"> This clones the git repository and creates a git archive from the specified reference.</span>
<span class="sd"> The result is in RPMNAME.tar.xz under the sourcesDir</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># Clone the repository into a temporary location</span>
<span class="n">cmd</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;git&quot;</span><span class="p">,</span> <span class="s2">&quot;clone&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_gitRepo</span><span class="p">[</span><span class="s2">&quot;repo&quot;</span><span class="p">],</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">sourcesDir</span><span class="p">,</span> <span class="s2">&quot;gitrepo&quot;</span><span class="p">)]</span>
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="n">cmd</span><span class="p">)</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">subprocess</span><span class="o">.</span><span class="n">check_output</span><span class="p">(</span><span class="n">cmd</span><span class="p">)</span>
<span class="k">except</span> <span class="n">subprocess</span><span class="o">.</span><span class="n">CalledProcessError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;Failed to clone </span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_gitRepo</span><span class="p">[</span><span class="s2">&quot;repo&quot;</span><span class="p">],</span> <span class="n">e</span><span class="o">.</span><span class="n">output</span><span class="p">)</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">&quot;Failed to clone </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">_gitRepo</span><span class="p">[</span><span class="s2">&quot;repo&quot;</span><span class="p">])</span>
<span class="n">oldcwd</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">()</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">os</span><span class="o">.</span><span class="n">chdir</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">sourcesDir</span><span class="p">,</span> <span class="s2">&quot;gitrepo&quot;</span><span class="p">))</span>
<span class="c1"># Configure archive to create a .tar.xz</span>
<span class="n">cmd</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;git&quot;</span><span class="p">,</span> <span class="s2">&quot;config&quot;</span><span class="p">,</span> <span class="s2">&quot;tar.tar.xz.command&quot;</span><span class="p">,</span> <span class="s2">&quot;xz -c&quot;</span><span class="p">]</span>
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="n">cmd</span><span class="p">)</span>
<span class="n">subprocess</span><span class="o">.</span><span class="n">check_call</span><span class="p">(</span><span class="n">cmd</span><span class="p">)</span>
<span class="n">cmd</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;git&quot;</span><span class="p">,</span> <span class="s2">&quot;archive&quot;</span><span class="p">,</span> <span class="s2">&quot;--prefix&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_gitRepo</span><span class="p">[</span><span class="s2">&quot;rpmname&quot;</span><span class="p">]</span> <span class="o">+</span> <span class="s2">&quot;/&quot;</span><span class="p">,</span> <span class="s2">&quot;-o&quot;</span><span class="p">,</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">sourcesDir</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">sourceName</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">_gitRepo</span><span class="p">[</span><span class="s2">&quot;ref&quot;</span><span class="p">]]</span>
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="n">cmd</span><span class="p">)</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">subprocess</span><span class="o">.</span><span class="n">check_output</span><span class="p">(</span><span class="n">cmd</span><span class="p">)</span>
<span class="k">except</span> <span class="n">subprocess</span><span class="o">.</span><span class="n">CalledProcessError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;Failed to archive </span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_gitRepo</span><span class="p">[</span><span class="s2">&quot;repo&quot;</span><span class="p">],</span> <span class="n">e</span><span class="o">.</span><span class="n">output</span><span class="p">)</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">&quot;Failed to clone </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">_gitRepo</span><span class="p">[</span><span class="s2">&quot;repo&quot;</span><span class="p">])</span>
<span class="k">finally</span><span class="p">:</span>
<span class="c1"># Cleanup even if there was an error</span>
<span class="n">os</span><span class="o">.</span><span class="n">chdir</span><span class="p">(</span><span class="n">oldcwd</span><span class="p">)</span>
<span class="n">shutil</span><span class="o">.</span><span class="n">rmtree</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">sourcesDir</span><span class="p">,</span> <span class="s2">&quot;gitrepo&quot;</span><span class="p">))</span></div></div>
<div class="viewcode-block" id="GitRpmBuild"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.gitrpm.GitRpmBuild">[docs]</a><span class="k">class</span> <span class="nc">GitRpmBuild</span><span class="p">(</span><span class="n">SimpleRpmBuild</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Build an rpm containing files from a git repository&quot;&quot;&quot;</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_base_dir</span> <span class="o">=</span> <span class="kc">None</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<div class="viewcode-block" id="GitRpmBuild.check"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.gitrpm.GitRpmBuild.check">[docs]</a> <span class="k">def</span> <span class="nf">check</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span></div>
<div class="viewcode-block" id="GitRpmBuild.get_base_dir"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.gitrpm.GitRpmBuild.get_base_dir">[docs]</a> <span class="k">def</span> <span class="nf">get_base_dir</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Place all the files under a temporary directory + rpmbuild/</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_base_dir</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_base_dir</span> <span class="o">=</span> <span class="n">tempfile</span><span class="o">.</span><span class="n">mkdtemp</span><span class="p">(</span><span class="n">prefix</span><span class="o">=</span><span class="s2">&quot;lorax-git-rpm.&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">joinpaths</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_base_dir</span><span class="p">,</span> <span class="s2">&quot;rpmbuild&quot;</span><span class="p">)</span></div>
<div class="viewcode-block" id="GitRpmBuild.cleanup_tmpdir"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.gitrpm.GitRpmBuild.cleanup_tmpdir">[docs]</a> <span class="k">def</span> <span class="nf">cleanup_tmpdir</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Remove the temporary directory and all of its contents</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_base_dir</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">5</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">&quot;Invalid base_dir: </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_base_dir</span><span class="p">())</span>
<span class="n">shutil</span><span class="o">.</span><span class="n">rmtree</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_base_dir</span><span class="p">)</span></div>
<div class="viewcode-block" id="GitRpmBuild.clean"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.gitrpm.GitRpmBuild.clean">[docs]</a> <span class="k">def</span> <span class="nf">clean</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Remove the base directory from inside the tmpdir&quot;&quot;&quot;</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">get_base_dir</span><span class="p">())</span> <span class="o">&lt;</span> <span class="mi">5</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">&quot;Invalid base_dir: </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_base_dir</span><span class="p">())</span>
<span class="n">shutil</span><span class="o">.</span><span class="n">rmtree</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">get_base_dir</span><span class="p">(),</span> <span class="n">ignore_errors</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span></div>
<div class="viewcode-block" id="GitRpmBuild.add_git_tarball"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.gitrpm.GitRpmBuild.add_git_tarball">[docs]</a> <span class="k">def</span> <span class="nf">add_git_tarball</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">gitRepo</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Add a tar archive of a git repository to the rpm</span>
<span class="sd"> :param gitRepo: A dict with the repository details</span>
<span class="sd"> :type gitRepo: dict</span>
<span class="sd"> This populates the rpm with the URL of the git repository, the summary</span>
<span class="sd"> describing the repo, the description of the repository and reference used,</span>
<span class="sd"> and sets up the rpm to install the archive contents into the destination</span>
<span class="sd"> path.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">addUrl</span><span class="p">(</span><span class="n">gitRepo</span><span class="p">[</span><span class="s2">&quot;repo&quot;</span><span class="p">])</span>
<span class="bp">self</span><span class="o">.</span><span class="n">add_summary</span><span class="p">(</span><span class="n">gitRepo</span><span class="p">[</span><span class="s2">&quot;summary&quot;</span><span class="p">])</span>
<span class="bp">self</span><span class="o">.</span><span class="n">add_description</span><span class="p">(</span><span class="n">get_repo_description</span><span class="p">(</span><span class="n">gitRepo</span><span class="p">))</span>
<span class="bp">self</span><span class="o">.</span><span class="n">addLicense</span><span class="p">(</span><span class="s2">&quot;Unknown&quot;</span><span class="p">)</span>
<span class="n">sourceIndex</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">add_source</span><span class="p">(</span><span class="n">GitArchiveTarball</span><span class="p">(</span><span class="n">gitRepo</span><span class="p">))</span>
<span class="bp">self</span><span class="o">.</span><span class="n">section_build</span> <span class="o">+=</span> <span class="s2">&quot;tar -xvf </span><span class="si">%s</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span><span class="p">[</span><span class="n">sourceIndex</span><span class="p">]</span><span class="o">.</span><span class="n">sourceName</span>
<span class="n">dest</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">normpath</span><span class="p">(</span><span class="n">gitRepo</span><span class="p">[</span><span class="s2">&quot;destination&quot;</span><span class="p">])</span>
<span class="c1"># Prevent double slash root</span>
<span class="k">if</span> <span class="n">dest</span> <span class="o">==</span> <span class="s2">&quot;/&quot;</span><span class="p">:</span>
<span class="n">dest</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">create_parent_dirs</span><span class="p">(</span><span class="n">dest</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">section_install</span> <span class="o">+=</span> <span class="s2">&quot;cp -r </span><span class="si">%s</span><span class="s2">/. $RPM_BUILD_ROOT/</span><span class="si">%s</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">gitRepo</span><span class="p">[</span><span class="s2">&quot;rpmname&quot;</span><span class="p">],</span> <span class="n">dest</span><span class="p">)</span>
<span class="n">sub</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_subpackage</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">dest</span><span class="p">:</span>
<span class="c1"># / is special, we don&#39;t want to include / itself, just what&#39;s under it</span>
<span class="n">sub</span><span class="o">.</span><span class="n">section_files</span> <span class="o">+=</span> <span class="s2">&quot;/*</span><span class="se">\n</span><span class="s2">&quot;</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">sub</span><span class="o">.</span><span class="n">section_files</span> <span class="o">+=</span> <span class="s2">&quot;</span><span class="si">%s</span><span class="s2">/</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">dest</span></div></div>
<div class="viewcode-block" id="make_git_rpm"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.gitrpm.make_git_rpm">[docs]</a><span class="k">def</span> <span class="nf">make_git_rpm</span><span class="p">(</span><span class="n">gitRepo</span><span class="p">,</span> <span class="n">dest</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; Create an rpm from the specified git repo</span>
<span class="sd"> :param gitRepo: A dict with the repository details</span>
<span class="sd"> :type gitRepo: dict</span>
<span class="sd"> This will clone the git repository, create an archive of the selected reference,</span>
<span class="sd"> and build an rpm that will install the files from the repository under the destination</span>
<span class="sd"> directory. The gitRepo dict should have the following fields::</span>
<span class="sd"> rpmname: &quot;server-config&quot;</span>
<span class="sd"> rpmversion: &quot;1.0&quot;</span>
<span class="sd"> rpmrelease: &quot;1&quot;</span>
<span class="sd"> summary: &quot;Setup files for server deployment&quot;</span>
<span class="sd"> repo: &quot;PATH OF GIT REPO TO CLONE&quot;</span>
<span class="sd"> ref: &quot;v1.0&quot;</span>
<span class="sd"> destination: &quot;/opt/server/&quot;</span>
<span class="sd"> * rpmname: Name of the rpm to create, also used as the prefix name in the tar archive</span>
<span class="sd"> * rpmversion: Version of the rpm, eg. &quot;1.0.0&quot;</span>
<span class="sd"> * rpmrelease: Release of the rpm, eg. &quot;1&quot;</span>
<span class="sd"> * summary: Summary string for the rpm</span>
<span class="sd"> * repo: URL of the get repo to clone and create the archive from</span>
<span class="sd"> * ref: Git reference to check out. eg. origin/branch-name, git tag, or git commit hash</span>
<span class="sd"> * destination: Path to install the / of the git repo at when installing the rpm</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">gitRpm</span> <span class="o">=</span> <span class="n">GitRpmBuild</span><span class="p">(</span><span class="n">gitRepo</span><span class="p">[</span><span class="s2">&quot;rpmname&quot;</span><span class="p">],</span> <span class="n">gitRepo</span><span class="p">[</span><span class="s2">&quot;rpmversion&quot;</span><span class="p">],</span> <span class="n">gitRepo</span><span class="p">[</span><span class="s2">&quot;rpmrelease&quot;</span><span class="p">],</span> <span class="p">[</span><span class="s2">&quot;noarch&quot;</span><span class="p">])</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">gitRpm</span><span class="o">.</span><span class="n">add_git_tarball</span><span class="p">(</span><span class="n">gitRepo</span><span class="p">)</span>
<span class="n">gitRpm</span><span class="o">.</span><span class="n">do_make</span><span class="p">()</span>
<span class="n">rpmfile</span> <span class="o">=</span> <span class="n">gitRpm</span><span class="o">.</span><span class="n">get_built_rpm</span><span class="p">(</span><span class="s2">&quot;noarch&quot;</span><span class="p">)</span>
<span class="n">shutil</span><span class="o">.</span><span class="n">move</span><span class="p">(</span><span class="n">rpmfile</span><span class="p">,</span> <span class="n">dest</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;Creating git repo rpm: </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">e</span><span class="p">)</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">&quot;Creating git repo rpm: </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">e</span><span class="p">)</span>
<span class="k">finally</span><span class="p">:</span>
<span class="n">gitRpm</span><span class="o">.</span><span class="n">cleanup_tmpdir</span><span class="p">()</span>
<span class="k">return</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">rpmfile</span><span class="p">)</span></div>
<span class="c1"># Create the git rpms, if any, and return the path to the repo under results_dir</span>
<div class="viewcode-block" id="create_gitrpm_repo"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.gitrpm.create_gitrpm_repo">[docs]</a><span class="k">def</span> <span class="nf">create_gitrpm_repo</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="n">recipe</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Create a dnf repository with the rpms from the recipe</span>
<span class="sd"> :param results_dir: Path to create the repository under</span>
<span class="sd"> :type results_dir: str</span>
<span class="sd"> :param recipe: The recipe to get the repos.git entries from</span>
<span class="sd"> :type recipe: Recipe</span>
<span class="sd"> :returns: Path to the dnf repository or &quot;&quot;</span>
<span class="sd"> :rtype: str</span>
<span class="sd"> This function creates a dnf repository directory at results_dir+&quot;repo/&quot;,</span>
<span class="sd"> creates rpms for all of the repos.git entries in the recipe, runs createrepo_c</span>
<span class="sd"> on the dnf repository so that Anaconda can use it, and returns the path to the</span>
<span class="sd"> repository to the caller.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="s2">&quot;repos&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">recipe</span> <span class="ow">or</span> <span class="s2">&quot;git&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;repos&quot;</span><span class="p">]:</span>
<span class="k">return</span> <span class="s2">&quot;&quot;</span>
<span class="n">gitrepo</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="s2">&quot;repo/&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">gitrepo</span><span class="p">):</span>
<span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="n">gitrepo</span><span class="p">)</span>
<span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">&quot;repos&quot;</span><span class="p">][</span><span class="s2">&quot;git&quot;</span><span class="p">]:</span>
<span class="n">make_git_rpm</span><span class="p">(</span><span class="n">r</span><span class="p">,</span> <span class="n">gitrepo</span><span class="p">)</span>
<span class="n">cmd</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;createrepo_c&quot;</span><span class="p">,</span> <span class="n">gitrepo</span><span class="p">]</span>
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="n">cmd</span><span class="p">)</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">subprocess</span><span class="o">.</span><span class="n">check_output</span><span class="p">(</span><span class="n">cmd</span><span class="p">)</span>
<span class="k">except</span> <span class="n">subprocess</span><span class="o">.</span><span class="n">CalledProcessError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;Failed to create repo at </span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">gitrepo</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">output</span><span class="p">)</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">&quot;Failed to create repo at </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">gitrepo</span><span class="p">)</span>
<span class="k">return</span> <span class="n">gitrepo</span></div>
</pre></div>
</div>
</div>
<footer>
<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:'29.28',
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>

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.api.projects &mdash; Lorax 29.21 documentation</title>
<title>pylorax.api.projects &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -173,12 +173,14 @@
<span class="kn">import</span> <span class="nn">logging</span>
<span class="n">log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">&quot;lorax-composer&quot;</span><span class="p">)</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">from</span> <span class="nn">configparser</span> <span class="k">import</span> <span class="n">ConfigParser</span>
<span class="kn">import</span> <span class="nn">dnf</span>
<span class="kn">from</span> <span class="nn">glob</span> <span class="k">import</span> <span class="n">glob</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">time</span>
<span class="kn">from</span> <span class="nn">pylorax.api.bisect</span> <span class="k">import</span> <span class="n">insort_left</span>
<span class="n">TIME_FORMAT</span> <span class="o">=</span> <span class="s2">&quot;%Y-%m-</span><span class="si">%d</span><span class="s2">T%H:%M:%S&quot;</span>
@ -231,6 +233,32 @@
<span class="s2">&quot;upstream_vcs&quot;</span><span class="p">:</span> <span class="s2">&quot;UPSTREAM_VCS&quot;</span><span class="p">}</span></div>
<div class="viewcode-block" id="pkg_to_build"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.pkg_to_build">[docs]</a><span class="k">def</span> <span class="nf">pkg_to_build</span><span class="p">(</span><span class="n">pkg</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Extract the build details from a hawkey.Package object</span>
<span class="sd"> :param pkg: hawkey.Package object with package details</span>
<span class="sd"> :type pkg: hawkey.Package</span>
<span class="sd"> :returns: A dict with the build details, epoch, release, arch, build_time, changelog, ...</span>
<span class="sd"> :rtype: dict</span>
<span class="sd"> metadata entries are hard-coded to {}</span>
<span class="sd"> Note that this only returns the build dict, it does not include the name, description, etc.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="p">{</span><span class="s2">&quot;epoch&quot;</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">epoch</span><span class="p">,</span>
<span class="s2">&quot;release&quot;</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">release</span><span class="p">,</span>
<span class="s2">&quot;arch&quot;</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">arch</span><span class="p">,</span>
<span class="s2">&quot;build_time&quot;</span><span class="p">:</span> <span class="n">api_time</span><span class="p">(</span><span class="n">pkg</span><span class="o">.</span><span class="n">buildtime</span><span class="p">),</span>
<span class="s2">&quot;changelog&quot;</span><span class="p">:</span> <span class="s2">&quot;CHANGELOG_NEEDED&quot;</span><span class="p">,</span> <span class="c1"># XXX Not in hawkey.Package</span>
<span class="s2">&quot;build_config_ref&quot;</span><span class="p">:</span> <span class="s2">&quot;BUILD_CONFIG_REF&quot;</span><span class="p">,</span>
<span class="s2">&quot;build_env_ref&quot;</span><span class="p">:</span> <span class="s2">&quot;BUILD_ENV_REF&quot;</span><span class="p">,</span>
<span class="s2">&quot;metadata&quot;</span><span class="p">:</span> <span class="p">{},</span>
<span class="s2">&quot;source&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;license&quot;</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">license</span><span class="p">,</span>
<span class="s2">&quot;version&quot;</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">version</span><span class="p">,</span>
<span class="s2">&quot;source_ref&quot;</span><span class="p">:</span> <span class="s2">&quot;SOURCE_REF&quot;</span><span class="p">,</span>
<span class="s2">&quot;metadata&quot;</span><span class="p">:</span> <span class="p">{}}}</span></div>
<div class="viewcode-block" id="pkg_to_project_info"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.pkg_to_project_info">[docs]</a><span class="k">def</span> <span class="nf">pkg_to_project_info</span><span class="p">(</span><span class="n">pkg</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Extract the details from a hawkey.Package object</span>
@ -241,25 +269,12 @@
<span class="sd"> metadata entries are hard-coded to {}</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">build</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;epoch&quot;</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">epoch</span><span class="p">,</span>
<span class="s2">&quot;release&quot;</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">release</span><span class="p">,</span>
<span class="s2">&quot;arch&quot;</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">arch</span><span class="p">,</span>
<span class="s2">&quot;build_time&quot;</span><span class="p">:</span> <span class="n">api_time</span><span class="p">(</span><span class="n">pkg</span><span class="o">.</span><span class="n">buildtime</span><span class="p">),</span>
<span class="s2">&quot;changelog&quot;</span><span class="p">:</span> <span class="s2">&quot;CHANGELOG_NEEDED&quot;</span><span class="p">,</span> <span class="c1"># XXX Not in hawkey.Package</span>
<span class="s2">&quot;build_config_ref&quot;</span><span class="p">:</span> <span class="s2">&quot;BUILD_CONFIG_REF&quot;</span><span class="p">,</span>
<span class="s2">&quot;build_env_ref&quot;</span><span class="p">:</span> <span class="s2">&quot;BUILD_ENV_REF&quot;</span><span class="p">,</span>
<span class="s2">&quot;metadata&quot;</span><span class="p">:</span> <span class="p">{},</span>
<span class="s2">&quot;source&quot;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&quot;license&quot;</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">license</span><span class="p">,</span>
<span class="s2">&quot;version&quot;</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">version</span><span class="p">,</span>
<span class="s2">&quot;source_ref&quot;</span><span class="p">:</span> <span class="s2">&quot;SOURCE_REF&quot;</span><span class="p">,</span>
<span class="s2">&quot;metadata&quot;</span><span class="p">:</span> <span class="p">{}}}</span>
<span class="k">return</span> <span class="p">{</span><span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">name</span><span class="p">,</span>
<span class="s2">&quot;summary&quot;</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">summary</span><span class="p">,</span>
<span class="s2">&quot;description&quot;</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">description</span><span class="p">,</span>
<span class="s2">&quot;homepage&quot;</span><span class="p">:</span> <span class="n">pkg</span><span class="o">.</span><span class="n">url</span><span class="p">,</span>
<span class="s2">&quot;upstream_vcs&quot;</span><span class="p">:</span> <span class="s2">&quot;UPSTREAM_VCS&quot;</span><span class="p">,</span>
<span class="s2">&quot;builds&quot;</span><span class="p">:</span> <span class="p">[</span><span class="n">build</span><span class="p">]}</span></div>
<span class="s2">&quot;builds&quot;</span><span class="p">:</span> <span class="p">[</span><span class="n">pkg_to_build</span><span class="p">(</span><span class="n">pkg</span><span class="p">)]}</span></div>
<div class="viewcode-block" id="pkg_to_dep"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.pkg_to_dep">[docs]</a><span class="k">def</span> <span class="nf">pkg_to_dep</span><span class="p">(</span><span class="n">pkg</span><span class="p">):</span>
@ -336,7 +351,24 @@
<span class="n">pkgs</span> <span class="o">=</span> <span class="n">dbo</span><span class="o">.</span><span class="n">sack</span><span class="o">.</span><span class="n">query</span><span class="p">()</span><span class="o">.</span><span class="n">available</span><span class="p">()</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">name__glob</span><span class="o">=</span><span class="n">project_names</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">pkgs</span> <span class="o">=</span> <span class="n">dbo</span><span class="o">.</span><span class="n">sack</span><span class="o">.</span><span class="n">query</span><span class="p">()</span><span class="o">.</span><span class="n">available</span><span class="p">()</span>
<span class="k">return</span> <span class="nb">sorted</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="n">pkg_to_project_info</span><span class="p">,</span> <span class="n">pkgs</span><span class="p">),</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="n">p</span><span class="p">[</span><span class="s2">&quot;name&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span></div>
<span class="c1"># iterate over pkgs</span>
<span class="c1"># - if pkg.name isn&#39;t in the results yet, add pkg_to_project_info in sorted position</span>
<span class="c1"># - if pkg.name is already in results, get its builds. If the build for pkg is different</span>
<span class="c1"># in any way (version, arch, etc.) add it to the entry&#39;s builds list. If it is the same,</span>
<span class="c1"># skip it.</span>
<span class="n">results</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">results_names</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pkgs</span><span class="p">:</span>
<span class="k">if</span> <span class="n">p</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">results_names</span><span class="p">:</span>
<span class="n">idx</span> <span class="o">=</span> <span class="n">insort_left</span><span class="p">(</span><span class="n">results</span><span class="p">,</span> <span class="n">pkg_to_project_info</span><span class="p">(</span><span class="n">p</span><span class="p">),</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="n">p</span><span class="p">[</span><span class="s2">&quot;name&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
<span class="n">results_names</span><span class="p">[</span><span class="n">p</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()]</span> <span class="o">=</span> <span class="n">idx</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">build</span> <span class="o">=</span> <span class="n">pkg_to_build</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
<span class="k">if</span> <span class="n">build</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">results</span><span class="p">[</span><span class="n">results_names</span><span class="p">[</span><span class="n">p</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()]][</span><span class="s2">&quot;builds&quot;</span><span class="p">]:</span>
<span class="n">results</span><span class="p">[</span><span class="n">results_names</span><span class="p">[</span><span class="n">p</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()]][</span><span class="s2">&quot;builds&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">build</span><span class="p">)</span>
<span class="k">return</span> <span class="n">results</span></div>
<span class="k">def</span> <span class="nf">_depsolve</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">projects</span><span class="p">,</span> <span class="n">groups</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Add projects to a new transaction</span>
@ -477,9 +509,7 @@
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># TODO - Figure out what to do with this for Fedora &#39;modules&#39;</span>
<span class="n">projs</span> <span class="o">=</span> <span class="n">projects_info</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">module_names</span><span class="p">)</span>
<span class="k">return</span> <span class="nb">sorted</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="n">proj_to_module</span><span class="p">,</span> <span class="n">projs</span><span class="p">),</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="n">p</span><span class="p">[</span><span class="s2">&quot;name&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span></div>
<span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="n">proj_to_module</span><span class="p">,</span> <span class="n">projects_info</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">module_names</span><span class="p">)))</span></div>
<div class="viewcode-block" id="modules_info"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.modules_info">[docs]</a><span class="k">def</span> <span class="nf">modules_info</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">module_names</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return details about a module, including dependencies</span>
@ -743,7 +773,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.api.queue &mdash; Lorax 29.21 documentation</title>
<title>pylorax.api.queue &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -192,6 +192,47 @@
<span class="kn">from</span> <span class="nn">pylorax.creator</span> <span class="k">import</span> <span class="n">run_creator</span>
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="k">import</span> <span class="n">joinpaths</span>
<div class="viewcode-block" id="check_queues"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.queue.check_queues">[docs]</a><span class="k">def</span> <span class="nf">check_queues</span><span class="p">(</span><span class="n">cfg</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Check to make sure the new and run queue symlinks are correct</span>
<span class="sd"> :param cfg: Configuration settings</span>
<span class="sd"> :type cfg: DataHolder</span>
<span class="sd"> Also check all of the existing results and make sure any with WAITING</span>
<span class="sd"> set in STATUS have a symlink in queue/new/</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># Remove broken symlinks from the new and run queues</span>
<span class="n">queue_symlinks</span> <span class="o">=</span> <span class="n">glob</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">&quot;queue/new/*&quot;</span><span class="p">))</span> <span class="o">+</span> \
<span class="n">glob</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">&quot;queue/run/*&quot;</span><span class="p">))</span>
<span class="k">for</span> <span class="n">link</span> <span class="ow">in</span> <span class="n">queue_symlinks</span><span class="p">:</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">realpath</span><span class="p">(</span><span class="n">link</span><span class="p">)):</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Removing broken symlink </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">link</span><span class="p">)</span>
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">link</span><span class="p">)</span>
<span class="c1"># Write FAILED to the STATUS of any run queue symlinks and remove them</span>
<span class="k">for</span> <span class="n">link</span> <span class="ow">in</span> <span class="n">glob</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">&quot;queue/run/*&quot;</span><span class="p">)):</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Setting build </span><span class="si">%s</span><span class="s2"> to FAILED, and removing symlink from queue/run/&quot;</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">link</span><span class="p">))</span>
<span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">link</span><span class="p">,</span> <span class="s2">&quot;STATUS&quot;</span><span class="p">),</span> <span class="s2">&quot;w&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">&quot;FAILED</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">link</span><span class="p">)</span>
<span class="c1"># Check results STATUS messages</span>
<span class="c1"># - If STATUS is missing, set it to FAILED</span>
<span class="c1"># - RUNNING should be changed to FAILED</span>
<span class="c1"># - WAITING should have a symlink in the new queue</span>
<span class="k">for</span> <span class="n">link</span> <span class="ow">in</span> <span class="n">glob</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">&quot;results/*&quot;</span><span class="p">)):</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">link</span><span class="p">,</span> <span class="s2">&quot;STATUS&quot;</span><span class="p">)):</span>
<span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">link</span><span class="p">,</span> <span class="s2">&quot;STATUS&quot;</span><span class="p">),</span> <span class="s2">&quot;w&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">&quot;FAILED</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="k">continue</span>
<span class="n">status</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">link</span><span class="p">,</span> <span class="s2">&quot;STATUS&quot;</span><span class="p">))</span><span class="o">.</span><span class="n">read</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
<span class="k">if</span> <span class="n">status</span> <span class="o">==</span> <span class="s2">&quot;RUNNING&quot;</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Setting build </span><span class="si">%s</span><span class="s2"> to FAILED&quot;</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">link</span><span class="p">))</span>
<span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">link</span><span class="p">,</span> <span class="s2">&quot;STATUS&quot;</span><span class="p">),</span> <span class="s2">&quot;w&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">&quot;FAILED</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">status</span> <span class="o">==</span> <span class="s2">&quot;WAITING&quot;</span><span class="p">:</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">islink</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">&quot;queue/new/&quot;</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">link</span><span class="p">))):</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Creating missing symlink to new build </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">link</span><span class="p">))</span>
<span class="n">os</span><span class="o">.</span><span class="n">symlink</span><span class="p">(</span><span class="n">link</span><span class="p">,</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">&quot;queue/new/&quot;</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">link</span><span class="p">)))</span></div>
<div class="viewcode-block" id="start_queue_monitor"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.queue.start_queue_monitor">[docs]</a><span class="k">def</span> <span class="nf">start_queue_monitor</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">uid</span><span class="p">,</span> <span class="n">gid</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Start the queue monitor as a mp process</span>
@ -225,7 +266,7 @@
<span class="sd"> compose is finished) the symlink will be moved into ./queue/run/ and a STATUS file</span>
<span class="sd"> will be created in the results directory.</span>
<span class="sd"> STATUS can contain one of: RUNNING, FINISHED, FAILED</span>
<span class="sd"> STATUS can contain one of: WAITING, RUNNING, FINISHED, FAILED</span>
<span class="sd"> If the system is restarted while a compose is running it will move any old symlinks</span>
<span class="sd"> from ./queue/run/ to ./queue/new/ and rerun them.</span>
@ -234,13 +275,7 @@
<span class="sd">&quot;&quot;&quot;Sort the queue entries by their mtime, not their names&quot;&quot;&quot;</span>
<span class="k">return</span> <span class="n">os</span><span class="o">.</span><span class="n">stat</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">&quot;queue/new&quot;</span><span class="p">,</span> <span class="n">uuid</span><span class="p">))</span><span class="o">.</span><span class="n">st_mtime</span>
<span class="c1"># Move any symlinks in the run queue back to the new queue</span>
<span class="k">for</span> <span class="n">link</span> <span class="ow">in</span> <span class="n">os</span><span class="o">.</span><span class="n">listdir</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">&quot;queue/run&quot;</span><span class="p">)):</span>
<span class="n">src</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">&quot;queue/run&quot;</span><span class="p">,</span> <span class="n">link</span><span class="p">)</span>
<span class="n">dst</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">&quot;queue/new&quot;</span><span class="p">,</span> <span class="n">link</span><span class="p">)</span>
<span class="n">os</span><span class="o">.</span><span class="n">rename</span><span class="p">(</span><span class="n">src</span><span class="p">,</span> <span class="n">dst</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;Moved unfinished compose </span><span class="si">%s</span><span class="s2"> back to new state&quot;</span><span class="p">,</span> <span class="n">src</span><span class="p">)</span>
<span class="n">check_queues</span><span class="p">(</span><span class="n">cfg</span><span class="p">)</span>
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
<span class="n">uuids</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">listdir</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">composer_dir</span><span class="p">,</span> <span class="s2">&quot;queue/new&quot;</span><span class="p">)),</span> <span class="n">key</span><span class="o">=</span><span class="n">queue_sort</span><span class="p">)</span>
@ -366,7 +401,7 @@
<span class="k">else</span><span class="p">:</span>
<span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="n">install_cfg</span><span class="o">.</span><span class="n">image_name</span><span class="p">),</span> <span class="s2">&quot;w&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">&quot;TEST IMAGE&quot;</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">run_creator</span><span class="p">(</span><span class="n">install_cfg</span><span class="p">,</span> <span class="n">callback_func</span><span class="o">=</span><span class="n">cancel_build</span><span class="p">)</span>
<span class="n">run_creator</span><span class="p">(</span><span class="n">install_cfg</span><span class="p">,</span> <span class="n">cancel_func</span><span class="o">=</span><span class="n">cancel_build</span><span class="p">)</span>
<span class="c1"># Extract the results of the compose into results_dir and cleanup the compose directory</span>
<span class="n">move_compose_results</span><span class="p">(</span><span class="n">install_cfg</span><span class="p">,</span> <span class="n">results_dir</span><span class="p">)</span>
@ -549,11 +584,16 @@
<span class="sd"> Only call this if the build status is WAITING or RUNNING</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">cancel_path</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;composer&quot;</span><span class="p">,</span> <span class="s2">&quot;lib_dir&quot;</span><span class="p">),</span> <span class="s2">&quot;results&quot;</span><span class="p">,</span> <span class="n">uuid</span><span class="p">,</span> <span class="s2">&quot;CANCEL&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">cancel_path</span><span class="p">):</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Cancel has already been requested for </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
<span class="k">return</span> <span class="kc">False</span>
<span class="c1"># This status can change (and probably will) while it is in the middle of doing this:</span>
<span class="c1"># It can move from WAITING -&gt; RUNNING or it can move from RUNNING -&gt; FINISHED|FAILED</span>
<span class="c1"># If it is in WAITING remove the symlink and then check to make sure it didn&#39;t show up</span>
<span class="c1"># in RUNNING</span>
<span class="c1"># in the run queue</span>
<span class="n">queue_dir</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;composer&quot;</span><span class="p">,</span> <span class="s2">&quot;lib_dir&quot;</span><span class="p">),</span> <span class="s2">&quot;queue&quot;</span><span class="p">)</span>
<span class="n">uuid_new</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">queue_dir</span><span class="p">,</span> <span class="s2">&quot;new&quot;</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">uuid_new</span><span class="p">):</span>
@ -564,19 +604,24 @@
<span class="k">pass</span>
<span class="n">uuid_run</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">queue_dir</span><span class="p">,</span> <span class="s2">&quot;run&quot;</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">uuid_run</span><span class="p">):</span>
<span class="c1"># Successfully removed it before the build started</span>
<span class="k">return</span> <span class="n">uuid_delete</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
<span class="c1"># Make sure the build is still in the waiting state</span>
<span class="n">status</span> <span class="o">=</span> <span class="n">uuid_status</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
<span class="k">if</span> <span class="n">status</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">status</span><span class="p">[</span><span class="s2">&quot;queue_status&quot;</span><span class="p">]</span> <span class="o">==</span> <span class="s2">&quot;WAITING&quot;</span><span class="p">:</span>
<span class="c1"># Successfully removed it before the build started</span>
<span class="k">return</span> <span class="n">uuid_delete</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
<span class="c1"># Tell the build to stop running</span>
<span class="n">cancel_path</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;composer&quot;</span><span class="p">,</span> <span class="s2">&quot;lib_dir&quot;</span><span class="p">),</span> <span class="s2">&quot;results&quot;</span><span class="p">,</span> <span class="n">uuid</span><span class="p">,</span> <span class="s2">&quot;CANCEL&quot;</span><span class="p">)</span>
<span class="c1"># At this point the build has probably started. Write to the CANCEL file.</span>
<span class="nb">open</span><span class="p">(</span><span class="n">cancel_path</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="c1"># Wait for status to move to FAILED</span>
<span class="c1"># Wait for status to move to FAILED or FINISHED</span>
<span class="n">started</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
<span class="n">status</span> <span class="o">=</span> <span class="n">uuid_status</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
<span class="k">if</span> <span class="n">status</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">status</span><span class="p">[</span><span class="s2">&quot;queue_status&quot;</span><span class="p">]</span> <span class="o">==</span> <span class="s2">&quot;FAILED&quot;</span><span class="p">:</span>
<span class="k">break</span>
<span class="k">elif</span> <span class="n">status</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">status</span><span class="p">[</span><span class="s2">&quot;queue_status&quot;</span><span class="p">]</span> <span class="o">==</span> <span class="s2">&quot;FINISHED&quot;</span><span class="p">:</span>
<span class="c1"># The build finished successfully, no point in deleting it now</span>
<span class="k">return</span> <span class="kc">False</span>
<span class="c1"># Is this taking too long? Exit anyway and try to cleanup.</span>
<span class="k">if</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> <span class="o">&gt;</span> <span class="n">started</span> <span class="o">+</span> <span class="p">(</span><span class="mi">10</span> <span class="o">*</span> <span class="mi">60</span><span class="p">):</span>
@ -820,7 +865,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.api.recipes &mdash; Lorax 29.21 documentation</title>
<title>pylorax.api.recipes &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -155,7 +155,7 @@
<h1>Source code for pylorax.api.recipes</h1><div class="highlight"><pre>
<span></span><span class="c1">#</span>
<span class="c1"># Copyright (C) 2017 Red Hat, Inc.</span>
<span class="c1"># Copyright (C) 2017-2019 Red Hat, Inc.</span>
<span class="c1">#</span>
<span class="c1"># This program is free software; you can redistribute it and/or modify</span>
<span class="c1"># it under the terms of the GNU General Public License as published by</span>
@ -203,7 +203,7 @@
<span class="sd"> and adds a .filename property to return the recipe&#39;s filename,</span>
<span class="sd"> and a .toml() function to return the recipe as a TOML string.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">description</span><span class="p">,</span> <span class="n">version</span><span class="p">,</span> <span class="n">modules</span><span class="p">,</span> <span class="n">packages</span><span class="p">,</span> <span class="n">groups</span><span class="p">,</span> <span class="n">customizations</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">description</span><span class="p">,</span> <span class="n">version</span><span class="p">,</span> <span class="n">modules</span><span class="p">,</span> <span class="n">packages</span><span class="p">,</span> <span class="n">groups</span><span class="p">,</span> <span class="n">customizations</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">gitrepos</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="c1"># Check that version is empty or semver compatible</span>
<span class="k">if</span> <span class="n">version</span><span class="p">:</span>
<span class="n">semver</span><span class="o">.</span><span class="n">Version</span><span class="p">(</span><span class="n">version</span><span class="p">)</span>
@ -215,18 +215,29 @@
<span class="n">packages</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">packages</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="n">p</span><span class="p">[</span><span class="s2">&quot;name&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
<span class="k">if</span> <span class="n">groups</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">groups</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">groups</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">g</span><span class="p">:</span> <span class="n">g</span><span class="p">[</span><span class="s2">&quot;name&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
<span class="c1"># Only support [[repos.git]] for now</span>
<span class="k">if</span> <span class="n">gitrepos</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">repos</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;git&quot;</span><span class="p">:</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">gitrepos</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">g</span><span class="p">:</span> <span class="n">g</span><span class="p">[</span><span class="s2">&quot;repo&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())}</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">repos</span> <span class="o">=</span> <span class="kc">None</span>
<span class="nb">dict</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="n">name</span><span class="p">,</span>
<span class="n">description</span><span class="o">=</span><span class="n">description</span><span class="p">,</span>
<span class="n">version</span><span class="o">=</span><span class="n">version</span><span class="p">,</span>
<span class="n">modules</span><span class="o">=</span><span class="n">modules</span><span class="p">,</span>
<span class="n">packages</span><span class="o">=</span><span class="n">packages</span><span class="p">,</span>
<span class="n">groups</span><span class="o">=</span><span class="n">groups</span><span class="p">,</span>
<span class="n">customizations</span><span class="o">=</span><span class="n">customizations</span><span class="p">)</span>
<span class="n">customizations</span><span class="o">=</span><span class="n">customizations</span><span class="p">,</span>
<span class="n">repos</span><span class="o">=</span><span class="n">repos</span><span class="p">)</span>
<span class="c1"># We don&#39;t want customizations=None to show up in the TOML so remove it</span>
<span class="k">if</span> <span class="n">customizations</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">del</span> <span class="bp">self</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">]</span>
<span class="c1"># Don&#39;t include empty repos or repos.git</span>
<span class="k">if</span> <span class="n">repos</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">repos</span><span class="p">[</span><span class="s2">&quot;git&quot;</span><span class="p">]:</span>
<span class="k">del</span> <span class="bp">self</span><span class="p">[</span><span class="s2">&quot;repos&quot;</span><span class="p">]</span>
<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">package_names</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return the names of the packages&quot;&quot;&quot;</span>
@ -324,9 +335,13 @@
<span class="n">customizations</span> <span class="o">=</span> <span class="bp">self</span><span class="p">[</span><span class="s2">&quot;customizations&quot;</span><span class="p">]</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">customizations</span> <span class="o">=</span> <span class="kc">None</span>
<span class="k">if</span> <span class="s2">&quot;repos&quot;</span> <span class="ow">in</span> <span class="bp">self</span> <span class="ow">and</span> <span class="s2">&quot;git&quot;</span> <span class="ow">in</span> <span class="bp">self</span><span class="p">[</span><span class="s2">&quot;repos&quot;</span><span class="p">]:</span>
<span class="n">gitrepos</span> <span class="o">=</span> <span class="bp">self</span><span class="p">[</span><span class="s2">&quot;repos&quot;</span><span class="p">][</span><span class="s2">&quot;git&quot;</span><span class="p">]</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">gitrepos</span> <span class="o">=</span> <span class="kc">None</span>
<span class="k">return</span> <span class="n">Recipe</span><span class="p">(</span><span class="bp">self</span><span class="p">[</span><span class="s2">&quot;name&quot;</span><span class="p">],</span> <span class="bp">self</span><span class="p">[</span><span class="s2">&quot;description&quot;</span><span class="p">],</span> <span class="bp">self</span><span class="p">[</span><span class="s2">&quot;version&quot;</span><span class="p">],</span>
<span class="n">new_modules</span><span class="p">,</span> <span class="n">new_packages</span><span class="p">,</span> <span class="n">new_groups</span><span class="p">,</span> <span class="n">customizations</span><span class="p">)</span></div></div>
<span class="n">new_modules</span><span class="p">,</span> <span class="n">new_packages</span><span class="p">,</span> <span class="n">new_groups</span><span class="p">,</span> <span class="n">customizations</span><span class="p">,</span> <span class="n">gitrepos</span><span class="p">)</span></div></div>
<div class="viewcode-block" id="RecipeModule"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.recipes.RecipeModule">[docs]</a><span class="k">class</span> <span class="nc">RecipeModule</span><span class="p">(</span><span class="nb">dict</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">version</span><span class="p">):</span>
@ -339,6 +354,54 @@
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
<span class="nb">dict</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="n">name</span><span class="p">)</span></div>
<div class="viewcode-block" id="NewRecipeGit"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.recipes.NewRecipeGit">[docs]</a><span class="k">def</span> <span class="nf">NewRecipeGit</span><span class="p">(</span><span class="n">toml_dict</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Create a RecipeGit object from fields in a TOML dict</span>
<span class="sd"> :param rpmname: Name of the rpm to create, also used as the prefix name in the tar archive</span>
<span class="sd"> :type rpmname: str</span>
<span class="sd"> :param rpmversion: Version of the rpm, eg. &quot;1.0.0&quot;</span>
<span class="sd"> :type rpmversion: str</span>
<span class="sd"> :param rpmrelease: Release of the rpm, eg. &quot;1&quot;</span>
<span class="sd"> :type rpmrelease: str</span>
<span class="sd"> :param summary: Summary string for the rpm</span>
<span class="sd"> :type summary: str</span>
<span class="sd"> :param repo: URL of the get repo to clone and create the archive from</span>
<span class="sd"> :type repo: str</span>
<span class="sd"> :param ref: Git reference to check out. eg. origin/branch-name, git tag, or git commit hash</span>
<span class="sd"> :type ref: str</span>
<span class="sd"> :param destination: Path to install the / of the git repo at when installing the rpm</span>
<span class="sd"> :type destination: str</span>
<span class="sd"> :returns: A populated RecipeGit object</span>
<span class="sd"> :rtype: RecipeGit</span>
<span class="sd"> The TOML should look like this::</span>
<span class="sd"> [[repos.git]]</span>
<span class="sd"> rpmname=&quot;server-config&quot;</span>
<span class="sd"> rpmversion=&quot;1.0&quot;</span>
<span class="sd"> rpmrelease=&quot;1&quot;</span>
<span class="sd"> summary=&quot;Setup files for server deployment&quot;</span>
<span class="sd"> repo=&quot;PATH OF GIT REPO TO CLONE&quot;</span>
<span class="sd"> ref=&quot;v1.0&quot;</span>
<span class="sd"> destination=&quot;/opt/server/&quot;</span>
<span class="sd"> Note that the repo path supports anything that git supports, file://, https://, http://</span>
<span class="sd"> Currently there is no support for authentication</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="n">RecipeGit</span><span class="p">(</span><span class="n">toml_dict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;rpmname&quot;</span><span class="p">),</span>
<span class="n">toml_dict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;rpmversion&quot;</span><span class="p">),</span>
<span class="n">toml_dict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;rpmrelease&quot;</span><span class="p">),</span>
<span class="n">toml_dict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;summary&quot;</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">),</span>
<span class="n">toml_dict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;repo&quot;</span><span class="p">),</span>
<span class="n">toml_dict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;ref&quot;</span><span class="p">),</span>
<span class="n">toml_dict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;destination&quot;</span><span class="p">))</span></div>
<div class="viewcode-block" id="RecipeGit"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.recipes.RecipeGit">[docs]</a><span class="k">class</span> <span class="nc">RecipeGit</span><span class="p">(</span><span class="nb">dict</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">rpmname</span><span class="p">,</span> <span class="n">rpmversion</span><span class="p">,</span> <span class="n">rpmrelease</span><span class="p">,</span> <span class="n">summary</span><span class="p">,</span> <span class="n">repo</span><span class="p">,</span> <span class="n">ref</span><span class="p">,</span> <span class="n">destination</span><span class="p">):</span>
<span class="nb">dict</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">rpmname</span><span class="o">=</span><span class="n">rpmname</span><span class="p">,</span> <span class="n">rpmversion</span><span class="o">=</span><span class="n">rpmversion</span><span class="p">,</span> <span class="n">rpmrelease</span><span class="o">=</span><span class="n">rpmrelease</span><span class="p">,</span>
<span class="n">summary</span><span class="o">=</span><span class="n">summary</span><span class="p">,</span> <span class="n">repo</span><span class="o">=</span><span class="n">repo</span><span class="p">,</span> <span class="n">ref</span><span class="o">=</span><span class="n">ref</span><span class="p">,</span> <span class="n">destination</span><span class="o">=</span><span class="n">destination</span><span class="p">)</span></div>
<div class="viewcode-block" id="recipe_from_file"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.recipes.recipe_from_file">[docs]</a><span class="k">def</span> <span class="nf">recipe_from_file</span><span class="p">(</span><span class="n">recipe_path</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return a recipe file as a Recipe object</span>
@ -386,14 +449,24 @@
<span class="n">groups</span> <span class="o">=</span> <span class="p">[</span><span class="n">RecipeGroup</span><span class="p">(</span><span class="n">g</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;name&quot;</span><span class="p">))</span> <span class="k">for</span> <span class="n">g</span> <span class="ow">in</span> <span class="n">recipe_dict</span><span class="p">[</span><span class="s2">&quot;groups&quot;</span><span class="p">]]</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">groups</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">if</span> <span class="n">recipe_dict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;repos&quot;</span><span class="p">)</span> <span class="ow">and</span> <span class="n">recipe_dict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;repos&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;git&quot;</span><span class="p">):</span>
<span class="n">gitrepos</span> <span class="o">=</span> <span class="p">[</span><span class="n">NewRecipeGit</span><span class="p">(</span><span class="n">r</span><span class="p">)</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">recipe_dict</span><span class="p">[</span><span class="s2">&quot;repos&quot;</span><span class="p">][</span><span class="s2">&quot;git&quot;</span><span class="p">]]</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">gitrepos</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">name</span> <span class="o">=</span> <span class="n">recipe_dict</span><span class="p">[</span><span class="s2">&quot;name&quot;</span><span class="p">]</span>
<span class="n">description</span> <span class="o">=</span> <span class="n">recipe_dict</span><span class="p">[</span><span class="s2">&quot;description&quot;</span><span class="p">]</span>
<span class="n">version</span> <span class="o">=</span> <span class="n">recipe_dict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;version&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="n">customizations</span> <span class="o">=</span> <span class="n">recipe_dict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;customizations&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="c1"># [customizations] was incorrectly documented at first, so we have to support using it</span>
<span class="c1"># as [[customizations]] by grabbing the first element.</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">customizations</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span>
<span class="n">customizations</span> <span class="o">=</span> <span class="n">customizations</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="k">except</span> <span class="ne">KeyError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">RecipeError</span><span class="p">(</span><span class="s2">&quot;There was a problem parsing the recipe: </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
<span class="k">return</span> <span class="n">Recipe</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">description</span><span class="p">,</span> <span class="n">version</span><span class="p">,</span> <span class="n">modules</span><span class="p">,</span> <span class="n">packages</span><span class="p">,</span> <span class="n">groups</span><span class="p">,</span> <span class="n">customizations</span><span class="p">)</span></div>
<span class="k">return</span> <span class="n">Recipe</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">description</span><span class="p">,</span> <span class="n">version</span><span class="p">,</span> <span class="n">modules</span><span class="p">,</span> <span class="n">packages</span><span class="p">,</span> <span class="n">groups</span><span class="p">,</span> <span class="n">customizations</span><span class="p">,</span> <span class="n">gitrepos</span><span class="p">)</span></div>
<div class="viewcode-block" id="gfile"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.recipes.gfile">[docs]</a><span class="k">def</span> <span class="nf">gfile</span><span class="p">(</span><span class="n">path</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Convert a string path to GFile for use with Git&quot;&quot;&quot;</span>
@ -564,6 +637,9 @@
<span class="sd"> If no commit is passed the master:filename is returned, otherwise it will be</span>
<span class="sd"> commit:filename</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">repo_file_exists</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">recipe_filename</span><span class="p">(</span><span class="n">recipe_name</span><span class="p">)):</span>
<span class="k">raise</span> <span class="n">RecipeFileError</span><span class="p">(</span><span class="s2">&quot;Unknown blueprint&quot;</span><span class="p">)</span>
<span class="p">(</span><span class="n">_</span><span class="p">,</span> <span class="n">recipe_toml</span><span class="p">)</span> <span class="o">=</span> <span class="n">read_commit</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">recipe_filename</span><span class="p">(</span><span class="n">recipe_name</span><span class="p">),</span> <span class="n">commit</span><span class="p">)</span>
<span class="k">return</span> <span class="n">recipe_from_toml</span><span class="p">(</span><span class="n">recipe_toml</span><span class="p">)</span></div>
@ -787,6 +863,9 @@
<span class="sd"> Uses tag_file_commit()</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">repo_file_exists</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">recipe_filename</span><span class="p">(</span><span class="n">recipe_name</span><span class="p">)):</span>
<span class="k">raise</span> <span class="n">RecipeFileError</span><span class="p">(</span><span class="s2">&quot;Unknown blueprint&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">tag_file_commit</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">recipe_filename</span><span class="p">(</span><span class="n">recipe_name</span><span class="p">))</span></div>
<div class="viewcode-block" id="tag_file_commit"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.recipes.tag_file_commit">[docs]</a><span class="k">def</span> <span class="nf">tag_file_commit</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">filename</span><span class="p">):</span>
@ -1076,6 +1155,24 @@
<span class="n">diffs</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">diff_items</span><span class="p">(</span><span class="s2">&quot;Group&quot;</span><span class="p">,</span> <span class="n">old_recipe</span><span class="p">[</span><span class="s2">&quot;groups&quot;</span><span class="p">],</span> <span class="n">new_recipe</span><span class="p">[</span><span class="s2">&quot;groups&quot;</span><span class="p">]))</span>
<span class="k">return</span> <span class="n">diffs</span></div>
<div class="viewcode-block" id="repo_file_exists"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.recipes.repo_file_exists">[docs]</a><span class="k">def</span> <span class="nf">repo_file_exists</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">filename</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return True if the filename exists on the branch</span>
<span class="sd"> :param repo: Open repository</span>
<span class="sd"> :type repo: Git.Repository</span>
<span class="sd"> :param branch: Branch name</span>
<span class="sd"> :type branch: str</span>
<span class="sd"> :param filename: Filename to check</span>
<span class="sd"> :type filename: str</span>
<span class="sd"> :returns: True if the filename exists on the HEAD of the branch, False otherwise.</span>
<span class="sd"> :rtype: bool</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">commit</span> <span class="o">=</span> <span class="n">head_commit</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">)</span><span class="o">.</span><span class="n">get_id</span><span class="p">()</span><span class="o">.</span><span class="n">to_string</span><span class="p">()</span>
<span class="n">commit_id</span> <span class="o">=</span> <span class="n">Git</span><span class="o">.</span><span class="n">OId</span><span class="o">.</span><span class="n">new_from_string</span><span class="p">(</span><span class="n">commit</span><span class="p">)</span>
<span class="n">commit_obj</span> <span class="o">=</span> <span class="n">repo</span><span class="o">.</span><span class="n">lookup</span><span class="p">(</span><span class="n">commit_id</span><span class="p">,</span> <span class="n">Git</span><span class="o">.</span><span class="n">Commit</span><span class="p">)</span>
<span class="n">tree</span> <span class="o">=</span> <span class="n">commit_obj</span><span class="o">.</span><span class="n">get_tree</span><span class="p">()</span>
<span class="k">return</span> <span class="n">tree</span><span class="o">.</span><span class="n">get_by_name</span><span class="p">(</span><span class="n">filename</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span></div>
</pre></div>
</div>
@ -1112,7 +1209,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.api.server &mdash; Lorax 29.21 documentation</title>
<title>pylorax.api.server &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -272,7 +272,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.api.timestamp &mdash; Lorax 29.21 documentation</title>
<title>pylorax.api.timestamp &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -241,7 +241,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.api.v0 &mdash; Lorax 29.21 documentation</title>
<title>pylorax.api.v0 &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -357,7 +357,8 @@
<span class="sd"> Delete a blueprint. The blueprint is deleted from the branch, and will no longer</span>
<span class="sd"> be listed by the `list` route. A blueprint can be undeleted using the `undo` route</span>
<span class="sd"> to revert to a previous commit.</span>
<span class="sd"> to revert to a previous commit. This will also delete the workspace copy of the</span>
<span class="sd"> blueprint.</span>
<span class="sd"> The response will be a status response with `status` set to true, or an</span>
<span class="sd"> error response with it set to false and an error message included.</span>
@ -846,7 +847,9 @@
<span class="sd">^^^^^^^^^^^^^^^^^^^^^^</span>
<span class="sd"> Start a compose. The content type should be &#39;application/json&#39; and the body of the POST</span>
<span class="sd"> should look like this::</span>
<span class="sd"> should look like this</span>
<span class="sd"> </span>
<span class="sd"> Example::</span>
<span class="sd"> {</span>
<span class="sd"> &quot;blueprint_name&quot;: &quot;http-server&quot;,</span>
@ -856,8 +859,10 @@
<span class="sd"> Pass it the name of the blueprint, the type of output (from &#39;/api/v0/compose/types&#39;), and the</span>
<span class="sd"> blueprint branch to use. &#39;branch&#39; is optional and will default to master. It will create a new</span>
<span class="sd"> build and add it to the queue. It returns the build uuid and a status if it succeeds::</span>
<span class="sd"> build and add it to the queue. It returns the build uuid and a status if it succeeds</span>
<span class="sd"> Example::</span>
<span class="sd"> </span>
<span class="sd"> {</span>
<span class="sd"> &quot;build_id&quot;: &quot;e6fa6db4-9c81-4b70-870f-a697ca405cdf&quot;,</span>
<span class="sd"> &quot;status&quot;: true</span>
@ -868,6 +873,8 @@
<span class="sd"> Returns the list of supported output types that are valid for use with &#39;POST /api/v0/compose&#39;</span>
<span class="sd"> Example::</span>
<span class="sd"> {</span>
<span class="sd"> &quot;types&quot;: [</span>
<span class="sd"> {</span>
@ -1156,7 +1163,7 @@
<span class="kn">from</span> <span class="nn">pylorax.api.queue</span> <span class="k">import</span> <span class="n">uuid_tar</span><span class="p">,</span> <span class="n">uuid_image</span><span class="p">,</span> <span class="n">uuid_cancel</span><span class="p">,</span> <span class="n">uuid_log</span>
<span class="kn">from</span> <span class="nn">pylorax.api.recipes</span> <span class="k">import</span> <span class="n">RecipeError</span><span class="p">,</span> <span class="n">list_branch_files</span><span class="p">,</span> <span class="n">read_recipe_commit</span><span class="p">,</span> <span class="n">recipe_filename</span><span class="p">,</span> <span class="n">list_commits</span>
<span class="kn">from</span> <span class="nn">pylorax.api.recipes</span> <span class="k">import</span> <span class="n">recipe_from_dict</span><span class="p">,</span> <span class="n">recipe_from_toml</span><span class="p">,</span> <span class="n">commit_recipe</span><span class="p">,</span> <span class="n">delete_recipe</span><span class="p">,</span> <span class="n">revert_recipe</span>
<span class="kn">from</span> <span class="nn">pylorax.api.recipes</span> <span class="k">import</span> <span class="n">tag_recipe_commit</span><span class="p">,</span> <span class="n">recipe_diff</span>
<span class="kn">from</span> <span class="nn">pylorax.api.recipes</span> <span class="k">import</span> <span class="n">tag_recipe_commit</span><span class="p">,</span> <span class="n">recipe_diff</span><span class="p">,</span> <span class="n">RecipeFileError</span>
<span class="kn">from</span> <span class="nn">pylorax.api.regexes</span> <span class="k">import</span> <span class="n">VALID_API_STRING</span>
<span class="kn">from</span> <span class="nn">pylorax.api.workspace</span> <span class="k">import</span> <span class="n">workspace_read</span><span class="p">,</span> <span class="n">workspace_write</span><span class="p">,</span> <span class="n">workspace_delete</span>
@ -1177,12 +1184,21 @@
<span class="k">return</span> <span class="n">iterable</span><span class="p">[</span><span class="n">offset</span><span class="p">:][:</span><span class="n">limit</span><span class="p">]</span></div>
<div class="viewcode-block" id="blueprint_exists"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.v0.blueprint_exists">[docs]</a><span class="k">def</span> <span class="nf">blueprint_exists</span><span class="p">(</span><span class="n">api</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return True if the blueprint exists</span>
<span class="sd"> :param api: flask object</span>
<span class="sd"> :type api: Flask</span>
<span class="sd"> :param branch: Branch name</span>
<span class="sd"> :type branch: str</span>
<span class="sd"> :param recipe_name: Recipe name to read</span>
<span class="sd"> :type recipe_name: str</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">&quot;GITLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
<span class="n">read_recipe_commit</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">&quot;GITLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">)</span>
<span class="k">return</span> <span class="kc">True</span>
<span class="k">except</span> <span class="n">RecipeError</span><span class="p">:</span>
<span class="k">except</span> <span class="p">(</span><span class="n">RecipeError</span><span class="p">,</span> <span class="n">RecipeFileError</span><span class="p">):</span>
<span class="k">return</span> <span class="kc">False</span></div>
<div class="viewcode-block" id="v0_api"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.v0.v0_api">[docs]</a><span class="k">def</span> <span class="nf">v0_api</span><span class="p">(</span><span class="n">api</span><span class="p">):</span>
@ -1241,6 +1257,10 @@
<span class="k">try</span><span class="p">:</span>
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">&quot;GITLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
<span class="n">git_blueprint</span> <span class="o">=</span> <span class="n">read_recipe_commit</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">&quot;GITLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">)</span>
<span class="k">except</span> <span class="n">RecipeFileError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="c1"># Adding an exception would be redundant, skip it</span>
<span class="n">git_blueprint</span> <span class="o">=</span> <span class="kc">None</span>
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;(v0_blueprints_info) </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">git_blueprint</span> <span class="o">=</span> <span class="kc">None</span>
<span class="n">exceptions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
@ -1299,20 +1319,19 @@
<span class="n">errors</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">blueprint_name</span> <span class="ow">in</span> <span class="p">[</span><span class="n">n</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">blueprint_names</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">&quot;,&quot;</span><span class="p">)]:</span>
<span class="n">filename</span> <span class="o">=</span> <span class="n">recipe_filename</span><span class="p">(</span><span class="n">blueprint_name</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">blueprint_exists</span><span class="p">(</span><span class="n">api</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">):</span>
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">&quot;id&quot;</span><span class="p">:</span> <span class="n">UNKNOWN_BLUEPRINT</span><span class="p">,</span> <span class="s2">&quot;msg&quot;</span><span class="p">:</span> <span class="s2">&quot;Unknown blueprint name: </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">blueprint_name</span><span class="p">})</span>
<span class="k">continue</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">&quot;GITLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
<span class="n">commits</span> <span class="o">=</span> <span class="n">list_commits</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">&quot;GITLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">filename</span><span class="p">)</span>
<span class="n">limited_commits</span> <span class="o">=</span> <span class="n">take_limits</span><span class="p">(</span><span class="n">list_commits</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">&quot;GITLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">filename</span><span class="p">),</span> <span class="n">offset</span><span class="p">,</span> <span class="n">limit</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">&quot;id&quot;</span><span class="p">:</span> <span class="n">BLUEPRINTS_ERROR</span><span class="p">,</span> <span class="s2">&quot;msg&quot;</span><span class="p">:</span> <span class="s2">&quot;</span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))})</span>
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;(v0_blueprints_changes) </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">blueprints</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">&quot;name&quot;</span><span class="p">:</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="s2">&quot;changes&quot;</span><span class="p">:</span><span class="n">limited_commits</span><span class="p">,</span> <span class="s2">&quot;total&quot;</span><span class="p">:</span><span class="nb">len</span><span class="p">(</span><span class="n">commits</span><span class="p">)})</span>
<span class="k">if</span> <span class="n">commits</span><span class="p">:</span>
<span class="n">limited_commits</span> <span class="o">=</span> <span class="n">take_limits</span><span class="p">(</span><span class="n">commits</span><span class="p">,</span> <span class="n">offset</span><span class="p">,</span> <span class="n">limit</span><span class="p">)</span>
<span class="n">blueprints</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">&quot;name&quot;</span><span class="p">:</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="s2">&quot;changes&quot;</span><span class="p">:</span><span class="n">limited_commits</span><span class="p">,</span> <span class="s2">&quot;total&quot;</span><span class="p">:</span><span class="nb">len</span><span class="p">(</span><span class="n">commits</span><span class="p">)})</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># no commits means there is no blueprint in the branch</span>
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">&quot;id&quot;</span><span class="p">:</span> <span class="n">UNKNOWN_BLUEPRINT</span><span class="p">,</span> <span class="s2">&quot;msg&quot;</span><span class="p">:</span> <span class="s2">&quot;</span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">blueprint_name</span><span class="p">})</span>
<span class="n">blueprints</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">blueprints</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">r</span><span class="p">:</span> <span class="n">r</span><span class="p">[</span><span class="s2">&quot;name&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
@ -1362,6 +1381,7 @@
<span class="k">try</span><span class="p">:</span>
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">&quot;GITLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
<span class="n">workspace_delete</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">&quot;GITLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">)</span>
<span class="n">delete_recipe</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">&quot;GITLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;(v0_blueprints_delete) </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
@ -1460,6 +1480,9 @@
<span class="k">try</span><span class="p">:</span>
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">&quot;GITLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
<span class="n">tag_recipe_commit</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">&quot;GITLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">)</span>
<span class="k">except</span> <span class="n">RecipeFileError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;(v0_blueprints_tag) </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">&quot;id&quot;</span><span class="p">:</span> <span class="n">UNKNOWN_BLUEPRINT</span><span class="p">,</span> <span class="s2">&quot;msg&quot;</span><span class="p">:</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)}]),</span> <span class="mi">400</span>
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;(v0_blueprints_tag) </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">&quot;id&quot;</span><span class="p">:</span> <span class="n">BLUEPRINTS_ERROR</span><span class="p">,</span> <span class="s2">&quot;msg&quot;</span><span class="p">:</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)}]),</span> <span class="mi">400</span>
@ -1484,6 +1507,9 @@
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">branch</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">&quot;id&quot;</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">&quot;msg&quot;</span><span class="p">:</span> <span class="s2">&quot;Invalid characters in branch argument&quot;</span><span class="p">}]),</span> <span class="mi">400</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">blueprint_exists</span><span class="p">(</span><span class="n">api</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">):</span>
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">&quot;id&quot;</span><span class="p">:</span> <span class="n">UNKNOWN_BLUEPRINT</span><span class="p">,</span> <span class="s2">&quot;msg&quot;</span><span class="p">:</span> <span class="s2">&quot;Unknown blueprint name: </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">blueprint_name</span><span class="p">}])</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">if</span> <span class="n">from_commit</span> <span class="o">==</span> <span class="s2">&quot;NEWEST&quot;</span><span class="p">:</span>
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">&quot;GITLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
@ -1550,6 +1576,9 @@
<span class="k">try</span><span class="p">:</span>
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">&quot;GITLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
<span class="n">blueprint</span> <span class="o">=</span> <span class="n">read_recipe_commit</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">&quot;GITLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">)</span>
<span class="k">except</span> <span class="n">RecipeFileError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="c1"># adding an error here would be redundant, skip it</span>
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;(v0_blueprints_freeze) </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">&quot;id&quot;</span><span class="p">:</span> <span class="n">BLUEPRINTS_ERROR</span><span class="p">,</span> <span class="s2">&quot;msg&quot;</span><span class="p">:</span> <span class="s2">&quot;</span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))})</span>
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;(v0_blueprints_freeze) </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
@ -1610,6 +1639,9 @@
<span class="k">try</span><span class="p">:</span>
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">&quot;GITLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
<span class="n">blueprint</span> <span class="o">=</span> <span class="n">read_recipe_commit</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">&quot;GITLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">)</span>
<span class="k">except</span> <span class="n">RecipeFileError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="c1"># adding an error here would be redundant, skip it</span>
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;(v0_blueprints_depsolve) </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">&quot;id&quot;</span><span class="p">:</span> <span class="n">BLUEPRINTS_ERROR</span><span class="p">,</span> <span class="s2">&quot;msg&quot;</span><span class="p">:</span> <span class="s2">&quot;</span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))})</span>
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;(v0_blueprints_depsolve) </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
@ -1942,6 +1974,9 @@
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">blueprint_name</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">&quot;id&quot;</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">&quot;msg&quot;</span><span class="p">:</span> <span class="s2">&quot;Invalid characters in API path&quot;</span><span class="p">})</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">blueprint_exists</span><span class="p">(</span><span class="n">api</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">):</span>
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">&quot;id&quot;</span><span class="p">:</span> <span class="n">UNKNOWN_BLUEPRINT</span><span class="p">,</span> <span class="s2">&quot;msg&quot;</span><span class="p">:</span> <span class="s2">&quot;Unknown blueprint name: </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">blueprint_name</span><span class="p">})</span>
<span class="k">if</span> <span class="n">errors</span><span class="p">:</span>
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="n">errors</span><span class="p">),</span> <span class="mi">400</span>
@ -2241,7 +2276,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.api.workspace &mdash; Lorax 29.21 documentation</title>
<title>pylorax.api.workspace &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -289,7 +289,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.base &mdash; Lorax 29.21 documentation</title>
<title>pylorax.base &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -257,7 +257,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.buildstamp &mdash; Lorax 29.21 documentation</title>
<title>pylorax.buildstamp &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -179,6 +179,7 @@
<span class="n">logger</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">&quot;pylorax.buildstamp&quot;</span><span class="p">)</span>
<span class="kn">import</span> <span class="nn">datetime</span>
<span class="kn">import</span> <span class="nn">os</span>
<div class="viewcode-block" id="BuildStamp"><a class="viewcode-back" href="../../pylorax.html#pylorax.buildstamp.BuildStamp">[docs]</a><span class="k">class</span> <span class="nc">BuildStamp</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
@ -190,7 +191,11 @@
<span class="bp">self</span><span class="o">.</span><span class="n">isfinal</span> <span class="o">=</span> <span class="n">isfinal</span>
<span class="bp">self</span><span class="o">.</span><span class="n">variant</span> <span class="o">=</span> <span class="n">variant</span>
<span class="n">now</span> <span class="o">=</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">now</span><span class="p">()</span>
<span class="k">if</span> <span class="s1">&#39;SOURCE_DATE_EPOCH&#39;</span> <span class="ow">in</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">:</span>
<span class="n">now</span> <span class="o">=</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">utcfromtimestamp</span><span class="p">(</span>
<span class="nb">int</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s1">&#39;SOURCE_DATE_EPOCH&#39;</span><span class="p">]))</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">now</span> <span class="o">=</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">now</span><span class="p">()</span>
<span class="n">now</span> <span class="o">=</span> <span class="n">now</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s2">&quot;%Y%m</span><span class="si">%d</span><span class="s2">%H%M&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">uuid</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="si">{0}</span><span class="s2">.</span><span class="si">{1}</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">now</span><span class="p">,</span> <span class="n">buildarch</span><span class="p">)</span>
@ -251,7 +256,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.cmdline &mdash; Lorax 29.21 documentation</title>
<title>pylorax.cmdline &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -231,12 +231,12 @@
<span class="n">action</span><span class="o">=</span><span class="s2">&quot;store_false&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;doupgrade&quot;</span><span class="p">)</span>
<span class="n">optional</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--logfile&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s2">&quot;./lorax.log&quot;</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Path to logfile&quot;</span><span class="p">)</span>
<span class="n">optional</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--tmp&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s2">&quot;/var/tmp&quot;</span><span class="p">,</span>
<span class="n">optional</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--tmp&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s2">&quot;/var/tmp/lorax&quot;</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Top level temporary directory&quot;</span> <span class="p">)</span>
<span class="n">optional</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--cachedir&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;DNF cache directory. Default is a temporary dir.&quot;</span><span class="p">)</span>
<span class="n">optional</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--workdir&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Work directory, overrides --tmp. Default is a temporary dir under /var/tmp&quot;</span><span class="p">)</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Work directory, overrides --tmp. Default is a temporary dir under /var/tmp/lorax&quot;</span><span class="p">)</span>
<span class="n">optional</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--force&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">&quot;store_true&quot;</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Run even when the destination directory exists&quot;</span><span class="p">)</span>
<span class="n">optional</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--add-template&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;add_templates&quot;</span><span class="p">,</span>
@ -265,6 +265,8 @@
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Do not verify SSL certificates&quot;</span><span class="p">)</span>
<span class="n">optional</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--dnfplugin&quot;</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">&quot;append&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="p">[],</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;dnfplugins&quot;</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Enable a DNF plugin by name/glob, or * to enable all of them.&quot;</span><span class="p">)</span>
<span class="n">optional</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--squashfs-only&quot;</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">&quot;store_true&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Use a plain squashfs filesystem for the runtime.&quot;</span><span class="p">)</span>
<span class="c1"># dracut arguments</span>
<span class="n">dracut_group</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">add_argument_group</span><span class="p">(</span><span class="s2">&quot;dracut arguments&quot;</span><span class="p">)</span>
@ -302,6 +304,8 @@
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Build an ami image&quot;</span><span class="p">)</span>
<span class="n">action</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--make-tar&quot;</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">&quot;store_true&quot;</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Build a tar of the root filesystem&quot;</span><span class="p">)</span>
<span class="n">action</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--make-tar-disk&quot;</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">&quot;store_true&quot;</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Build a tar of a partitioned disk image&quot;</span><span class="p">)</span>
<span class="n">action</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--make-pxe-live&quot;</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">&quot;store_true&quot;</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Build a live pxe boot squashfs image&quot;</span><span class="p">)</span>
<span class="n">action</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--make-ostree-live&quot;</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">&quot;store_true&quot;</span><span class="p">,</span>
@ -357,6 +361,9 @@
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--nomacboot&quot;</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">&quot;store_false&quot;</span><span class="p">,</span>
<span class="n">dest</span><span class="o">=</span><span class="s2">&quot;domacboot&quot;</span><span class="p">)</span>
<span class="n">parser</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--extra-boot-args&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;extra_boot_args&quot;</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Extra arguments to add to the bootloader kernel cmdline in the templates&quot;</span><span class="p">)</span>
<span class="n">image_group</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">add_argument_group</span><span class="p">(</span><span class="s2">&quot;disk/fs image arguments&quot;</span><span class="p">)</span>
<span class="n">image_group</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--disk-image&quot;</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Path to existing disk image to use for creating final image.&quot;</span><span class="p">)</span>
@ -366,8 +373,12 @@
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Path to existing filesystem image to use for creating final image.&quot;</span><span class="p">)</span>
<span class="n">image_group</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--image-name&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Name of output file to create. Used for tar, fs and disk image. Default is a random name.&quot;</span><span class="p">)</span>
<span class="n">image_group</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--tar-disk-name&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Name of the archive member for make-tar-disk.&quot;</span><span class="p">)</span>
<span class="n">image_group</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--fs-label&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="s2">&quot;Anaconda&quot;</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Label to set on fsimage, default is &#39;Anaconda&#39;&quot;</span><span class="p">)</span>
<span class="n">image_group</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--image-size-align&quot;</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Create a disk image with a size that is a multiple of this value in MiB.&quot;</span><span class="p">)</span>
<span class="n">image_group</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--image-type&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">help</span><span class="o">=</span><span class="s2">&quot;Create an image with qemu-img. See qemu-img --help for supported formats.&quot;</span><span class="p">)</span>
<span class="n">image_group</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">&quot;--qemu-arg&quot;</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s2">&quot;append&quot;</span><span class="p">,</span> <span class="n">dest</span><span class="o">=</span><span class="s2">&quot;qemu_args&quot;</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="p">[],</span>
@ -494,7 +505,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.creator &mdash; Lorax 29.21 documentation</title>
<title>pylorax.creator &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -311,7 +311,7 @@
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Calculating SHA256 checksum of </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">)</span>
<span class="n">sha256</span> <span class="o">=</span> <span class="n">hashlib</span><span class="o">.</span><span class="n">sha256</span><span class="p">()</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">disk_img</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">disk_img</span><span class="p">,</span> <span class="s2">&quot;rb&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="mi">1024</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">data</span><span class="p">:</span>
@ -359,7 +359,7 @@
<span class="n">rb</span> <span class="o">=</span> <span class="n">RuntimeBuilder</span><span class="p">(</span><span class="n">product</span><span class="p">,</span> <span class="n">arch</span><span class="p">,</span> <span class="n">fake_dbo</span><span class="p">)</span>
<span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span> <span class="o">=</span> <span class="n">squashfs_args</span><span class="p">(</span><span class="n">opts</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Creating runtime&quot;</span><span class="p">)</span>
<span class="n">rb</span><span class="o">.</span><span class="n">create_runtime</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">work_dir</span><span class="p">,</span> <span class="n">RUNTIME</span><span class="p">),</span> <span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">,</span>
<span class="n">rb</span><span class="o">.</span><span class="n">create_ext4_runtime</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">work_dir</span><span class="p">,</span> <span class="n">RUNTIME</span><span class="p">),</span> <span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">,</span>
<span class="n">compression</span><span class="o">=</span><span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="n">compressargs</span><span class="p">)</span></div>
@ -511,7 +511,8 @@
<span class="n">tb</span> <span class="o">=</span> <span class="n">TreeBuilder</span><span class="p">(</span><span class="n">product</span><span class="o">=</span><span class="n">product</span><span class="p">,</span> <span class="n">arch</span><span class="o">=</span><span class="n">arch</span><span class="p">,</span> <span class="n">domacboot</span><span class="o">=</span><span class="n">opts</span><span class="o">.</span><span class="n">domacboot</span><span class="p">,</span>
<span class="n">inroot</span><span class="o">=</span><span class="n">mount_dir</span><span class="p">,</span> <span class="n">outroot</span><span class="o">=</span><span class="n">work_dir</span><span class="p">,</span>
<span class="n">runtime</span><span class="o">=</span><span class="n">RUNTIME</span><span class="p">,</span> <span class="n">isolabel</span><span class="o">=</span><span class="n">isolabel</span><span class="p">,</span>
<span class="n">templatedir</span><span class="o">=</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">opts</span><span class="o">.</span><span class="n">lorax_templates</span><span class="p">,</span><span class="s2">&quot;live/&quot;</span><span class="p">))</span>
<span class="n">templatedir</span><span class="o">=</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">opts</span><span class="o">.</span><span class="n">lorax_templates</span><span class="p">,</span><span class="s2">&quot;live/&quot;</span><span class="p">),</span>
<span class="n">extra_boot_args</span><span class="o">=</span><span class="n">opts</span><span class="o">.</span><span class="n">extra_boot_args</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Rebuilding initrds&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">opts</span><span class="o">.</span><span class="n">dracut_args</span><span class="p">:</span>
<span class="n">dracut_args</span> <span class="o">=</span> <span class="n">DRACUT_DEFAULT</span>
@ -601,6 +602,8 @@
<span class="sd"> :param str ks: Path to the kickstart to use for the installation</span>
<span class="sd"> :returns: Disk size in MiB</span>
<span class="sd"> :rtype: int</span>
<span class="sd"> Also takes into account the use of reqpart or reqpart --add-boot</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># Disk size for a filesystem image should only be the size of /</span>
<span class="c1"># to prevent surprises when using the same kickstart for different installations.</span>
@ -609,43 +612,80 @@
<span class="n">disk_size</span> <span class="o">=</span> <span class="mi">2</span> <span class="o">+</span> <span class="nb">sum</span><span class="p">(</span><span class="n">p</span><span class="o">.</span><span class="n">size</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">unique_partitions</span><span class="o">.</span><span class="n">values</span><span class="p">()</span> <span class="k">if</span> <span class="n">p</span><span class="o">.</span><span class="n">mountpoint</span> <span class="o">==</span> <span class="s2">&quot;/&quot;</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">disk_size</span> <span class="o">=</span> <span class="mi">2</span> <span class="o">+</span> <span class="nb">sum</span><span class="p">(</span><span class="n">p</span><span class="o">.</span><span class="n">size</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">unique_partitions</span><span class="o">.</span><span class="n">values</span><span class="p">())</span>
<span class="c1"># reqpart can add 1M, 2M, 200M based on platform. Add 500M to be sure</span>
<span class="k">if</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">reqpart</span><span class="o">.</span><span class="n">seen</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Adding 500M for reqpart&quot;</span><span class="p">)</span>
<span class="n">disk_size</span> <span class="o">+=</span> <span class="mi">500</span>
<span class="c1"># It can also request adding /boot which is 1G</span>
<span class="k">if</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">reqpart</span><span class="o">.</span><span class="n">addBoot</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Adding 1024M for reqpart --addboot&quot;</span><span class="p">)</span>
<span class="n">disk_size</span> <span class="o">+=</span> <span class="mi">1024</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">image_size_align</span><span class="p">:</span>
<span class="n">disk_size</span> <span class="o">+=</span> <span class="n">opts</span><span class="o">.</span><span class="n">image_size_align</span> <span class="o">-</span> <span class="p">(</span><span class="n">disk_size</span> <span class="o">%</span> <span class="n">opts</span><span class="o">.</span><span class="n">image_size_align</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Using disk size of </span><span class="si">%s</span><span class="s2">MiB&quot;</span><span class="p">,</span> <span class="n">disk_size</span><span class="p">)</span>
<span class="k">return</span> <span class="n">disk_size</span></div>
<div class="viewcode-block" id="make_image"><a class="viewcode-back" href="../../pylorax.html#pylorax.creator.make_image">[docs]</a><span class="k">def</span> <span class="nf">make_image</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">ks</span><span class="p">):</span>
<div class="viewcode-block" id="make_image"><a class="viewcode-back" href="../../pylorax.html#pylorax.creator.make_image">[docs]</a><span class="k">def</span> <span class="nf">make_image</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">ks</span><span class="p">,</span> <span class="n">cancel_func</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Install to a disk image</span>
<span class="sd"> :param opts: options passed to livemedia-creator</span>
<span class="sd"> :type opts: argparse options</span>
<span class="sd"> :param str ks: Path to the kickstart to use for the installation</span>
<span class="sd"> :param cancel_func: Function that returns True to cancel build</span>
<span class="sd"> :type cancel_func: function</span>
<span class="sd"> :returns: Path of the image created</span>
<span class="sd"> :rtype: str</span>
<span class="sd"> Use qemu+boot.iso or anaconda to install to a disk image.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">image_name</span><span class="p">:</span>
<span class="c1"># For make_tar_disk, opts.image_name is the name of the final tarball.</span>
<span class="c1"># Use opts.tar_disk_name as the name of the disk image</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">make_tar_disk</span><span class="p">:</span>
<span class="n">disk_img</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">opts</span><span class="o">.</span><span class="n">result_dir</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">tar_disk_name</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">opts</span><span class="o">.</span><span class="n">image_name</span><span class="p">:</span>
<span class="n">disk_img</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">opts</span><span class="o">.</span><span class="n">result_dir</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">image_name</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">disk_img</span> <span class="o">=</span> <span class="n">tempfile</span><span class="o">.</span><span class="n">mktemp</span><span class="p">(</span><span class="n">prefix</span><span class="o">=</span><span class="s2">&quot;lmc-disk-&quot;</span><span class="p">,</span> <span class="n">suffix</span><span class="o">=</span><span class="s2">&quot;.img&quot;</span><span class="p">,</span> <span class="nb">dir</span><span class="o">=</span><span class="n">opts</span><span class="o">.</span><span class="n">result_dir</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;disk_img = </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">)</span>
<span class="n">disk_size</span> <span class="o">=</span> <span class="n">calculate_disk_size</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">ks</span><span class="p">)</span>
<span class="c1"># For make_tar_disk, pass a second path parameter for the final tarball</span>
<span class="c1"># not the final output file.</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">make_tar_disk</span><span class="p">:</span>
<span class="n">tar_img</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">opts</span><span class="o">.</span><span class="n">result_dir</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">image_name</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">tar_img</span> <span class="o">=</span> <span class="kc">None</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">no_virt</span><span class="p">:</span>
<span class="n">novirt_install</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">,</span> <span class="n">disk_size</span><span class="p">)</span>
<span class="n">novirt_install</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">,</span> <span class="n">disk_size</span><span class="p">,</span> <span class="n">cancel_func</span><span class="o">=</span><span class="n">cancel_func</span><span class="p">,</span> <span class="n">tar_img</span><span class="o">=</span><span class="n">tar_img</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">install_log</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">opts</span><span class="o">.</span><span class="n">logfile</span><span class="p">))</span><span class="o">+</span><span class="s2">&quot;/virt-install.log&quot;</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;install_log = </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">install_log</span><span class="p">)</span>
<span class="n">virt_install</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">install_log</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">,</span> <span class="n">disk_size</span><span class="p">)</span>
<span class="n">virt_install</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">install_log</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">,</span> <span class="n">disk_size</span><span class="p">,</span> <span class="n">cancel_func</span><span class="o">=</span><span class="n">cancel_func</span><span class="p">,</span> <span class="n">tar_img</span><span class="o">=</span><span class="n">tar_img</span><span class="p">)</span>
<span class="k">except</span> <span class="n">InstallError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;Install failed: </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">e</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">opts</span><span class="o">.</span><span class="n">keep_image</span> <span class="ow">and</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">disk_img</span><span class="p">):</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Removing bad disk image&quot;</span><span class="p">)</span>
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">disk_img</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">opts</span><span class="o">.</span><span class="n">keep_image</span><span class="p">:</span>
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">disk_img</span><span class="p">):</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Removing bad disk image&quot;</span><span class="p">)</span>
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">disk_img</span><span class="p">)</span>
<span class="k">if</span> <span class="n">tar_img</span> <span class="ow">and</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">tar_img</span><span class="p">):</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Removing bad tar file&quot;</span><span class="p">)</span>
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">tar_img</span><span class="p">)</span>
<span class="k">raise</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Disk Image install successful&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">make_tar_disk</span><span class="p">:</span>
<span class="k">return</span> <span class="n">tar_img</span>
<span class="k">return</span> <span class="n">disk_img</span></div>
@ -732,11 +772,54 @@
<span class="k">return</span> <span class="n">work_dir</span></div>
<div class="viewcode-block" id="run_creator"><a class="viewcode-back" href="../../pylorax.html#pylorax.creator.run_creator">[docs]</a><span class="k">def</span> <span class="nf">run_creator</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">callback_func</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<div class="viewcode-block" id="check_kickstart"><a class="viewcode-back" href="../../pylorax.html#pylorax.creator.check_kickstart">[docs]</a><span class="k">def</span> <span class="nf">check_kickstart</span><span class="p">(</span><span class="n">ks</span><span class="p">,</span> <span class="n">opts</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Check the parsed kickstart object for errors</span>
<span class="sd"> :param ks: Parsed Kickstart object</span>
<span class="sd"> :type ks: pykickstart.parser.KickstartParser</span>
<span class="sd"> :param opts: Commandline options to control the process</span>
<span class="sd"> :type opts: Either a DataHolder or ArgumentParser</span>
<span class="sd"> :returns: List of error strings or empty list</span>
<span class="sd"> :rtype: list</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">errors</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">no_virt</span> <span class="ow">and</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">method</span><span class="o">.</span><span class="n">method</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">&quot;url&quot;</span><span class="p">,</span> <span class="s2">&quot;nfs&quot;</span><span class="p">)</span> \
<span class="ow">and</span> <span class="ow">not</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">ostreesetup</span><span class="o">.</span><span class="n">seen</span><span class="p">:</span>
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">&quot;Only url, nfs and ostreesetup install methods are currently supported.&quot;</span>
<span class="s2">&quot;Please fix your kickstart file.&quot;</span> <span class="p">)</span>
<span class="k">if</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">repo</span><span class="o">.</span><span class="n">seen</span> <span class="ow">and</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">method</span><span class="o">.</span><span class="n">method</span> <span class="o">!=</span> <span class="s2">&quot;url&quot;</span><span class="p">:</span>
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">&quot;repo can only be used with the url install method. Add url to your &quot;</span>
<span class="s2">&quot;kickstart file.&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">method</span><span class="o">.</span><span class="n">method</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">&quot;url&quot;</span><span class="p">,</span> <span class="s2">&quot;nfs&quot;</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">network</span><span class="o">.</span><span class="n">seen</span><span class="p">:</span>
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">&quot;The kickstart must activate networking if &quot;</span>
<span class="s2">&quot;the url or nfs install method is used.&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">displaymode</span><span class="o">.</span><span class="n">displayMode</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">&quot;The kickstart must not set a display mode (text, cmdline, &quot;</span>
<span class="s2">&quot;graphical), this will interfere with livemedia-creator.&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">make_fsimage</span> <span class="ow">or</span> <span class="p">(</span><span class="n">opts</span><span class="o">.</span><span class="n">make_pxe_live</span> <span class="ow">and</span> <span class="n">opts</span><span class="o">.</span><span class="n">no_virt</span><span class="p">):</span>
<span class="c1"># Make sure the kickstart isn&#39;t using autopart and only has a / mountpoint</span>
<span class="n">part_ok</span> <span class="o">=</span> <span class="ow">not</span> <span class="nb">any</span><span class="p">(</span><span class="n">p</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">partition</span><span class="o">.</span><span class="n">partitions</span>
<span class="k">if</span> <span class="n">p</span><span class="o">.</span><span class="n">mountpoint</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">&quot;/&quot;</span><span class="p">,</span> <span class="s2">&quot;swap&quot;</span><span class="p">])</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">part_ok</span> <span class="ow">or</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">autopart</span><span class="o">.</span><span class="n">seen</span><span class="p">:</span>
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">&quot;Filesystem images must use a single / part, not autopart or &quot;</span>
<span class="s2">&quot;multiple partitions. swap is allowed but not used.&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">opts</span><span class="o">.</span><span class="n">no_virt</span> <span class="ow">and</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">reboot</span><span class="o">.</span><span class="n">action</span> <span class="o">!=</span> <span class="n">KS_SHUTDOWN</span><span class="p">:</span>
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">&quot;The kickstart must include shutdown when using virt installation.&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">errors</span></div>
<div class="viewcode-block" id="run_creator"><a class="viewcode-back" href="../../pylorax.html#pylorax.creator.run_creator">[docs]</a><span class="k">def</span> <span class="nf">run_creator</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">cancel_func</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Run the image creator process</span>
<span class="sd"> :param opts: Commandline options to control the process</span>
<span class="sd"> :type opts: Either a DataHolder or ArgumentParser</span>
<span class="sd"> :param cancel_func: Function that returns True to cancel build</span>
<span class="sd"> :type cancel_func: function</span>
<span class="sd"> :returns: The result directory and the disk image path.</span>
<span class="sd"> :rtype: Tuple of str</span>
@ -764,38 +847,15 @@
<span class="k">if</span> <span class="ow">not</span> <span class="n">opts</span><span class="o">.</span><span class="n">ks</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">&quot;Image creation requires a kickstart file&quot;</span><span class="p">)</span>
<span class="n">errors</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">no_virt</span> <span class="ow">and</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">method</span><span class="o">.</span><span class="n">method</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">&quot;url&quot;</span><span class="p">,</span> <span class="s2">&quot;nfs&quot;</span><span class="p">)</span> \
<span class="ow">and</span> <span class="ow">not</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">ostreesetup</span><span class="o">.</span><span class="n">seen</span><span class="p">:</span>
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">&quot;Only url, nfs and ostreesetup install methods are currently supported.&quot;</span>
<span class="s2">&quot;Please fix your kickstart file.&quot;</span> <span class="p">)</span>
<span class="k">if</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">method</span><span class="o">.</span><span class="n">method</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">&quot;url&quot;</span><span class="p">,</span> <span class="s2">&quot;nfs&quot;</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">network</span><span class="o">.</span><span class="n">seen</span><span class="p">:</span>
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">&quot;The kickstart must activate networking if &quot;</span>
<span class="s2">&quot;the url or nfs install method is used.&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">displaymode</span><span class="o">.</span><span class="n">displayMode</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">&quot;The kickstart must not set a display mode (text, cmdline, &quot;</span>
<span class="s2">&quot;graphical), this will interfere with livemedia-creator.&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">make_fsimage</span> <span class="ow">or</span> <span class="p">(</span><span class="n">opts</span><span class="o">.</span><span class="n">make_pxe_live</span> <span class="ow">and</span> <span class="n">opts</span><span class="o">.</span><span class="n">no_virt</span><span class="p">):</span>
<span class="c1"># Make sure the kickstart isn&#39;t using autopart and only has a / mountpoint</span>
<span class="n">part_ok</span> <span class="o">=</span> <span class="ow">not</span> <span class="nb">any</span><span class="p">(</span><span class="n">p</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">partition</span><span class="o">.</span><span class="n">partitions</span>
<span class="k">if</span> <span class="n">p</span><span class="o">.</span><span class="n">mountpoint</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">&quot;/&quot;</span><span class="p">,</span> <span class="s2">&quot;swap&quot;</span><span class="p">])</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">part_ok</span> <span class="ow">or</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">autopart</span><span class="o">.</span><span class="n">seen</span><span class="p">:</span>
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">&quot;Filesystem images must use a single / part, not autopart or &quot;</span>
<span class="s2">&quot;multiple partitions. swap is allowed but not used.&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">opts</span><span class="o">.</span><span class="n">no_virt</span> <span class="ow">and</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">reboot</span><span class="o">.</span><span class="n">action</span> <span class="o">!=</span> <span class="n">KS_SHUTDOWN</span><span class="p">:</span>
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">&quot;The kickstart must include shutdown when using virt installation.&quot;</span><span class="p">)</span>
<span class="c1"># Check the kickstart for problems</span>
<span class="n">errors</span> <span class="o">=</span> <span class="n">check_kickstart</span><span class="p">(</span><span class="n">ks</span><span class="p">,</span> <span class="n">opts</span><span class="p">)</span>
<span class="k">if</span> <span class="n">errors</span><span class="p">:</span>
<span class="nb">list</span><span class="p">(</span><span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">errors</span><span class="p">)</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">errors</span><span class="p">))</span>
<span class="c1"># Make the image. Output of this is either a partitioned disk image or a fsimage</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">disk_img</span> <span class="o">=</span> <span class="n">make_image</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">ks</span><span class="p">)</span>
<span class="n">disk_img</span> <span class="o">=</span> <span class="n">make_image</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">ks</span><span class="p">,</span> <span class="n">cancel_func</span><span class="o">=</span><span class="n">cancel_func</span><span class="p">)</span>
<span class="k">except</span> <span class="n">InstallError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;ERROR: Image creation failed: </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">e</span><span class="p">)</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">&quot;Image creation failed: </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">e</span><span class="p">)</span>
@ -815,6 +875,9 @@
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;squashfs.img creation failed&quot;</span><span class="p">)</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">&quot;squashfs.img creation failed&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">cancel_func</span> <span class="ow">and</span> <span class="n">cancel_func</span><span class="p">():</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">&quot;ISO creation canceled&quot;</span><span class="p">)</span>
<span class="k">with</span> <span class="n">Mount</span><span class="p">(</span><span class="n">disk_img</span><span class="p">,</span> <span class="n">opts</span><span class="o">=</span><span class="s2">&quot;loop&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">mount_dir</span><span class="p">:</span>
<span class="n">result_dir</span> <span class="o">=</span> <span class="n">make_livecd</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">mount_dir</span><span class="p">,</span> <span class="n">work_dir</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
@ -904,7 +967,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.decorators &mdash; Lorax 29.21 documentation</title>
<title>pylorax.decorators &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -220,7 +220,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.discinfo &mdash; Lorax 29.21 documentation</title>
<title>pylorax.discinfo &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -178,6 +178,7 @@
<span class="kn">import</span> <span class="nn">logging</span>
<span class="n">logger</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">&quot;pylorax.discinfo&quot;</span><span class="p">)</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">time</span>
@ -188,9 +189,14 @@
<span class="bp">self</span><span class="o">.</span><span class="n">basearch</span> <span class="o">=</span> <span class="n">basearch</span>
<div class="viewcode-block" id="DiscInfo.write"><a class="viewcode-back" href="../../pylorax.html#pylorax.discinfo.DiscInfo.write">[docs]</a> <span class="k">def</span> <span class="nf">write</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">outfile</span><span class="p">):</span>
<span class="k">if</span> <span class="s1">&#39;SOURCE_DATE_EPOCH&#39;</span> <span class="ow">in</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">:</span>
<span class="n">timestamp</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s1">&#39;SOURCE_DATE_EPOCH&#39;</span><span class="p">])</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">timestamp</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;writing .discinfo file&quot;</span><span class="p">)</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">outfile</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">fobj</span><span class="p">:</span>
<span class="n">fobj</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">{0:f}</span><span class="se">\n</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()))</span>
<span class="n">fobj</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">{0:f}</span><span class="se">\n</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">timestamp</span><span class="p">))</span>
<span class="n">fobj</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">{0.release}</span><span class="se">\n</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="p">))</span>
<span class="n">fobj</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">{0.basearch}</span><span class="se">\n</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="p">))</span></div></div>
</pre></div>
@ -229,7 +235,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.dnfbase &mdash; Lorax 29.21 documentation</title>
<title>pylorax.dnfbase &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -375,7 +375,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.dnfhelper &mdash; Lorax 29.21 documentation</title>
<title>pylorax.dnfhelper &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -300,7 +300,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.executils &mdash; Lorax 29.21 documentation</title>
<title>pylorax.executils &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -539,7 +539,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.imgutils &mdash; Lorax 29.21 documentation</title>
<title>pylorax.imgutils &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -156,7 +156,7 @@
<h1>Source code for pylorax.imgutils</h1><div class="highlight"><pre>
<span></span><span class="c1"># imgutils.py - utility functions/classes for building disk images</span>
<span class="c1">#</span>
<span class="c1"># Copyright (C) 2011-2015 Red Hat, Inc.</span>
<span class="c1"># Copyright (C) 2011-2018 Red Hat, Inc.</span>
<span class="c1">#</span>
<span class="c1"># This program is free software; you can redistribute it and/or modify</span>
<span class="c1"># it under the terms of the GNU General Public License as published by</span>
@ -192,8 +192,8 @@
<span class="c1">######## Functions for making container images (cpio, tar, squashfs) ##########</span>
<div class="viewcode-block" id="compress"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.compress">[docs]</a><span class="k">def</span> <span class="nf">compress</span><span class="p">(</span><span class="n">command</span><span class="p">,</span> <span class="n">rootdir</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">compression</span><span class="o">=</span><span class="s2">&quot;xz&quot;</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;Make a compressed archive of the given rootdir.</span>
<div class="viewcode-block" id="compress"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.compress">[docs]</a><span class="k">def</span> <span class="nf">compress</span><span class="p">(</span><span class="n">command</span><span class="p">,</span> <span class="n">root</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">compression</span><span class="o">=</span><span class="s2">&quot;xz&quot;</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;Make a compressed archive of the given rootdir or file.</span>
<span class="sd"> command is a list of the archiver commands to run</span>
<span class="sd"> compression should be &quot;xz&quot;, &quot;gzip&quot;, &quot;lzma&quot;, &quot;bzip2&quot;, or None.</span>
<span class="sd"> compressargs will be used on the compression commandline.&#39;&#39;&#39;</span>
@ -216,12 +216,23 @@
<span class="n">compression</span> <span class="o">=</span> <span class="s2">&quot;pbzip2&quot;</span>
<span class="n">compressargs</span><span class="o">.</span><span class="n">insert</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="s2">&quot;-p</span><span class="si">%d</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">multiprocessing</span><span class="o">.</span><span class="n">cpu_count</span><span class="p">())</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;find </span><span class="si">%s</span><span class="s2"> -print0 |</span><span class="si">%s</span><span class="s2"> | </span><span class="si">%s</span><span class="s2"> </span><span class="si">%s</span><span class="s2"> &gt; </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">rootdir</span><span class="p">,</span> <span class="s2">&quot; &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">command</span><span class="p">),</span>
<span class="n">compression</span><span class="p">,</span> <span class="s2">&quot; &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">compressargs</span><span class="p">),</span> <span class="n">outfile</span><span class="p">)</span>
<span class="n">find</span><span class="p">,</span> <span class="n">archive</span><span class="p">,</span> <span class="n">comp</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="kc">None</span><span class="p">,</span> <span class="kc">None</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">find</span> <span class="o">=</span> <span class="n">Popen</span><span class="p">([</span><span class="s2">&quot;find&quot;</span><span class="p">,</span> <span class="s2">&quot;.&quot;</span><span class="p">,</span> <span class="s2">&quot;-print0&quot;</span><span class="p">],</span> <span class="n">stdout</span><span class="o">=</span><span class="n">PIPE</span><span class="p">,</span> <span class="n">cwd</span><span class="o">=</span><span class="n">rootdir</span><span class="p">)</span>
<span class="n">archive</span> <span class="o">=</span> <span class="n">Popen</span><span class="p">(</span><span class="n">command</span><span class="p">,</span> <span class="n">stdin</span><span class="o">=</span><span class="n">find</span><span class="o">.</span><span class="n">stdout</span><span class="p">,</span> <span class="n">stdout</span><span class="o">=</span><span class="n">PIPE</span><span class="p">,</span> <span class="n">cwd</span><span class="o">=</span><span class="n">rootdir</span><span class="p">)</span>
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">root</span><span class="p">):</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;find </span><span class="si">%s</span><span class="s2"> -print0 |</span><span class="si">%s</span><span class="s2"> | </span><span class="si">%s</span><span class="s2"> </span><span class="si">%s</span><span class="s2"> &gt; </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">root</span><span class="p">,</span> <span class="s2">&quot; &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">command</span><span class="p">),</span>
<span class="n">compression</span><span class="p">,</span> <span class="s2">&quot; &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">compressargs</span><span class="p">),</span> <span class="n">outfile</span><span class="p">)</span>
<span class="n">find</span> <span class="o">=</span> <span class="n">Popen</span><span class="p">([</span><span class="s2">&quot;find&quot;</span><span class="p">,</span> <span class="s2">&quot;.&quot;</span><span class="p">,</span> <span class="s2">&quot;-print0&quot;</span><span class="p">],</span> <span class="n">stdout</span><span class="o">=</span><span class="n">PIPE</span><span class="p">,</span> <span class="n">cwd</span><span class="o">=</span><span class="n">root</span><span class="p">)</span>
<span class="n">archive</span> <span class="o">=</span> <span class="n">Popen</span><span class="p">(</span><span class="n">command</span><span class="p">,</span> <span class="n">stdin</span><span class="o">=</span><span class="n">find</span><span class="o">.</span><span class="n">stdout</span><span class="p">,</span> <span class="n">stdout</span><span class="o">=</span><span class="n">PIPE</span><span class="p">,</span> <span class="n">cwd</span><span class="o">=</span><span class="n">root</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;echo </span><span class="si">%s</span><span class="s2"> |</span><span class="si">%s</span><span class="s2"> | </span><span class="si">%s</span><span class="s2"> </span><span class="si">%s</span><span class="s2"> &gt; </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">root</span><span class="p">,</span> <span class="s2">&quot; &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">command</span><span class="p">),</span>
<span class="n">compression</span><span class="p">,</span> <span class="s2">&quot; &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">compressargs</span><span class="p">),</span> <span class="n">outfile</span><span class="p">)</span>
<span class="n">archive</span> <span class="o">=</span> <span class="n">Popen</span><span class="p">(</span><span class="n">command</span><span class="p">,</span> <span class="n">stdin</span><span class="o">=</span><span class="n">PIPE</span><span class="p">,</span> <span class="n">stdout</span><span class="o">=</span><span class="n">PIPE</span><span class="p">,</span> <span class="n">cwd</span><span class="o">=</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">root</span><span class="p">))</span>
<span class="n">archive</span><span class="o">.</span><span class="n">stdin</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">root</span><span class="p">)</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="s2">&quot;utf-8&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="sa">b</span><span class="s2">&quot;</span><span class="se">\0</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="n">archive</span><span class="o">.</span><span class="n">stdin</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="n">comp</span> <span class="o">=</span> <span class="n">Popen</span><span class="p">([</span><span class="n">compression</span><span class="p">]</span> <span class="o">+</span> <span class="n">compressargs</span><span class="p">,</span>
<span class="n">stdin</span><span class="o">=</span><span class="n">archive</span><span class="o">.</span><span class="n">stdout</span><span class="p">,</span> <span class="n">stdout</span><span class="o">=</span><span class="nb">open</span><span class="p">(</span><span class="n">outfile</span><span class="p">,</span> <span class="s2">&quot;wb&quot;</span><span class="p">))</span>
<span class="n">comp</span><span class="o">.</span><span class="n">wait</span><span class="p">()</span>
@ -232,18 +243,18 @@
<span class="nb">list</span><span class="p">(</span><span class="n">p</span><span class="o">.</span><span class="n">kill</span><span class="p">()</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="p">(</span><span class="n">find</span><span class="p">,</span> <span class="n">archive</span><span class="p">,</span> <span class="n">comp</span><span class="p">)</span> <span class="k">if</span> <span class="n">p</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">1</span></div>
<div class="viewcode-block" id="mkcpio"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.mkcpio">[docs]</a><span class="k">def</span> <span class="nf">mkcpio</span><span class="p">(</span><span class="n">rootdir</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">compression</span><span class="o">=</span><span class="s2">&quot;xz&quot;</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<div class="viewcode-block" id="mkcpio"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.mkcpio">[docs]</a><span class="k">def</span> <span class="nf">mkcpio</span><span class="p">(</span><span class="n">root</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">compression</span><span class="o">=</span><span class="s2">&quot;xz&quot;</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="n">compressargs</span> <span class="o">=</span> <span class="n">compressargs</span> <span class="ow">or</span> <span class="p">[</span><span class="s2">&quot;-9&quot;</span><span class="p">]</span>
<span class="k">return</span> <span class="n">compress</span><span class="p">([</span><span class="s2">&quot;cpio&quot;</span><span class="p">,</span> <span class="s2">&quot;--null&quot;</span><span class="p">,</span> <span class="s2">&quot;--quiet&quot;</span><span class="p">,</span> <span class="s2">&quot;-H&quot;</span><span class="p">,</span> <span class="s2">&quot;newc&quot;</span><span class="p">,</span> <span class="s2">&quot;-o&quot;</span><span class="p">],</span>
<span class="n">rootdir</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="p">)</span></div>
<span class="n">root</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="p">)</span></div>
<div class="viewcode-block" id="mktar"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.mktar">[docs]</a><span class="k">def</span> <span class="nf">mktar</span><span class="p">(</span><span class="n">rootdir</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">compression</span><span class="o">=</span><span class="s2">&quot;xz&quot;</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">selinux</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
<div class="viewcode-block" id="mktar"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.mktar">[docs]</a><span class="k">def</span> <span class="nf">mktar</span><span class="p">(</span><span class="n">root</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">compression</span><span class="o">=</span><span class="s2">&quot;xz&quot;</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">selinux</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
<span class="n">compressargs</span> <span class="o">=</span> <span class="n">compressargs</span> <span class="ow">or</span> <span class="p">[</span><span class="s2">&quot;-9&quot;</span><span class="p">]</span>
<span class="n">tar_cmd</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;tar&quot;</span><span class="p">,</span> <span class="s2">&quot;--no-recursion&quot;</span><span class="p">]</span>
<span class="k">if</span> <span class="n">selinux</span><span class="p">:</span>
<span class="n">tar_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;--selinux&quot;</span><span class="p">,</span> <span class="s2">&quot;--acls&quot;</span><span class="p">,</span> <span class="s2">&quot;--xattrs&quot;</span><span class="p">]</span>
<span class="n">tar_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;-cf-&quot;</span><span class="p">,</span> <span class="s2">&quot;--null&quot;</span><span class="p">,</span> <span class="s2">&quot;-T-&quot;</span><span class="p">]</span>
<span class="k">return</span> <span class="n">compress</span><span class="p">(</span><span class="n">tar_cmd</span><span class="p">,</span> <span class="n">rootdir</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="p">)</span></div>
<span class="k">return</span> <span class="n">compress</span><span class="p">(</span><span class="n">tar_cmd</span><span class="p">,</span> <span class="n">root</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="p">)</span></div>
<div class="viewcode-block" id="mksquashfs"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.mksquashfs">[docs]</a><span class="k">def</span> <span class="nf">mksquashfs</span><span class="p">(</span><span class="n">rootdir</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">compression</span><span class="o">=</span><span class="s2">&quot;default&quot;</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;Make a squashfs image containing the given rootdir.&#39;&#39;&#39;</span>
@ -427,7 +438,7 @@
<span class="sd"> If preserve is False, uses cp -R (useful for modeless filesystems)</span>
<span class="sd"> raises CalledProcessError if copy fails.&#39;&#39;&#39;</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;copytree </span><span class="si">%s</span><span class="s2"> </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">src</span><span class="p">,</span> <span class="n">dest</span><span class="p">)</span>
<span class="n">cp</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;cp&quot;</span><span class="p">,</span> <span class="s2">&quot;-a&quot;</span><span class="p">]</span> <span class="k">if</span> <span class="n">preserve</span> <span class="k">else</span> <span class="p">[</span><span class="s2">&quot;cp&quot;</span><span class="p">,</span> <span class="s2">&quot;-R&quot;</span><span class="p">,</span> <span class="s2">&quot;-L&quot;</span><span class="p">]</span>
<span class="n">cp</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;cp&quot;</span><span class="p">,</span> <span class="s2">&quot;-a&quot;</span><span class="p">]</span> <span class="k">if</span> <span class="n">preserve</span> <span class="k">else</span> <span class="p">[</span><span class="s2">&quot;cp&quot;</span><span class="p">,</span> <span class="s2">&quot;-R&quot;</span><span class="p">,</span> <span class="s2">&quot;-L&quot;</span><span class="p">,</span> <span class="s2">&quot;--preserve=timestamps&quot;</span><span class="p">]</span>
<span class="n">cp</span> <span class="o">+=</span> <span class="p">[</span><span class="n">join</span><span class="p">(</span><span class="n">src</span><span class="p">,</span> <span class="s2">&quot;.&quot;</span><span class="p">),</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">dest</span><span class="p">)]</span>
<span class="n">runcmd</span><span class="p">(</span><span class="n">cp</span><span class="p">)</span></div>
@ -512,6 +523,31 @@
<span class="k">def</span> <span class="nf">__exit__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exc_type</span><span class="p">,</span> <span class="n">exc_value</span><span class="p">,</span> <span class="n">tracebk</span><span class="p">):</span>
<span class="n">umount</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mnt</span><span class="p">)</span></div>
<div class="viewcode-block" id="kpartx_disk_img"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.kpartx_disk_img">[docs]</a><span class="k">def</span> <span class="nf">kpartx_disk_img</span><span class="p">(</span><span class="n">disk_img</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Attach a disk image&#39;s partitions to /dev/loopX using kpartx</span>
<span class="sd"> :param disk_img: The full path to a partitioned disk image</span>
<span class="sd"> :type disk_img: str</span>
<span class="sd"> :returns: list of (loopXpN, size)</span>
<span class="sd"> :rtype: list of tuples</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># Example kpartx output</span>
<span class="c1"># kpartx -p p -v -a /tmp/diskV2DiCW.im</span>
<span class="c1"># add map loop2p1 (253:2): 0 3481600 linear /dev/loop2 2048</span>
<span class="c1"># add map loop2p2 (253:3): 0 614400 linear /dev/loop2 3483648</span>
<span class="n">kpartx_output</span> <span class="o">=</span> <span class="n">runcmd_output</span><span class="p">([</span><span class="s2">&quot;kpartx&quot;</span><span class="p">,</span> <span class="s2">&quot;-v&quot;</span><span class="p">,</span> <span class="s2">&quot;-a&quot;</span><span class="p">,</span> <span class="s2">&quot;-s&quot;</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">])</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="n">kpartx_output</span><span class="p">)</span>
<span class="c1"># list of (deviceName, sizeInBytes)</span>
<span class="n">loop_devices</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">kpartx_output</span><span class="o">.</span><span class="n">splitlines</span><span class="p">():</span>
<span class="c1"># add map loop2p3 (253:4): 0 7139328 linear /dev/loop2 528384</span>
<span class="c1"># 3rd element is size in 512 byte blocks</span>
<span class="k">if</span> <span class="n">line</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">&quot;add map &quot;</span><span class="p">):</span>
<span class="n">fields</span> <span class="o">=</span> <span class="n">line</span><span class="p">[</span><span class="mi">8</span><span class="p">:]</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
<span class="n">loop_devices</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> <span class="p">(</span><span class="n">fields</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="nb">int</span><span class="p">(</span><span class="n">fields</span><span class="p">[</span><span class="mi">3</span><span class="p">])</span><span class="o">*</span><span class="mi">512</span><span class="p">)</span> <span class="p">)</span>
<span class="k">return</span> <span class="n">loop_devices</span></div>
<div class="viewcode-block" id="PartitionMount"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.PartitionMount">[docs]</a><span class="k">class</span> <span class="nc">PartitionMount</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot; Mount a partitioned image file using kpartx &quot;&quot;&quot;</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">,</span> <span class="n">mount_ok</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">submount</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
@ -543,21 +579,8 @@
<span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">mount_ok</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">mount_ok</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">mount_dir</span><span class="p">:</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isfile</span><span class="p">(</span><span class="n">mount_dir</span><span class="o">+</span><span class="s2">&quot;/etc/passwd&quot;</span><span class="p">)</span>
<span class="c1"># Example kpartx output</span>
<span class="c1"># kpartx -p p -v -a /tmp/diskV2DiCW.im</span>
<span class="c1"># add map loop2p1 (253:2): 0 3481600 linear /dev/loop2 2048</span>
<span class="c1"># add map loop2p2 (253:3): 0 614400 linear /dev/loop2 3483648</span>
<span class="n">kpartx_output</span> <span class="o">=</span> <span class="n">runcmd_output</span><span class="p">([</span><span class="s2">&quot;kpartx&quot;</span><span class="p">,</span> <span class="s2">&quot;-v&quot;</span><span class="p">,</span> <span class="s2">&quot;-a&quot;</span><span class="p">,</span> <span class="s2">&quot;-s&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">disk_img</span><span class="p">])</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="n">kpartx_output</span><span class="p">)</span>
<span class="c1"># list of (deviceName, sizeInBytes)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">loop_devices</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">kpartx_output</span><span class="o">.</span><span class="n">splitlines</span><span class="p">():</span>
<span class="c1"># add map loop2p3 (253:4): 0 7139328 linear /dev/loop2 528384</span>
<span class="c1"># 3rd element is size in 512 byte blocks</span>
<span class="k">if</span> <span class="n">line</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">&quot;add map &quot;</span><span class="p">):</span>
<span class="n">fields</span> <span class="o">=</span> <span class="n">line</span><span class="p">[</span><span class="mi">8</span><span class="p">:]</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">loop_devices</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> <span class="p">(</span><span class="n">fields</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="nb">int</span><span class="p">(</span><span class="n">fields</span><span class="p">[</span><span class="mi">3</span><span class="p">])</span><span class="o">*</span><span class="mi">512</span><span class="p">)</span> <span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">loop_devices</span> <span class="o">=</span> <span class="n">kpartx_disk_img</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">disk_img</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">__enter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="c1"># Mount the device selected by mount_ok, if possible</span>
@ -601,7 +624,7 @@
<span class="sd">&#39;&#39;&#39;Generic filesystem image creation function.</span>
<span class="sd"> fstype should be a filesystem type - &quot;mkfs.${fstype}&quot; must exist.</span>
<span class="sd"> graft should be a dict: {&quot;some/path/in/image&quot;: &quot;local/file/or/dir&quot;};</span>
<span class="sd"> if the path ends with a &#39;/&#39; it&#39;s assumed to be a directory.</span>
<span class="sd"> if the path ends with a &#39;/&#39; it&#39;s assumed to be a directory.</span>
<span class="sd"> Will raise CalledProcessError if something goes wrong.&#39;&#39;&#39;</span>
<span class="n">mkfsargs</span> <span class="o">=</span> <span class="n">mkfsargs</span> <span class="ow">or</span> <span class="p">[]</span>
<span class="n">graft</span> <span class="o">=</span> <span class="n">graft</span> <span class="ow">or</span> <span class="p">{}</span>
@ -621,14 +644,21 @@
<span class="n">copytree</span><span class="p">(</span><span class="n">rootdir</span><span class="p">,</span> <span class="n">mnt</span><span class="p">,</span> <span class="n">preserve</span><span class="p">)</span>
<span class="n">do_grafts</span><span class="p">(</span><span class="n">graft</span><span class="p">,</span> <span class="n">mnt</span><span class="p">,</span> <span class="n">preserve</span><span class="p">)</span>
<span class="c1"># Save information about filesystem usage</span>
<span class="n">execWithRedirect</span><span class="p">(</span><span class="s2">&quot;df&quot;</span><span class="p">,</span> <span class="p">[</span><span class="n">mnt</span><span class="p">])</span>
<span class="c1"># Make absolutely sure that the data has been written</span>
<span class="n">runcmd</span><span class="p">([</span><span class="s2">&quot;sync&quot;</span><span class="p">])</span></div>
<span class="c1"># convenience functions with useful defaults</span>
<div class="viewcode-block" id="mkdosimg"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.mkdosimg">[docs]</a><span class="k">def</span> <span class="nf">mkdosimg</span><span class="p">(</span><span class="n">rootdir</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="n">mountargs</span><span class="o">=</span><span class="s2">&quot;shortname=winnt,umask=0077&quot;</span><span class="p">,</span> <span class="n">graft</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="n">graft</span> <span class="o">=</span> <span class="n">graft</span> <span class="ow">or</span> <span class="p">{}</span>
<span class="n">mkfsargs</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;-n&quot;</span><span class="p">,</span> <span class="n">label</span><span class="p">]</span>
<span class="k">if</span> <span class="s1">&#39;SOURCE_DATE_EPOCH&#39;</span> <span class="ow">in</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">:</span>
<span class="n">mkfsargs</span><span class="o">.</span><span class="n">extend</span><span class="p">([</span><span class="s2">&quot;-i&quot;</span><span class="p">,</span>
<span class="s2">&quot;</span><span class="si">{:x}</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s1">&#39;SOURCE_DATE_EPOCH&#39;</span><span class="p">]))])</span>
<span class="n">mkfsimage</span><span class="p">(</span><span class="s2">&quot;msdos&quot;</span><span class="p">,</span> <span class="n">rootdir</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">size</span><span class="p">,</span> <span class="n">mountargs</span><span class="o">=</span><span class="n">mountargs</span><span class="p">,</span>
<span class="n">mkfsargs</span><span class="o">=</span><span class="p">[</span><span class="s2">&quot;-n&quot;</span><span class="p">,</span> <span class="n">label</span><span class="p">],</span> <span class="n">graft</span><span class="o">=</span><span class="n">graft</span><span class="p">)</span></div>
<span class="n">mkfsargs</span><span class="o">=</span><span class="n">mkfsargs</span><span class="p">,</span> <span class="n">graft</span><span class="o">=</span><span class="n">graft</span><span class="p">)</span></div>
<div class="viewcode-block" id="mkext4img"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.mkext4img">[docs]</a><span class="k">def</span> <span class="nf">mkext4img</span><span class="p">(</span><span class="n">rootdir</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="n">mountargs</span><span class="o">=</span><span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="n">graft</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="n">graft</span> <span class="o">=</span> <span class="n">graft</span> <span class="ow">or</span> <span class="p">{}</span>
@ -714,7 +744,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.installer &mdash; Lorax 29.21 documentation</title>
<title>pylorax.installer &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -302,7 +302,7 @@
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">opts</span><span class="p">,</span> <span class="n">iso</span><span class="p">,</span> <span class="n">ks_paths</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">,</span> <span class="n">img_size</span><span class="o">=</span><span class="mi">2048</span><span class="p">,</span>
<span class="n">kernel_args</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">memory</span><span class="o">=</span><span class="mi">1024</span><span class="p">,</span> <span class="n">vcpus</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">vnc</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">arch</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">log_check</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">virtio_host</span><span class="o">=</span><span class="s2">&quot;127.0.0.1&quot;</span><span class="p">,</span> <span class="n">virtio_port</span><span class="o">=</span><span class="mi">6080</span><span class="p">,</span>
<span class="n">cancel_func</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">virtio_host</span><span class="o">=</span><span class="s2">&quot;127.0.0.1&quot;</span><span class="p">,</span> <span class="n">virtio_port</span><span class="o">=</span><span class="mi">6080</span><span class="p">,</span>
<span class="n">image_type</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">boot_uefi</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">ovmf_path</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Start the installation</span>
@ -318,8 +318,8 @@
<span class="sd"> :param int vcpus: Number of virtual cpus</span>
<span class="sd"> :param str vnc: Arguments to pass to qemu -display</span>
<span class="sd"> :param str arch: Optional architecture to use in the virt</span>
<span class="sd"> :param log_check: Method that returns True if the installation fails</span>
<span class="sd"> :type log_check: method</span>
<span class="sd"> :param cancel_func: Function that returns True if the installation fails</span>
<span class="sd"> :type cancel_func: function</span>
<span class="sd"> :param str virtio_host: Hostname to connect virtio log to</span>
<span class="sd"> :param int virtio_port: Port to connect virtio log to</span>
<span class="sd"> :param str image_type: Type of qemu-img disk to create, or None.</span>
@ -331,13 +331,17 @@
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="s2">&quot;/usr/bin/&quot;</span><span class="o">+</span><span class="n">qemu_cmd</span><span class="p">[</span><span class="mi">0</span><span class="p">]):</span>
<span class="k">raise</span> <span class="n">InstallError</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">%s</span><span class="s2"> does not exist, cannot run qemu&quot;</span> <span class="o">%</span> <span class="n">qemu_cmd</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;-nodefconfig&quot;</span><span class="p">]</span>
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;-no-user-config&quot;</span><span class="p">]</span>
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;-m&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">memory</span><span class="p">)]</span>
<span class="k">if</span> <span class="n">vcpus</span><span class="p">:</span>
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;-smp&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">vcpus</span><span class="p">)]</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">opts</span><span class="o">.</span><span class="n">no_kvm</span> <span class="ow">and</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="s2">&quot;/dev/kvm&quot;</span><span class="p">):</span>
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;--machine&quot;</span><span class="p">,</span> <span class="s2">&quot;accel=kvm&quot;</span><span class="p">]</span>
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;-machine&quot;</span><span class="p">,</span> <span class="s2">&quot;accel=kvm&quot;</span><span class="p">]</span>
<span class="k">if</span> <span class="n">boot_uefi</span><span class="p">:</span>
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;-machine&quot;</span><span class="p">,</span> <span class="s2">&quot;q35,smm=on&quot;</span><span class="p">]</span>
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;-global&quot;</span><span class="p">,</span> <span class="s2">&quot;driver=cfi.pflash01,property=secure,value=on&quot;</span><span class="p">]</span>
<span class="c1"># Copy the initrd from the iso, create a cpio archive of the kickstart files</span>
<span class="c1"># and append it to the temporary initrd.</span>
@ -379,7 +383,7 @@
<span class="k">else</span><span class="p">:</span>
<span class="n">display_args</span> <span class="o">=</span> <span class="n">opts</span><span class="o">.</span><span class="n">vnc</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;qemu </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">display_args</span><span class="p">)</span>
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;-nographic&quot;</span><span class="p">,</span> <span class="s2">&quot;-display&quot;</span><span class="p">,</span> <span class="n">display_args</span> <span class="p">]</span>
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;-nographic&quot;</span><span class="p">,</span> <span class="s2">&quot;-monitor&quot;</span><span class="p">,</span> <span class="s2">&quot;none&quot;</span><span class="p">,</span> <span class="s2">&quot;-serial&quot;</span><span class="p">,</span> <span class="s2">&quot;null&quot;</span><span class="p">,</span> <span class="s2">&quot;-display&quot;</span><span class="p">,</span> <span class="n">display_args</span> <span class="p">]</span>
<span class="c1"># Setup the virtio log port</span>
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;-device&quot;</span><span class="p">,</span> <span class="s2">&quot;virtio-serial-pci,id=virtio-serial0&quot;</span><span class="p">]</span>
@ -387,17 +391,20 @@
<span class="s2">&quot;,id=channel0,name=org.fedoraproject.anaconda.log.0&quot;</span><span class="p">]</span>
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;-chardev&quot;</span><span class="p">,</span> <span class="s2">&quot;socket,id=charchannel0,host=</span><span class="si">%s</span><span class="s2">,port=</span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">virtio_host</span><span class="p">,</span> <span class="n">virtio_port</span><span class="p">)]</span>
<span class="c1"># PAss through rng from host</span>
<span class="c1"># Pass through rng from host</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">with_rng</span> <span class="o">!=</span> <span class="s2">&quot;none&quot;</span><span class="p">:</span>
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;-object&quot;</span><span class="p">,</span> <span class="s2">&quot;rng-random,id=virtio-rng0,filename=</span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">opts</span><span class="o">.</span><span class="n">with_rng</span><span class="p">]</span>
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;-device&quot;</span><span class="p">,</span> <span class="s2">&quot;virtio-rng-pci,rng=virtio-rng0,id=rng0,bus=pci.0,addr=0x9&quot;</span><span class="p">]</span>
<span class="k">if</span> <span class="n">boot_uefi</span><span class="p">:</span>
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;-device&quot;</span><span class="p">,</span> <span class="s2">&quot;virtio-rng-pci,rng=virtio-rng0,id=rng0,bus=pcie.0,addr=0x9&quot;</span><span class="p">]</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;-device&quot;</span><span class="p">,</span> <span class="s2">&quot;virtio-rng-pci,rng=virtio-rng0,id=rng0,bus=pci.0,addr=0x9&quot;</span><span class="p">]</span>
<span class="k">if</span> <span class="n">boot_uefi</span> <span class="ow">and</span> <span class="n">ovmf_path</span><span class="p">:</span>
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;-drive&quot;</span><span class="p">,</span> <span class="s2">&quot;file=</span><span class="si">%s</span><span class="s2">/OVMF_CODE.fd,if=pflash,format=raw,unit=0,readonly=on&quot;</span> <span class="o">%</span> <span class="n">ovmf_path</span><span class="p">]</span>
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;-drive&quot;</span><span class="p">,</span> <span class="s2">&quot;file=</span><span class="si">%s</span><span class="s2">/OVMF_CODE.secboot.fd,if=pflash,format=raw,unit=0,readonly=on&quot;</span> <span class="o">%</span> <span class="n">ovmf_path</span><span class="p">]</span>
<span class="c1"># Make a copy of the OVMF_VARS.fd for this run</span>
<span class="c1"># Make a copy of the OVMF_VARS.secboot.fd for this run</span>
<span class="n">ovmf_vars</span> <span class="o">=</span> <span class="n">tempfile</span><span class="o">.</span><span class="n">mktemp</span><span class="p">(</span><span class="n">prefix</span><span class="o">=</span><span class="s2">&quot;lmc-OVMF_VARS-&quot;</span><span class="p">,</span> <span class="n">suffix</span><span class="o">=</span><span class="s2">&quot;.fd&quot;</span><span class="p">)</span>
<span class="n">shutil</span><span class="o">.</span><span class="n">copy2</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">ovmf_path</span><span class="p">,</span> <span class="s2">&quot;/OVMF_VARS.fd&quot;</span><span class="p">),</span> <span class="n">ovmf_vars</span><span class="p">)</span>
<span class="n">shutil</span><span class="o">.</span><span class="n">copy2</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">ovmf_path</span><span class="p">,</span> <span class="s2">&quot;/OVMF_VARS.secboot.fd&quot;</span><span class="p">),</span> <span class="n">ovmf_vars</span><span class="p">)</span>
<span class="n">qemu_cmd</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;-drive&quot;</span><span class="p">,</span> <span class="s2">&quot;file=</span><span class="si">%s</span><span class="s2">,if=pflash,format=raw,unit=1&quot;</span> <span class="o">%</span> <span class="n">ovmf_vars</span><span class="p">]</span>
@ -405,7 +412,7 @@
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="n">qemu_cmd</span><span class="p">)</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">execWithRedirect</span><span class="p">(</span><span class="n">qemu_cmd</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">qemu_cmd</span><span class="p">[</span><span class="mi">1</span><span class="p">:],</span> <span class="n">reset_lang</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">raise_err</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="n">callback</span><span class="o">=</span><span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="ow">not</span> <span class="n">log_check</span><span class="p">())</span>
<span class="n">callback</span><span class="o">=</span><span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="ow">not</span> <span class="p">(</span><span class="n">cancel_func</span> <span class="ow">and</span> <span class="n">cancel_func</span><span class="p">()))</span>
<span class="k">except</span> <span class="n">subprocess</span><span class="o">.</span><span class="n">CalledProcessError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;Running qemu failed:&quot;</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;cmd: </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="s2">&quot; &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">cmd</span><span class="p">))</span>
@ -419,27 +426,30 @@
<span class="k">if</span> <span class="n">boot_uefi</span> <span class="ow">and</span> <span class="n">ovmf_path</span><span class="p">:</span>
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">ovmf_vars</span><span class="p">)</span>
<span class="k">if</span> <span class="n">log_check</span><span class="p">():</span>
<span class="k">if</span> <span class="n">cancel_func</span> <span class="ow">and</span> <span class="n">cancel_func</span><span class="p">():</span>
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;Installation error detected. See logfile for details.&quot;</span><span class="p">)</span>
<span class="k">raise</span> <span class="n">InstallError</span><span class="p">(</span><span class="s2">&quot;QEMUInstall failed&quot;</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Installation finished without errors.&quot;</span><span class="p">)</span></div>
<div class="viewcode-block" id="novirt_log_check"><a class="viewcode-back" href="../../pylorax.html#pylorax.installer.novirt_log_check">[docs]</a><span class="k">def</span> <span class="nf">novirt_log_check</span><span class="p">(</span><span class="n">log_check</span><span class="p">,</span> <span class="n">proc</span><span class="p">):</span>
<div class="viewcode-block" id="novirt_cancel_check"><a class="viewcode-back" href="../../pylorax.html#pylorax.installer.novirt_cancel_check">[docs]</a><span class="k">def</span> <span class="nf">novirt_cancel_check</span><span class="p">(</span><span class="n">cancel_funcs</span><span class="p">,</span> <span class="n">proc</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Check to see if there has been an error in the logs</span>
<span class="sd"> :param log_check: method to call to check for an error in the logs</span>
<span class="sd"> :param cancel_funcs: list of functions to call, True from any one cancels the build</span>
<span class="sd"> :type cancel_funcs: list</span>
<span class="sd"> :param proc: Popen object for the anaconda process</span>
<span class="sd"> :type proc: subprocess.Popen</span>
<span class="sd"> :returns: True if the process has been terminated</span>
<span class="sd"> The log_check method should return a True if an error has been detected.</span>
<span class="sd"> The cancel_funcs functions should return a True if an error has been detected.</span>
<span class="sd"> When an error is detected the process is terminated and this returns True</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="n">log_check</span><span class="p">():</span>
<span class="n">proc</span><span class="o">.</span><span class="n">terminate</span><span class="p">()</span>
<span class="k">return</span> <span class="kc">True</span>
<span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="n">cancel_funcs</span><span class="p">:</span>
<span class="k">if</span> <span class="n">f</span><span class="p">():</span>
<span class="n">proc</span><span class="o">.</span><span class="n">terminate</span><span class="p">()</span>
<span class="k">return</span> <span class="kc">True</span>
<span class="k">return</span> <span class="kc">False</span></div>
@ -470,7 +480,7 @@
<span class="k">return</span> <span class="n">rc</span></div>
<div class="viewcode-block" id="novirt_install"><a class="viewcode-back" href="../../pylorax.html#pylorax.installer.novirt_install">[docs]</a><span class="k">def</span> <span class="nf">novirt_install</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">,</span> <span class="n">disk_size</span><span class="p">):</span>
<div class="viewcode-block" id="novirt_install"><a class="viewcode-back" href="../../pylorax.html#pylorax.installer.novirt_install">[docs]</a><span class="k">def</span> <span class="nf">novirt_install</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">,</span> <span class="n">disk_size</span><span class="p">,</span> <span class="n">cancel_func</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">tar_img</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Use Anaconda to install to a disk image</span>
@ -478,6 +488,9 @@
<span class="sd"> :type opts: argparse options</span>
<span class="sd"> :param str disk_img: The full path to the disk image to be created</span>
<span class="sd"> :param int disk_size: The size of the disk_img in MiB</span>
<span class="sd"> :param cancel_func: Function that returns True to cancel build</span>
<span class="sd"> :type cancel_func: function</span>
<span class="sd"> :param str tar_img: For make_tar_disk, the path to final tarball to be created</span>
<span class="sd"> This method runs anaconda to create the image and then based on the opts</span>
<span class="sd"> passed creates a qemu disk image or tarfile.</span>
@ -527,6 +540,9 @@
<span class="n">log_monitor</span> <span class="o">=</span> <span class="n">LogMonitor</span><span class="p">(</span><span class="n">timeout</span><span class="o">=</span><span class="n">opts</span><span class="o">.</span><span class="n">timeout</span><span class="p">)</span>
<span class="n">args</span> <span class="o">+=</span> <span class="p">[</span><span class="s2">&quot;--remotelog&quot;</span><span class="p">,</span> <span class="s2">&quot;</span><span class="si">%s</span><span class="s2">:</span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">log_monitor</span><span class="o">.</span><span class="n">host</span><span class="p">,</span> <span class="n">log_monitor</span><span class="o">.</span><span class="n">port</span><span class="p">)]</span>
<span class="n">cancel_funcs</span> <span class="o">=</span> <span class="p">[</span><span class="n">log_monitor</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">log_check</span><span class="p">]</span>
<span class="k">if</span> <span class="n">cancel_func</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">cancel_funcs</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cancel_func</span><span class="p">)</span>
<span class="c1"># Make sure anaconda has the right product and release</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Running anaconda.&quot;</span><span class="p">)</span>
@ -534,11 +550,11 @@
<span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">execReadlines</span><span class="p">(</span><span class="s2">&quot;anaconda&quot;</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">reset_lang</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="n">env_add</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;ANACONDA_PRODUCTNAME&quot;</span><span class="p">:</span> <span class="n">opts</span><span class="o">.</span><span class="n">project</span><span class="p">,</span>
<span class="s2">&quot;ANACONDA_PRODUCTVERSION&quot;</span><span class="p">:</span> <span class="n">opts</span><span class="o">.</span><span class="n">releasever</span><span class="p">},</span>
<span class="n">callback</span><span class="o">=</span><span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="ow">not</span> <span class="n">novirt_log_check</span><span class="p">(</span><span class="n">log_monitor</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">log_check</span><span class="p">,</span> <span class="n">p</span><span class="p">)):</span>
<span class="n">callback</span><span class="o">=</span><span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="ow">not</span> <span class="n">novirt_cancel_check</span><span class="p">(</span><span class="n">cancel_funcs</span><span class="p">,</span> <span class="n">p</span><span class="p">)):</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="n">line</span><span class="p">)</span>
<span class="c1"># Make sure the new filesystem is correctly labeled</span>
<span class="n">setfiles_args</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;-e&quot;</span><span class="p">,</span> <span class="s2">&quot;/proc&quot;</span><span class="p">,</span> <span class="s2">&quot;-e&quot;</span><span class="p">,</span> <span class="s2">&quot;/sys&quot;</span><span class="p">,</span> <span class="s2">&quot;-e&quot;</span><span class="p">,</span> <span class="s2">&quot;/dev&quot;</span><span class="p">,</span>
<span class="n">setfiles_args</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;-e&quot;</span><span class="p">,</span> <span class="s2">&quot;/proc&quot;</span><span class="p">,</span> <span class="s2">&quot;-e&quot;</span><span class="p">,</span> <span class="s2">&quot;/sys&quot;</span><span class="p">,</span>
<span class="s2">&quot;/etc/selinux/targeted/contexts/files/file_contexts&quot;</span><span class="p">,</span> <span class="s2">&quot;/&quot;</span><span class="p">]</span>
<span class="k">if</span> <span class="s2">&quot;--dirinstall&quot;</span> <span class="ow">in</span> <span class="n">args</span><span class="p">:</span>
@ -580,10 +596,14 @@
<span class="k">if</span> <span class="ow">not</span> <span class="n">opts</span><span class="o">.</span><span class="n">make_iso</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">opts</span><span class="o">.</span><span class="n">make_fsimage</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">opts</span><span class="o">.</span><span class="n">make_pxe_live</span><span class="p">:</span>
<span class="n">dm_name</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">disk_img</span><span class="p">))[</span><span class="mi">0</span><span class="p">]</span>
<span class="n">dm_path</span> <span class="o">=</span> <span class="s2">&quot;/dev/mapper/&quot;</span><span class="o">+</span><span class="n">dm_name</span>
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">dm_path</span><span class="p">):</span>
<span class="n">dm_detach</span><span class="p">(</span><span class="n">dm_path</span><span class="p">)</span>
<span class="n">loop_detach</span><span class="p">(</span><span class="n">get_loop_name</span><span class="p">(</span><span class="n">disk_img</span><span class="p">))</span>
<span class="c1"># Remove device-mapper for partitions and disk</span>
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;Removing device-mapper setup on </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">dm_name</span><span class="p">)</span>
<span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">glob</span><span class="o">.</span><span class="n">glob</span><span class="p">(</span><span class="s2">&quot;/dev/mapper/&quot;</span><span class="o">+</span><span class="n">dm_name</span><span class="o">+</span><span class="s2">&quot;*&quot;</span><span class="p">),</span> <span class="n">reverse</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
<span class="n">dm_detach</span><span class="p">(</span><span class="n">d</span><span class="p">)</span>
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;Removing loop device for </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">)</span>
<span class="n">loop_detach</span><span class="p">(</span><span class="s2">&quot;/dev/&quot;</span><span class="o">+</span><span class="n">get_loop_name</span><span class="p">(</span><span class="n">disk_img</span><span class="p">))</span>
<span class="c1"># qemu disk image is used by bare qcow2 images and by Vagrant</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">image_type</span><span class="p">:</span>
@ -646,10 +666,22 @@
<span class="k">raise</span> <span class="n">InstallError</span><span class="p">(</span><span class="s2">&quot;novirt_install mktar failed: rc=</span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">rc</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># For raw disk images, use fallocate to deallocate unused space</span>
<span class="n">execWithRedirect</span><span class="p">(</span><span class="s2">&quot;fallocate&quot;</span><span class="p">,</span> <span class="p">[</span><span class="s2">&quot;--dig-holes&quot;</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">],</span> <span class="n">raise_err</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span></div>
<span class="n">execWithRedirect</span><span class="p">(</span><span class="s2">&quot;fallocate&quot;</span><span class="p">,</span> <span class="p">[</span><span class="s2">&quot;--dig-holes&quot;</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">],</span> <span class="n">raise_err</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="c1"># For make_tar_disk, wrap the result in a tar file, and remove the original disk image.</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">make_tar_disk</span><span class="p">:</span>
<span class="n">compress_args</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">opts</span><span class="o">.</span><span class="n">compress_args</span><span class="p">:</span>
<span class="n">compress_args</span> <span class="o">+=</span> <span class="n">arg</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">&quot; &quot;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<div class="viewcode-block" id="virt_install"><a class="viewcode-back" href="../../pylorax.html#pylorax.installer.virt_install">[docs]</a><span class="k">def</span> <span class="nf">virt_install</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">install_log</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">,</span> <span class="n">disk_size</span><span class="p">):</span>
<span class="n">rc</span> <span class="o">=</span> <span class="n">mktar</span><span class="p">(</span><span class="n">disk_img</span><span class="p">,</span> <span class="n">tar_img</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">compression</span><span class="p">,</span> <span class="n">compress_args</span><span class="p">,</span> <span class="n">selinux</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="k">if</span> <span class="n">rc</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">InstallError</span><span class="p">(</span><span class="s2">&quot;novirt_install mktar failed: rc=</span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">rc</span><span class="p">)</span>
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">disk_img</span><span class="p">)</span></div>
<div class="viewcode-block" id="virt_install"><a class="viewcode-back" href="../../pylorax.html#pylorax.installer.virt_install">[docs]</a><span class="k">def</span> <span class="nf">virt_install</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">install_log</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">,</span> <span class="n">disk_size</span><span class="p">,</span> <span class="n">cancel_func</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">tar_img</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Use qemu to install to a disk image</span>
@ -658,6 +690,9 @@
<span class="sd"> :param str install_log: The path to write the log from qemu</span>
<span class="sd"> :param str disk_img: The full path to the disk image to be created</span>
<span class="sd"> :param int disk_size: The size of the disk_img in MiB</span>
<span class="sd"> :param cancel_func: Function that returns True to cancel build</span>
<span class="sd"> :type cancel_func: function</span>
<span class="sd"> :param str tar_img: For make_tar_disk, the path to final tarball to be created</span>
<span class="sd"> This uses qemu with a boot.iso and a kickstart to create a disk</span>
<span class="sd"> image and then optionally, based on the opts passed, creates tarfile.</span>
@ -668,6 +703,9 @@
<span class="k">raise</span> <span class="n">InstallError</span><span class="p">(</span><span class="s2">&quot;ISO is missing stage2, cannot continue&quot;</span><span class="p">)</span>
<span class="n">log_monitor</span> <span class="o">=</span> <span class="n">LogMonitor</span><span class="p">(</span><span class="n">install_log</span><span class="p">,</span> <span class="n">timeout</span><span class="o">=</span><span class="n">opts</span><span class="o">.</span><span class="n">timeout</span><span class="p">)</span>
<span class="n">cancel_funcs</span> <span class="o">=</span> <span class="p">[</span><span class="n">log_monitor</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">log_check</span><span class="p">]</span>
<span class="k">if</span> <span class="n">cancel_func</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">cancel_funcs</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cancel_func</span><span class="p">)</span>
<span class="n">kernel_args</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">kernel_args</span><span class="p">:</span>
@ -692,7 +730,7 @@
<span class="k">try</span><span class="p">:</span>
<span class="n">QEMUInstall</span><span class="p">(</span><span class="n">opts</span><span class="p">,</span> <span class="n">iso_mount</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">ks</span><span class="p">,</span> <span class="n">diskimg_path</span><span class="p">,</span> <span class="n">disk_size</span><span class="p">,</span>
<span class="n">kernel_args</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">ram</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">vcpus</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">vnc</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">arch</span><span class="p">,</span>
<span class="n">log_check</span> <span class="o">=</span> <span class="n">log_monitor</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">log_check</span><span class="p">,</span>
<span class="n">cancel_func</span> <span class="o">=</span> <span class="k">lambda</span> <span class="p">:</span> <span class="nb">any</span><span class="p">(</span><span class="n">f</span><span class="p">()</span> <span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="n">cancel_funcs</span><span class="p">),</span>
<span class="n">virtio_host</span> <span class="o">=</span> <span class="n">log_monitor</span><span class="o">.</span><span class="n">host</span><span class="p">,</span>
<span class="n">virtio_port</span> <span class="o">=</span> <span class="n">log_monitor</span><span class="o">.</span><span class="n">port</span><span class="p">,</span>
<span class="n">image_type</span><span class="o">=</span><span class="n">opts</span><span class="o">.</span><span class="n">image_type</span><span class="p">,</span> <span class="n">boot_uefi</span><span class="o">=</span><span class="n">opts</span><span class="o">.</span><span class="n">virt_uefi</span><span class="p">,</span>
@ -711,6 +749,8 @@
<span class="k">else</span><span class="p">:</span>
<span class="n">msg</span> <span class="o">=</span> <span class="s2">&quot;virt_install failed on line: </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">log_monitor</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">error_line</span>
<span class="k">raise</span> <span class="n">InstallError</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">cancel_func</span> <span class="ow">and</span> <span class="n">cancel_func</span><span class="p">():</span>
<span class="k">raise</span> <span class="n">InstallError</span><span class="p">(</span><span class="s2">&quot;virt_install canceled by cancel_func&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">make_fsimage</span><span class="p">:</span>
<span class="n">mkfsimage_from_disk</span><span class="p">(</span><span class="n">diskimg_path</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">,</span> <span class="n">disk_size</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="n">opts</span><span class="o">.</span><span class="n">fs_label</span><span class="p">)</span>
@ -766,7 +806,20 @@
<span class="n">rc</span> <span class="o">=</span> <span class="n">mktar</span><span class="p">(</span><span class="n">vagrant_dir</span><span class="p">,</span> <span class="n">disk_img</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">compression</span><span class="p">,</span> <span class="n">compress_args</span><span class="p">,</span> <span class="n">selinux</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="k">if</span> <span class="n">rc</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">InstallError</span><span class="p">(</span><span class="s2">&quot;virt_install failed&quot;</span><span class="p">)</span>
<span class="n">shutil</span><span class="o">.</span><span class="n">rmtree</span><span class="p">(</span><span class="n">vagrant_dir</span><span class="p">)</span></div>
<span class="n">shutil</span><span class="o">.</span><span class="n">rmtree</span><span class="p">(</span><span class="n">vagrant_dir</span><span class="p">)</span>
<span class="c1"># For make_tar_disk, wrap the result in a tar file, and remove the original disk image.</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">make_tar_disk</span><span class="p">:</span>
<span class="n">compress_args</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">opts</span><span class="o">.</span><span class="n">compress_args</span><span class="p">:</span>
<span class="n">compress_args</span> <span class="o">+=</span> <span class="n">arg</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">&quot; &quot;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="n">rc</span> <span class="o">=</span> <span class="n">mktar</span><span class="p">(</span><span class="n">disk_img</span><span class="p">,</span> <span class="n">tar_img</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">compression</span><span class="p">,</span> <span class="n">compress_args</span><span class="p">,</span> <span class="n">selinux</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="k">if</span> <span class="n">rc</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">InstallError</span><span class="p">(</span><span class="s2">&quot;virt_install mktar failed: rc=</span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">rc</span><span class="p">)</span>
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">disk_img</span><span class="p">)</span></div>
</pre></div>
</div>
@ -803,7 +856,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.ltmpl &mdash; Lorax 29.21 documentation</title>
<title>pylorax.ltmpl &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -223,10 +223,16 @@
<span class="c1"># remove comments</span>
<span class="n">lines</span> <span class="o">=</span> <span class="p">[</span><span class="n">line</span> <span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">lines</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">line</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">&quot;#&quot;</span><span class="p">)]</span>
<span class="c1"># split with shlex and perform brace expansion</span>
<span class="n">lines</span> <span class="o">=</span> <span class="p">[</span><span class="n">split_and_expand</span><span class="p">(</span><span class="n">line</span><span class="p">)</span> <span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">lines</span><span class="p">]</span>
<span class="k">return</span> <span class="n">lines</span></div></div>
<span class="c1"># split with shlex and perform brace expansion. This can fail, so we unroll the loop</span>
<span class="c1"># for better error reporting.</span>
<span class="n">expanded_lines</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">lines</span><span class="p">:</span>
<span class="n">expanded_lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">split_and_expand</span><span class="p">(</span><span class="n">line</span><span class="p">))</span>
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s1">&#39;shlex error processing &quot;</span><span class="si">%s</span><span class="s1">&quot;: </span><span class="si">%s</span><span class="s1">&#39;</span><span class="p">,</span> <span class="n">line</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
<span class="k">raise</span>
<span class="k">return</span> <span class="n">expanded_lines</span></div></div>
<div class="viewcode-block" id="split_and_expand"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.split_and_expand">[docs]</a><span class="k">def</span> <span class="nf">split_and_expand</span><span class="p">(</span><span class="n">line</span><span class="p">):</span>
<span class="k">return</span> <span class="p">[</span><span class="n">exp</span> <span class="k">for</span> <span class="n">word</span> <span class="ow">in</span> <span class="n">shlex</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="n">line</span><span class="p">)</span> <span class="k">for</span> <span class="n">exp</span> <span class="ow">in</span> <span class="n">brace_expand</span><span class="p">(</span><span class="n">word</span><span class="p">)]</span></div>
@ -259,8 +265,83 @@
<span class="k">return</span> <span class="kc">True</span>
<span class="k">return</span> <span class="kc">False</span></div>
<div class="viewcode-block" id="TemplateRunner"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.TemplateRunner">[docs]</a><span class="k">class</span> <span class="nc">TemplateRunner</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> This class parses and executes Lorax templates. Sample usage:</span>
<span class="sd"> # install a bunch of packages</span>
<span class="sd"> runner = LoraxTemplateRunner(inroot=rundir, outroot=rundir, dbo=dnf_obj)</span>
<span class="sd"> runner.run(&quot;install-packages.ltmpl&quot;)</span>
<span class="sd"> NOTES:</span>
<span class="sd"> * Parsing procedure is roughly:</span>
<span class="sd"> 1. Mako template expansion (on the whole file)</span>
<span class="sd"> 2. For each line of the result,</span>
<span class="sd"> a. Whitespace splitting (using shlex.split())</span>
<span class="sd"> b. Brace expansion (using brace_expand())</span>
<span class="sd"> c. If the first token is the name of a function, call that function</span>
<span class="sd"> with the rest of the line as arguments</span>
<span class="sd"> * Parsing and execution are *separate* passes - so you can&#39;t use the result</span>
<span class="sd"> of a command in an %if statement (or any other control statements)!</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fatalerrors</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">templatedir</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">builtins</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">fatalerrors</span> <span class="o">=</span> <span class="n">fatalerrors</span>
<span class="bp">self</span><span class="o">.</span><span class="n">templatedir</span> <span class="o">=</span> <span class="n">templatedir</span> <span class="ow">or</span> <span class="s2">&quot;/usr/share/lorax&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">templatefile</span> <span class="o">=</span> <span class="kc">None</span>
<span class="bp">self</span><span class="o">.</span><span class="n">builtins</span> <span class="o">=</span> <span class="n">builtins</span> <span class="ow">or</span> <span class="p">{}</span>
<span class="bp">self</span><span class="o">.</span><span class="n">defaults</span> <span class="o">=</span> <span class="n">defaults</span> <span class="ow">or</span> <span class="p">{}</span>
<div class="viewcode-block" id="TemplateRunner.run"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.TemplateRunner.run">[docs]</a> <span class="k">def</span> <span class="nf">run</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">templatefile</span><span class="p">,</span> <span class="o">**</span><span class="n">variables</span><span class="p">):</span>
<span class="k">for</span> <span class="n">k</span><span class="p">,</span><span class="n">v</span> <span class="ow">in</span> <span class="nb">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">defaults</span><span class="o">.</span><span class="n">items</span><span class="p">())</span> <span class="o">+</span> <span class="nb">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">builtins</span><span class="o">.</span><span class="n">items</span><span class="p">()):</span>
<span class="n">variables</span><span class="o">.</span><span class="n">setdefault</span><span class="p">(</span><span class="n">k</span><span class="p">,</span><span class="n">v</span><span class="p">)</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;executing </span><span class="si">%s</span><span class="s2"> with variables=</span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">templatefile</span><span class="p">,</span> <span class="n">variables</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">templatefile</span> <span class="o">=</span> <span class="n">templatefile</span>
<span class="n">t</span> <span class="o">=</span> <span class="n">LoraxTemplate</span><span class="p">(</span><span class="n">directories</span><span class="o">=</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">templatedir</span><span class="p">])</span>
<span class="n">commands</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="n">templatefile</span><span class="p">,</span> <span class="n">variables</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_run</span><span class="p">(</span><span class="n">commands</span><span class="p">)</span></div>
<span class="k">def</span> <span class="nf">_run</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parsed_template</span><span class="p">):</span>
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;running </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">templatefile</span><span class="p">)</span>
<span class="k">for</span> <span class="p">(</span><span class="n">num</span><span class="p">,</span> <span class="n">line</span><span class="p">)</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">parsed_template</span><span class="p">,</span><span class="mi">1</span><span class="p">):</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;template line </span><span class="si">%i</span><span class="s2">: </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">num</span><span class="p">,</span> <span class="s2">&quot; &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">line</span><span class="p">))</span>
<span class="n">skiperror</span> <span class="o">=</span> <span class="kc">False</span>
<span class="p">(</span><span class="n">cmd</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span> <span class="o">=</span> <span class="p">(</span><span class="n">line</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">line</span><span class="p">[</span><span class="mi">1</span><span class="p">:])</span>
<span class="c1"># Following Makefile convention, if the command is prefixed with</span>
<span class="c1"># a dash (&#39;-&#39;), we&#39;ll ignore any errors on that line.</span>
<span class="k">if</span> <span class="n">cmd</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="p">):</span>
<span class="n">cmd</span> <span class="o">=</span> <span class="n">cmd</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
<span class="n">skiperror</span> <span class="o">=</span> <span class="kc">True</span>
<span class="k">try</span><span class="p">:</span>
<span class="c1"># grab the method named in cmd and pass it the given arguments</span>
<span class="n">f</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cmd</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="k">if</span> <span class="n">cmd</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;_&#39;</span> <span class="ow">or</span> <span class="n">cmd</span> <span class="o">==</span> <span class="s1">&#39;run&#39;</span> <span class="ow">or</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="n">collections</span><span class="o">.</span><span class="n">Callable</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;unknown command </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">cmd</span><span class="p">)</span>
<span class="n">f</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">Exception</span><span class="p">:</span> <span class="c1"># pylint: disable=broad-except</span>
<span class="k">if</span> <span class="n">skiperror</span><span class="p">:</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;ignoring error&quot;</span><span class="p">)</span>
<span class="k">continue</span>
<span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;template command error in </span><span class="si">%s</span><span class="s2">:&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">templatefile</span><span class="p">)</span>
<span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot; </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="s2">&quot; &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">line</span><span class="p">))</span>
<span class="c1"># format the exception traceback</span>
<span class="n">exclines</span> <span class="o">=</span> <span class="n">traceback</span><span class="o">.</span><span class="n">format_exception</span><span class="p">(</span><span class="o">*</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_info</span><span class="p">())</span>
<span class="c1"># skip the bit about &quot;ltmpl.py, in _run()&quot; - we know that</span>
<span class="n">exclines</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="c1"># log the &quot;ErrorType: this is what happened&quot; line</span>
<span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot; </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">exclines</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">())</span>
<span class="c1"># and log the entire traceback to the debug log</span>
<span class="k">for</span> <span class="n">_line</span> <span class="ow">in</span> <span class="s1">&#39;&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">exclines</span><span class="p">)</span><span class="o">.</span><span class="n">splitlines</span><span class="p">():</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot; </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">_line</span><span class="p">)</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fatalerrors</span><span class="p">:</span>
<span class="k">raise</span></div>
<span class="c1"># TODO: operate inside an actual chroot for safety? Not that RPM bothers..</span>
<div class="viewcode-block" id="LoraxTemplateRunner"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.LoraxTemplateRunner">[docs]</a><span class="k">class</span> <span class="nc">LoraxTemplateRunner</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<div class="viewcode-block" id="LoraxTemplateRunner"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.LoraxTemplateRunner">[docs]</a><span class="k">class</span> <span class="nc">LoraxTemplateRunner</span><span class="p">(</span><span class="n">TemplateRunner</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> This class parses and executes Lorax templates. Sample usage:</span>
@ -274,17 +355,6 @@
<span class="sd"> NOTES:</span>
<span class="sd"> * Parsing procedure is roughly:</span>
<span class="sd"> 1. Mako template expansion (on the whole file)</span>
<span class="sd"> 2. For each line of the result,</span>
<span class="sd"> a. Whitespace splitting (using shlex.split())</span>
<span class="sd"> b. Brace expansion (using brace_expand())</span>
<span class="sd"> c. If the first token is the name of a function, call that function</span>
<span class="sd"> with the rest of the line as arguments</span>
<span class="sd"> * Parsing and execution are *separate* passes - so you can&#39;t use the result</span>
<span class="sd"> of a command in an %if statement (or any other control statements)!</span>
<span class="sd"> * Commands that run external programs (e.g. systemctl) currently use</span>
<span class="sd"> the *host*&#39;s copy of that program, which may cause problems if there&#39;s a</span>
<span class="sd"> big enough difference between the host and the image you&#39;re modifying.</span>
@ -307,14 +377,11 @@
<span class="bp">self</span><span class="o">.</span><span class="n">inroot</span> <span class="o">=</span> <span class="n">inroot</span>
<span class="bp">self</span><span class="o">.</span><span class="n">outroot</span> <span class="o">=</span> <span class="n">outroot</span>
<span class="bp">self</span><span class="o">.</span><span class="n">dbo</span> <span class="o">=</span> <span class="n">dbo</span>
<span class="bp">self</span><span class="o">.</span><span class="n">fatalerrors</span> <span class="o">=</span> <span class="n">fatalerrors</span>
<span class="bp">self</span><span class="o">.</span><span class="n">templatedir</span> <span class="o">=</span> <span class="n">templatedir</span> <span class="ow">or</span> <span class="s2">&quot;/usr/share/lorax&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">templatefile</span> <span class="o">=</span> <span class="kc">None</span>
<span class="c1"># some builtin methods</span>
<span class="bp">self</span><span class="o">.</span><span class="n">builtins</span> <span class="o">=</span> <span class="n">DataHolder</span><span class="p">(</span><span class="n">exists</span><span class="o">=</span><span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="n">rexists</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">root</span><span class="o">=</span><span class="n">inroot</span><span class="p">),</span>
<span class="n">glob</span><span class="o">=</span><span class="k">lambda</span> <span class="n">g</span><span class="p">:</span> <span class="nb">list</span><span class="p">(</span><span class="n">rglob</span><span class="p">(</span><span class="n">g</span><span class="p">,</span> <span class="n">root</span><span class="o">=</span><span class="n">inroot</span><span class="p">)))</span>
<span class="bp">self</span><span class="o">.</span><span class="n">defaults</span> <span class="o">=</span> <span class="n">defaults</span> <span class="ow">or</span> <span class="p">{}</span>
<span class="n">builtins</span> <span class="o">=</span> <span class="n">DataHolder</span><span class="p">(</span><span class="n">exists</span><span class="o">=</span><span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="n">rexists</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">root</span><span class="o">=</span><span class="n">inroot</span><span class="p">),</span>
<span class="n">glob</span><span class="o">=</span><span class="k">lambda</span> <span class="n">g</span><span class="p">:</span> <span class="nb">list</span><span class="p">(</span><span class="n">rglob</span><span class="p">(</span><span class="n">g</span><span class="p">,</span> <span class="n">root</span><span class="o">=</span><span class="n">inroot</span><span class="p">)))</span>
<span class="bp">self</span><span class="o">.</span><span class="n">results</span> <span class="o">=</span> <span class="n">DataHolder</span><span class="p">(</span><span class="n">treeinfo</span><span class="o">=</span><span class="nb">dict</span><span class="p">())</span> <span class="c1"># just treeinfo for now</span>
<span class="nb">super</span><span class="p">(</span><span class="n">LoraxTemplateRunner</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">fatalerrors</span><span class="p">,</span> <span class="n">templatedir</span><span class="p">,</span> <span class="n">defaults</span><span class="p">,</span> <span class="n">builtins</span><span class="p">)</span>
<span class="c1"># TODO: set up custom logger with a filter to add line info</span>
<span class="k">def</span> <span class="nf">_out</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">):</span>
@ -365,51 +432,6 @@
<span class="k">for</span> <span class="n">pkg</span> <span class="ow">in</span> <span class="n">debug_pkgs</span><span class="p">:</span>
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">%s</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">pkg</span><span class="p">)</span>
<div class="viewcode-block" id="LoraxTemplateRunner.run"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.run">[docs]</a> <span class="k">def</span> <span class="nf">run</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">templatefile</span><span class="p">,</span> <span class="o">**</span><span class="n">variables</span><span class="p">):</span>
<span class="k">for</span> <span class="n">k</span><span class="p">,</span><span class="n">v</span> <span class="ow">in</span> <span class="nb">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">defaults</span><span class="o">.</span><span class="n">items</span><span class="p">())</span> <span class="o">+</span> <span class="nb">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">builtins</span><span class="o">.</span><span class="n">items</span><span class="p">()):</span>
<span class="n">variables</span><span class="o">.</span><span class="n">setdefault</span><span class="p">(</span><span class="n">k</span><span class="p">,</span><span class="n">v</span><span class="p">)</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;executing </span><span class="si">%s</span><span class="s2"> with variables=</span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">templatefile</span><span class="p">,</span> <span class="n">variables</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">templatefile</span> <span class="o">=</span> <span class="n">templatefile</span>
<span class="n">t</span> <span class="o">=</span> <span class="n">LoraxTemplate</span><span class="p">(</span><span class="n">directories</span><span class="o">=</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">templatedir</span><span class="p">])</span>
<span class="n">commands</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="n">templatefile</span><span class="p">,</span> <span class="n">variables</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_run</span><span class="p">(</span><span class="n">commands</span><span class="p">)</span></div>
<span class="k">def</span> <span class="nf">_run</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parsed_template</span><span class="p">):</span>
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;running </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">templatefile</span><span class="p">)</span>
<span class="k">for</span> <span class="p">(</span><span class="n">num</span><span class="p">,</span> <span class="n">line</span><span class="p">)</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">parsed_template</span><span class="p">,</span><span class="mi">1</span><span class="p">):</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;template line </span><span class="si">%i</span><span class="s2">: </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">num</span><span class="p">,</span> <span class="s2">&quot; &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">line</span><span class="p">))</span>
<span class="n">skiperror</span> <span class="o">=</span> <span class="kc">False</span>
<span class="p">(</span><span class="n">cmd</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span> <span class="o">=</span> <span class="p">(</span><span class="n">line</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">line</span><span class="p">[</span><span class="mi">1</span><span class="p">:])</span>
<span class="c1"># Following Makefile convention, if the command is prefixed with</span>
<span class="c1"># a dash (&#39;-&#39;), we&#39;ll ignore any errors on that line.</span>
<span class="k">if</span> <span class="n">cmd</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s1">&#39;-&#39;</span><span class="p">):</span>
<span class="n">cmd</span> <span class="o">=</span> <span class="n">cmd</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
<span class="n">skiperror</span> <span class="o">=</span> <span class="kc">True</span>
<span class="k">try</span><span class="p">:</span>
<span class="c1"># grab the method named in cmd and pass it the given arguments</span>
<span class="n">f</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cmd</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="k">if</span> <span class="n">cmd</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;_&#39;</span> <span class="ow">or</span> <span class="n">cmd</span> <span class="o">==</span> <span class="s1">&#39;run&#39;</span> <span class="ow">or</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="n">collections</span><span class="o">.</span><span class="n">Callable</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;unknown command </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">cmd</span><span class="p">)</span>
<span class="n">f</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">Exception</span><span class="p">:</span> <span class="c1"># pylint: disable=broad-except</span>
<span class="k">if</span> <span class="n">skiperror</span><span class="p">:</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;ignoring error&quot;</span><span class="p">)</span>
<span class="k">continue</span>
<span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;template command error in </span><span class="si">%s</span><span class="s2">:&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">templatefile</span><span class="p">)</span>
<span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot; </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="s2">&quot; &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">line</span><span class="p">))</span>
<span class="c1"># format the exception traceback</span>
<span class="n">exclines</span> <span class="o">=</span> <span class="n">traceback</span><span class="o">.</span><span class="n">format_exception</span><span class="p">(</span><span class="o">*</span><span class="n">sys</span><span class="o">.</span><span class="n">exc_info</span><span class="p">())</span>
<span class="c1"># skip the bit about &quot;ltmpl.py, in _run()&quot; - we know that</span>
<span class="n">exclines</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="c1"># log the &quot;ErrorType: this is what happened&quot; line</span>
<span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot; </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">exclines</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">())</span>
<span class="c1"># and log the entire traceback to the debug log</span>
<span class="k">for</span> <span class="n">_line</span> <span class="ow">in</span> <span class="s1">&#39;&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">exclines</span><span class="p">)</span><span class="o">.</span><span class="n">splitlines</span><span class="p">():</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot; </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">_line</span><span class="p">)</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fatalerrors</span><span class="p">:</span>
<span class="k">raise</span>
<div class="viewcode-block" id="LoraxTemplateRunner.install"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.install">[docs]</a> <span class="k">def</span> <span class="nf">install</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">srcglob</span><span class="p">,</span> <span class="n">dest</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> install SRC DEST</span>
@ -420,6 +442,7 @@
<span class="sd"> If DEST doesn&#39;t exist, SRC will be copied to a file with that name,</span>
<span class="sd"> assuming the rest of the path exists.</span>
<span class="sd"> This is pretty much like how the &#39;cp&#39; command works.</span>
<span class="sd"> Examples:</span>
<span class="sd"> install usr/share/myconfig/grub.conf /boot</span>
<span class="sd"> install /usr/share/myconfig/grub.conf.in /boot/grub.conf</span>
@ -475,6 +498,7 @@
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> mkdir DIR [DIR ...]</span>
<span class="sd"> Create the named DIR(s). Will create leading directories as needed.</span>
<span class="sd"> Example:</span>
<span class="sd"> mkdir /images</span>
<span class="sd"> &#39;&#39;&#39;</span>
@ -488,6 +512,7 @@
<span class="sd"> replace PATTERN REPLACEMENT FILEGLOB [FILEGLOB ...]</span>
<span class="sd"> Find-and-replace the given PATTERN (Python-style regex) with the given</span>
<span class="sd"> REPLACEMENT string for each of the files listed.</span>
<span class="sd"> Example:</span>
<span class="sd"> replace @VERSION@ ${product.version} /boot/grub.conf /boot/isolinux.cfg</span>
<span class="sd"> &#39;&#39;&#39;</span>
@ -505,7 +530,9 @@
<span class="sd"> Append STRING (followed by a newline character) to FILE.</span>
<span class="sd"> Python character escape sequences (&#39;\\n&#39;, &#39;\\t&#39;, etc.) will be</span>
<span class="sd"> converted to the appropriate characters.</span>
<span class="sd"> Examples:</span>
<span class="sd"> append /etc/depmod.d/dd.conf &quot;search updates built-in&quot;</span>
<span class="sd"> append /etc/resolv.conf &quot;&quot;</span>
<span class="sd"> &#39;&#39;&#39;</span>
@ -518,6 +545,7 @@
<span class="sd"> Add an item to the treeinfo data store.</span>
<span class="sd"> The given SECTION will have a new item added where</span>
<span class="sd"> KEY = ARG ARG ...</span>
<span class="sd"> Example:</span>
<span class="sd"> treeinfo images-${kernel.arch} boot.iso images/boot.iso</span>
<span class="sd"> &#39;&#39;&#39;</span>
@ -618,6 +646,7 @@
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> log MESSAGE</span>
<span class="sd"> Emit the given log message. Be sure to put it in quotes!</span>
<span class="sd"> Example:</span>
<span class="sd"> log &quot;Reticulating splines, please wait...&quot;</span>
<span class="sd"> &#39;&#39;&#39;</span>
@ -641,7 +670,7 @@
<span class="sd"> (this should be replaced with a &quot;find&quot; function)</span>
<span class="sd"> runcmd find ${root} -name &quot;*.pyo&quot; -type f -delete</span>
<span class="sd"> %for f in find(root, name=&quot;*.pyo&quot;):</span>
<span class="sd"> remove ${f}</span>
<span class="sd"> remove ${f}</span>
<span class="sd"> %endfor</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="n">cmd</span> <span class="o">=</span> <span class="n">cmdlist</span>
@ -736,6 +765,7 @@
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> removepkg PKGGLOB [PKGGLOB...]</span>
<span class="sd"> Delete the named package(s).</span>
<span class="sd"> IMPLEMENTATION NOTES:</span>
<span class="sd"> RPM scriptlets (%preun/%postun) are *not* run.</span>
<span class="sd"> Files are deleted, but directories are left behind.</span>
@ -800,6 +830,7 @@
<span class="sd"> (or packages) named.</span>
<span class="sd"> If &#39;--allbut&#39; is used, all the files from the given package(s) will</span>
<span class="sd"> be removed *except* the ones which match the file globs.</span>
<span class="sd"> Examples:</span>
<span class="sd"> removefrom usbutils /usr/bin/*</span>
<span class="sd"> removefrom xfsprogs --allbut /sbin/*</span>
@ -833,6 +864,7 @@
<span class="k">else</span><span class="p">:</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">&quot;removefrom </span><span class="si">%s</span><span class="s2">: no files to remove!&quot;</span><span class="p">,</span> <span class="n">cmd</span><span class="p">)</span></div>
<span class="c1"># pylint: disable=anomalous-backslash-in-string</span>
<div class="viewcode-block" id="LoraxTemplateRunner.removekmod"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.removekmod">[docs]</a> <span class="k">def</span> <span class="nf">removekmod</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">globs</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> removekmod GLOB [GLOB...] [--allbut] KEEPGLOB [KEEPGLOB...]</span>
@ -844,7 +876,7 @@
<span class="sd"> to search and one KEEPGLOB to keep. The KEEPGLOB is expanded to be *KEEPGLOB*</span>
<span class="sd"> so that it will match anywhere in the path.</span>
<span class="sd"> This only removes files from under /lib/modules/*/kernel/</span>
<span class="sd"> This only removes files from under /lib/modules/\*/kernel/</span>
<span class="sd"> Examples:</span>
<span class="sd"> removekmod sound drivers/media drivers/hwmon drivers/video</span>
@ -893,6 +925,7 @@
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> createaddrsize INITRD_ADDRESS INITRD ADDRSIZE</span>
<span class="sd"> Create the initrd.addrsize file required in LPAR boot process.</span>
<span class="sd"> Examples:</span>
<span class="sd"> createaddrsize ${INITRD_ADDRESS} ${outroot}/${BOOTDIR}/initrd.img ${outroot}/${BOOTDIR}/initrd.addrsize</span>
<span class="sd"> &#39;&#39;&#39;</span>
@ -905,6 +938,7 @@
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> systemctl [enable|disable|mask] UNIT [UNIT...]</span>
<span class="sd"> Enable, disable, or mask the given systemd units.</span>
<span class="sd"> Examples:</span>
<span class="sd"> systemctl disable lvm2-monitor.service</span>
<span class="sd"> systemctl mask fedora-storage-init.service fedora-configure.service</span>
@ -924,6 +958,89 @@
<span class="n">runcmd</span><span class="p">(</span><span class="n">cmd</span><span class="p">)</span>
<span class="k">except</span> <span class="n">CalledProcessError</span><span class="p">:</span>
<span class="k">pass</span></div></div>
<div class="viewcode-block" id="LiveTemplateRunner"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.LiveTemplateRunner">[docs]</a><span class="k">class</span> <span class="nc">LiveTemplateRunner</span><span class="p">(</span><span class="n">TemplateRunner</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> This class parses and executes a limited Lorax template. Sample usage:</span>
<span class="sd"> # install a bunch of packages</span>
<span class="sd"> runner = LiveTemplateRunner(dbo, templatedir, defaults)</span>
<span class="sd"> runner.run(&quot;live-install.tmpl&quot;)</span>
<span class="sd"> It is meant to be used with the live-install.tmpl which lists the per-arch</span>
<span class="sd"> pacages needed to build the live-iso output.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dbo</span><span class="p">,</span> <span class="n">fatalerrors</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">templatedir</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">dbo</span> <span class="o">=</span> <span class="n">dbo</span>
<span class="bp">self</span><span class="o">.</span><span class="n">pkgs</span> <span class="o">=</span> <span class="p">[]</span>
<span class="bp">self</span><span class="o">.</span><span class="n">pkgnames</span> <span class="o">=</span> <span class="p">[]</span>
<span class="nb">super</span><span class="p">(</span><span class="n">LiveTemplateRunner</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">fatalerrors</span><span class="p">,</span> <span class="n">templatedir</span><span class="p">,</span> <span class="n">defaults</span><span class="p">)</span>
<div class="viewcode-block" id="LiveTemplateRunner.installpkg"><a class="viewcode-back" href="../../pylorax.html#pylorax.ltmpl.LiveTemplateRunner.installpkg">[docs]</a> <span class="k">def</span> <span class="nf">installpkg</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">pkgs</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> installpkg [--required|--optional] [--except PKGGLOB [--except PKGGLOB ...]] PKGGLOB [PKGGLOB ...]</span>
<span class="sd"> Request installation of all packages matching the given globs.</span>
<span class="sd"> Note that this is just a *request* - nothing is *actually* installed</span>
<span class="sd"> until the &#39;run_pkg_transaction&#39; command is given.</span>
<span class="sd"> --required is now the default. If the PKGGLOB can be missing pass --optional</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="k">if</span> <span class="n">pkgs</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;--optional&#39;</span><span class="p">:</span>
<span class="n">pkgs</span> <span class="o">=</span> <span class="n">pkgs</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
<span class="n">required</span> <span class="o">=</span> <span class="kc">False</span>
<span class="k">elif</span> <span class="n">pkgs</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;--required&#39;</span><span class="p">:</span>
<span class="n">pkgs</span> <span class="o">=</span> <span class="n">pkgs</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
<span class="n">required</span> <span class="o">=</span> <span class="kc">True</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">required</span> <span class="o">=</span> <span class="kc">True</span>
<span class="n">excludes</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">while</span> <span class="s1">&#39;--except&#39;</span> <span class="ow">in</span> <span class="n">pkgs</span><span class="p">:</span>
<span class="n">idx</span> <span class="o">=</span> <span class="n">pkgs</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="s1">&#39;--except&#39;</span><span class="p">)</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">pkgs</span><span class="p">)</span> <span class="o">==</span> <span class="n">idx</span><span class="o">+</span><span class="mi">1</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;installpkg needs an argument after --except&quot;</span><span class="p">)</span>
<span class="n">excludes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">pkgs</span><span class="p">[</span><span class="n">idx</span><span class="o">+</span><span class="mi">1</span><span class="p">])</span>
<span class="n">pkgs</span> <span class="o">=</span> <span class="n">pkgs</span><span class="p">[:</span><span class="n">idx</span><span class="p">]</span> <span class="o">+</span> <span class="n">pkgs</span><span class="p">[</span><span class="n">idx</span><span class="o">+</span><span class="mi">2</span><span class="p">:]</span>
<span class="n">errors</span> <span class="o">=</span> <span class="kc">False</span>
<span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pkgs</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="c1"># Start by using Subject to generate a package query, which will</span>
<span class="c1"># give us a query object similar to what dbo.install would select,</span>
<span class="c1"># minus the handling for multilib. This query may contain</span>
<span class="c1"># multiple arches. Pull the package names out of that, filter any</span>
<span class="c1"># that match the excludes patterns, and pass those names back to</span>
<span class="c1"># dbo.install to do the actual, arch and version and multilib</span>
<span class="c1"># aware, package selction.</span>
<span class="c1"># dnf queries don&#39;t have a concept of negative globs which is why</span>
<span class="c1"># the filtering is done the hard way.</span>
<span class="n">pkgnames</span> <span class="o">=</span> <span class="p">[</span><span class="n">pkg</span> <span class="k">for</span> <span class="n">pkg</span> <span class="ow">in</span> <span class="n">dnf</span><span class="o">.</span><span class="n">subject</span><span class="o">.</span><span class="n">Subject</span><span class="p">(</span><span class="n">p</span><span class="p">)</span><span class="o">.</span><span class="n">get_best_query</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">dbo</span><span class="o">.</span><span class="n">sack</span><span class="p">)</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">latest</span><span class="o">=</span><span class="kc">True</span><span class="p">)]</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">pkgnames</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">dnf</span><span class="o">.</span><span class="n">exceptions</span><span class="o">.</span><span class="n">PackageNotFoundError</span><span class="p">(</span><span class="s2">&quot;no package matched&quot;</span><span class="p">,</span> <span class="n">p</span><span class="p">)</span>
<span class="c1"># Apply excludes to the name only</span>
<span class="k">for</span> <span class="n">exclude</span> <span class="ow">in</span> <span class="n">excludes</span><span class="p">:</span>
<span class="n">pkgnames</span> <span class="o">=</span> <span class="p">[</span><span class="n">pkg</span> <span class="k">for</span> <span class="n">pkg</span> <span class="ow">in</span> <span class="n">pkgnames</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">fnmatch</span><span class="o">.</span><span class="n">fnmatch</span><span class="p">(</span><span class="n">pkg</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">exclude</span><span class="p">)]</span>
<span class="c1"># Convert to a sorted NVR list for installation</span>
<span class="n">pkgnvrs</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">([</span><span class="s2">&quot;</span><span class="si">{}</span><span class="s2">-</span><span class="si">{}</span><span class="s2">-</span><span class="si">{}</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">pkg</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">pkg</span><span class="o">.</span><span class="n">version</span><span class="p">,</span> <span class="n">pkg</span><span class="o">.</span><span class="n">release</span><span class="p">)</span> <span class="k">for</span> <span class="n">pkg</span> <span class="ow">in</span> <span class="n">pkgnames</span><span class="p">])</span>
<span class="c1"># If the request is a glob, expand it in the log</span>
<span class="k">if</span> <span class="nb">any</span><span class="p">(</span><span class="n">g</span> <span class="k">for</span> <span class="n">g</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">&#39;*&#39;</span><span class="p">,</span><span class="s1">&#39;?&#39;</span><span class="p">,</span><span class="s1">&#39;.&#39;</span><span class="p">]</span> <span class="k">if</span> <span class="n">g</span> <span class="ow">in</span> <span class="n">p</span><span class="p">):</span>
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;installpkg: </span><span class="si">%s</span><span class="s2"> expands to </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="s2">&quot;,&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">pkgnvrs</span><span class="p">))</span>
<span class="bp">self</span><span class="o">.</span><span class="n">pkgs</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">pkgnvrs</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">pkgnames</span><span class="o">.</span><span class="n">extend</span><span class="p">([</span><span class="n">pkg</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">pkg</span> <span class="ow">in</span> <span class="n">pkgnames</span><span class="p">])</span>
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span> <span class="c1"># pylint: disable=broad-except</span>
<span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;installpkg </span><span class="si">%s</span><span class="s2"> failed: </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
<span class="n">errors</span> <span class="o">=</span> <span class="kc">True</span>
<span class="k">if</span> <span class="n">errors</span> <span class="ow">and</span> <span class="n">required</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s2">&quot;Required installpkg failed.&quot;</span><span class="p">)</span></div></div>
</pre></div>
</div>
@ -960,7 +1077,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.monitor &mdash; Lorax 29.21 documentation</title>
<title>pylorax.monitor &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -393,7 +393,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.mount &mdash; Lorax 29.21 documentation</title>
<title>pylorax.mount &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -292,7 +292,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.sysutils &mdash; Lorax 29.21 documentation</title>
<title>pylorax.sysutils &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -322,7 +322,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.treebuilder &mdash; Lorax 29.21 documentation</title>
<title>pylorax.treebuilder &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -371,7 +371,16 @@
<span class="n">runcmd</span><span class="p">([</span><span class="s2">&quot;depmod&quot;</span><span class="p">,</span> <span class="s2">&quot;-a&quot;</span><span class="p">,</span> <span class="s2">&quot;-F&quot;</span><span class="p">,</span> <span class="n">ksyms</span><span class="p">,</span> <span class="s2">&quot;-b&quot;</span><span class="p">,</span> <span class="n">root</span><span class="p">,</span> <span class="n">kernel</span><span class="o">.</span><span class="n">version</span><span class="p">])</span>
<span class="n">generate_module_info</span><span class="p">(</span><span class="n">moddir</span><span class="o">+</span><span class="n">kernel</span><span class="o">.</span><span class="n">version</span><span class="p">,</span> <span class="n">outfile</span><span class="o">=</span><span class="n">moddir</span><span class="o">+</span><span class="s2">&quot;module-info&quot;</span><span class="p">)</span></div>
<div class="viewcode-block" id="RuntimeBuilder.create_runtime"><a class="viewcode-back" href="../../pylorax.html#pylorax.treebuilder.RuntimeBuilder.create_runtime">[docs]</a> <span class="k">def</span> <span class="nf">create_runtime</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">outfile</span><span class="o">=</span><span class="s2">&quot;/var/tmp/squashfs.img&quot;</span><span class="p">,</span> <span class="n">compression</span><span class="o">=</span><span class="s2">&quot;xz&quot;</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">2</span><span class="p">):</span>
<div class="viewcode-block" id="RuntimeBuilder.create_squashfs_runtime"><a class="viewcode-back" href="../../pylorax.html#pylorax.treebuilder.RuntimeBuilder.create_squashfs_runtime">[docs]</a> <span class="k">def</span> <span class="nf">create_squashfs_runtime</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">outfile</span><span class="o">=</span><span class="s2">&quot;/var/tmp/squashfs.img&quot;</span><span class="p">,</span> <span class="n">compression</span><span class="o">=</span><span class="s2">&quot;xz&quot;</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">2</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Create a plain squashfs runtime&quot;&quot;&quot;</span>
<span class="n">compressargs</span> <span class="o">=</span> <span class="n">compressargs</span> <span class="ow">or</span> <span class="p">[]</span>
<span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">outfile</span><span class="p">))</span>
<span class="c1"># squash the rootfs</span>
<span class="n">imgutils</span><span class="o">.</span><span class="n">mksquashfs</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">vars</span><span class="o">.</span><span class="n">root</span><span class="p">,</span> <span class="n">outfile</span><span class="p">,</span> <span class="n">compression</span><span class="p">,</span> <span class="n">compressargs</span><span class="p">)</span></div>
<div class="viewcode-block" id="RuntimeBuilder.create_ext4_runtime"><a class="viewcode-back" href="../../pylorax.html#pylorax.treebuilder.RuntimeBuilder.create_ext4_runtime">[docs]</a> <span class="k">def</span> <span class="nf">create_ext4_runtime</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">outfile</span><span class="o">=</span><span class="s2">&quot;/var/tmp/squashfs.img&quot;</span><span class="p">,</span> <span class="n">compression</span><span class="o">=</span><span class="s2">&quot;xz&quot;</span><span class="p">,</span> <span class="n">compressargs</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="mi">2</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Create a squashfs compressed ext4 runtime&quot;&quot;&quot;</span>
<span class="c1"># make live rootfs image - must be named &quot;LiveOS/rootfs.img&quot; for dracut</span>
<span class="n">compressargs</span> <span class="o">=</span> <span class="n">compressargs</span> <span class="ow">or</span> <span class="p">[]</span>
<span class="n">workdir</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">outfile</span><span class="p">),</span> <span class="s2">&quot;runtime-workdir&quot;</span><span class="p">)</span>
@ -394,7 +403,8 @@
<div class="viewcode-block" id="TreeBuilder"><a class="viewcode-back" href="../../pylorax.html#pylorax.treebuilder.TreeBuilder">[docs]</a><span class="k">class</span> <span class="nc">TreeBuilder</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;Builds the arch-specific boot images.</span>
<span class="sd"> inroot should be the installtree root (the newly-built runtime dir)&#39;&#39;&#39;</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">product</span><span class="p">,</span> <span class="n">arch</span><span class="p">,</span> <span class="n">inroot</span><span class="p">,</span> <span class="n">outroot</span><span class="p">,</span> <span class="n">runtime</span><span class="p">,</span> <span class="n">isolabel</span><span class="p">,</span> <span class="n">domacboot</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">doupgrade</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">templatedir</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">add_templates</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">add_template_vars</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">workdir</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">product</span><span class="p">,</span> <span class="n">arch</span><span class="p">,</span> <span class="n">inroot</span><span class="p">,</span> <span class="n">outroot</span><span class="p">,</span> <span class="n">runtime</span><span class="p">,</span> <span class="n">isolabel</span><span class="p">,</span> <span class="n">domacboot</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">doupgrade</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="n">templatedir</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">add_templates</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">add_template_vars</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">workdir</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">extra_boot_args</span><span class="o">=</span><span class="s2">&quot;&quot;</span><span class="p">):</span>
<span class="c1"># NOTE: if you pass an arg named &quot;runtime&quot; to a mako template it&#39;ll</span>
<span class="c1"># clobber some mako internal variables - hence &quot;runtime_img&quot;.</span>
@ -403,7 +413,8 @@
<span class="n">inroot</span><span class="o">=</span><span class="n">inroot</span><span class="p">,</span> <span class="n">outroot</span><span class="o">=</span><span class="n">outroot</span><span class="p">,</span>
<span class="n">basearch</span><span class="o">=</span><span class="n">arch</span><span class="o">.</span><span class="n">basearch</span><span class="p">,</span> <span class="n">libdir</span><span class="o">=</span><span class="n">arch</span><span class="o">.</span><span class="n">libdir</span><span class="p">,</span>
<span class="n">isolabel</span><span class="o">=</span><span class="n">isolabel</span><span class="p">,</span> <span class="n">udev</span><span class="o">=</span><span class="n">udev_escape</span><span class="p">,</span> <span class="n">domacboot</span><span class="o">=</span><span class="n">domacboot</span><span class="p">,</span> <span class="n">doupgrade</span><span class="o">=</span><span class="n">doupgrade</span><span class="p">,</span>
<span class="n">workdir</span><span class="o">=</span><span class="n">workdir</span><span class="p">,</span> <span class="n">lower</span><span class="o">=</span><span class="n">string_lower</span><span class="p">)</span>
<span class="n">workdir</span><span class="o">=</span><span class="n">workdir</span><span class="p">,</span> <span class="n">lower</span><span class="o">=</span><span class="n">string_lower</span><span class="p">,</span>
<span class="n">extra_boot_args</span><span class="o">=</span><span class="n">extra_boot_args</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_runner</span> <span class="o">=</span> <span class="n">LoraxTemplateRunner</span><span class="p">(</span><span class="n">inroot</span><span class="p">,</span> <span class="n">outroot</span><span class="p">,</span> <span class="n">templatedir</span><span class="o">=</span><span class="n">templatedir</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_runner</span><span class="o">.</span><span class="n">defaults</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">vars</span>
<span class="bp">self</span><span class="o">.</span><span class="n">add_templates</span> <span class="o">=</span> <span class="n">add_templates</span> <span class="ow">or</span> <span class="p">[]</span>
@ -590,7 +601,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pylorax.treeinfo &mdash; Lorax 29.21 documentation</title>
<title>pylorax.treeinfo &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -179,6 +179,7 @@
<span class="n">logger</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">&quot;pylorax.treeinfo&quot;</span><span class="p">)</span>
<span class="kn">import</span> <span class="nn">configparser</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">time</span>
@ -189,8 +190,13 @@
<span class="bp">self</span><span class="o">.</span><span class="n">c</span> <span class="o">=</span> <span class="n">configparser</span><span class="o">.</span><span class="n">ConfigParser</span><span class="p">()</span>
<span class="k">if</span> <span class="s1">&#39;SOURCE_DATE_EPOCH&#39;</span> <span class="ow">in</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">:</span>
<span class="n">timestamp</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s1">&#39;SOURCE_DATE_EPOCH&#39;</span><span class="p">]</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">timestamp</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">())</span>
<span class="n">section</span> <span class="o">=</span> <span class="s2">&quot;general&quot;</span>
<span class="n">data</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;timestamp&quot;</span><span class="p">:</span> <span class="nb">str</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()),</span>
<span class="n">data</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;timestamp&quot;</span><span class="p">:</span> <span class="n">timestamp</span><span class="p">,</span>
<span class="s2">&quot;family&quot;</span><span class="p">:</span> <span class="n">product</span><span class="p">,</span>
<span class="s2">&quot;version&quot;</span><span class="p">:</span> <span class="n">version</span><span class="p">,</span>
<span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;</span><span class="si">%s</span><span class="s2">-</span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">product</span><span class="p">,</span> <span class="n">version</span><span class="p">),</span>
@ -247,7 +253,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -41,8 +41,8 @@ keep track of the build. You can also cancel the build if needed.
<<<<<<< HEAD
The available types of images is displayed by ``composer-cli compose types``.
Currently this consists of: ami, ext4-filesystem, live-iso, partitioned-disk,
qcow2, tar, vhd, vmdk
Currently this consists of: alibaba, ami, ext4-filesystem, google, hyper-v,
live-iso, openstack, partitioned-disk, qcow2, tar, vhd, vmdk
Monitor the build status
------------------------

View File

@ -579,18 +579,10 @@ Creating UEFI disk images with virt
Partitioned disk images can only be created for the same platform as the host system (BIOS or
UEFI). You can use virt to create BIOS images on UEFI systems, and it is also possible
to create UEFI images on BIOS systems using OVMF. You first need to setup your system with
the OVMF firmware. The details can be `found here linux-kvm OVMF page <http://www.linux-kvm.org/page/OVMF>`_
but it amounts to:
to create UEFI images on BIOS systems using OVMF firmware and qemu.
1. Download the firmware.repo from `Gerd Hoffmann <https://www.kraxel.org/repos/>`_ and install it
in /etc/yum.repos.d/
2. Install the edk2.git-ovmf-x64 package
3. Copy /usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd to /usr/share/OVMF/OVMF_CODE.fd
4. Copy /usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd to /usr/share/OVMF/OVMF_VARS.fd
Install the lorax-lmc-virt package, this will install qemu and the OVMF
firmware files.
Now you can run livemedia-creator with ``--virt-uefi`` to boot and install using UEFI::
@ -601,11 +593,10 @@ Make sure that the kickstart you are using creates a /boot/efi partition by incl
part /boot/efi --fstype="efi" --size=500
Or use ``reqpart`` in the kickstart and Anaconda will create the required partitions.
.. note::
When using the resulting image with the current version of OVMF (edk2.git-ovmf-x64-0-20151103.b1295.ge5cffca)
it will not boot automatically because there is a problem with the fallback path.
You can boot it by entering the UEFI shell and running EFI/fedora/shim.efi and
then using efibootmgr to setup the correct boot entry.
The --virt-uefi method is currently only supported on the x86_64 architecture.
Debugging problems

View File

@ -175,11 +175,25 @@ for selecting optional packages.
Customizations
~~~~~~~~~~~~~~
The ``[[customizations]]`` section can be used to configure the hostname of the final image. eg.::
The ``[customizations]`` section can be used to configure the hostname of the final image. eg.::
[[customizations]]
[customizations]
hostname = "baseimage"
This is optional and may be left out to use the defaults.
[customizations.kernel]
***********************
This allows you to append arguments to the bootloader's kernel commandline. This will not have any
effect on ``tar`` or ``ext4-filesystem`` images since they do not include a bootloader.
For example::
[customizations.kernel]
append = "nosmt=force"
[[customizations.sshkey]]
*************************
@ -192,6 +206,10 @@ Set an existing user's ssh key in the final image::
The key will be added to the user's authorized_keys file.
.. warning::
``key`` expects the entire content of ``~/.ssh/id_rsa.pub``
[[customizations.user]]
***********************
@ -213,6 +231,10 @@ All fields for this section are optional except for the ``name``, here is a comp
If the password starts with ``$6$``, ``$5$``, or ``$2b$`` it will be stored as
an encrypted password. Otherwise it will be treated as a plain text password.
.. warning::
``key`` expects the entire content of ``~/.ssh/id_rsa.pub``
[[customizations.group]]
************************
@ -224,6 +246,132 @@ Add a group to the image. ``name`` is required and ``gid`` is optional::
gid = 1130
[customizations.timezone]
*************************
Customizing the timezone and the NTP servers to use for the system::
[customizations.timezone]
timezone = "US/Eastern"
ntpservers = ["0.north-america.pool.ntp.org", "1.north-america.pool.ntp.org"]
The values supported by ``timezone`` can be listed by running ``timedatectl list-timezones``.
If no timezone is setup the system will default to using `UTC`. The ntp servers are also
optional and will default to using the distribution defaults which are fine for most uses.
In some image types there are already NTP servers setup, eg. Google cloud image, and they
cannot be overridden because they are required to boot in the selected environment. But the
timezone will be updated to the one selected in the blueprint.
[customizations.locale]
***********************
Customize the locale settings for the system::
[customizations.locale]
languages = ["en_US.UTF-8"]
keyboard = "us"
The values supported by ``languages`` can be listed by running ``localectl list-locales`` from
the command line.
The values supported by ``keyboard`` can be listed by running ``localectl list-keymaps`` from
the command line.
Multiple languages can be added. The first one becomes the
primary, and the others are added as secondary. One or the other of ``languages``
or ``keyboard`` must be included (or both) in the section.
[customizations.firewall]
*************************
By default the firewall blocks all access except for services that enable their ports explicitly,
like ``sshd``. This command can be used to open other ports or services. Ports are configured using
the port:protocol format::
[customizations.firewall]
ports = ["22:tcp", "80:tcp", "imap:tcp", "53:tcp", "53:udp"]
Numeric ports, or their names from ``/etc/services`` can be used in the ``ports`` enabled/disabled lists.
The blueprint settings extend any existing settings in the image templates, so if ``sshd`` is
already enabled it will extend the list of ports with the ones listed by the blueprint.
If the distribution uses ``firewalld`` you can specify services listed by ``firewall-cmd --get-services``
in a ``customizations.firewall.services`` section::
[customizations.firewall.services]
enabled = ["ftp", "ntp", "dhcp"]
disabled = ["telnet"]
Remember that the ``firewall.services`` are different from the names in ``/etc/services``.
Both are optional, if they are not used leave them out or set them to an empty list ``[]``. If you
only want the default firewall setup this section can be omitted from the blueprint.
NOTE: The ``Google`` and ``OpenStack`` templates explicitly disable the firewall for their environment.
This cannot be overridden by the blueprint.
[customizations.services]
*************************
This section can be used to control which services are enabled at boot time.
Some image types already have services enabled or disabled in order for the
image to work correctly, and cannot be overridden. eg. ``ami`` requires
``sshd``, ``chronyd``, and ``cloud-init``. Without them the image will not
boot. Blueprint services are added to, not replacing, the list already in the
templates, if any.
The service names are systemd service units. You may specify any systemd unit
file accepted by ``systemctl enable`` eg. ``cockpit.socket``::
[customizations.services]
enabled = ["sshd", "cockpit.socket", "httpd"]
disabled = ["postfix", "telnetd"]
[[repos.git]]
~~~~~~~~~~~~~
The ``[[repos.git]]`` entries are used to add files from a `git repository<https://git-scm.com/>`
repository to the created image. The repository is cloned, the specified ``ref`` is checked out
and an rpm is created to install the files to a ``destination`` path. The rpm includes a summary
with the details of the repository and reference used to create it. The rpm is also included in the
image build metadata.
To create an rpm named ``server-config-1.0-1.noarch.rpm`` you would add this to your blueprint::
[[repos.git]]
rpmname="server-config"
rpmversion="1.0"
rpmrelease="1"
summary="Setup files for server deployment"
repo="PATH OF GIT REPO TO CLONE"
ref="v1.0"
destination="/opt/server/"
* rpmname: Name of the rpm to create, also used as the prefix name in the tar archive
* rpmversion: Version of the rpm, eg. "1.0.0"
* rpmrelease: Release of the rpm, eg. "1"
* summary: Summary string for the rpm
* repo: URL of the get repo to clone and create the archive from
* ref: Git reference to check out. eg. origin/branch-name, git tag, or git commit hash
* destination: Path to install the / of the git repo at when installing the rpm
An rpm will be created with the contents of the git repository referenced, with the files
being installed under ``/opt/server/`` in this case.
``ref`` can be any valid git reference for use with ``git archive``. eg. to use the head
of a branch set it to ``origin/branch-name``, a tag name, or a commit hash.
Note that the repository is cloned in full each time a build is started, so pointing to a
repository with a large amount of history may take a while to clone and use a significant
amount of disk space. The clone is temporary and is removed once the rpm is created.
Adding Output Types
-------------------

View File

@ -4,6 +4,14 @@ pylorax.api package
Submodules
----------
pylorax.api.bisect module
-------------------------
.. automodule:: pylorax.api.bisect
:members:
:undoc-members:
:show-inheritance:
pylorax.api.checkparams module
------------------------------
@ -60,6 +68,14 @@ pylorax.api.errors module
:undoc-members:
:show-inheritance:
pylorax.api.gitrpm module
-------------------------
.. automodule:: pylorax.api.gitrpm
:members:
:undoc-members:
:show-inheritance:
pylorax.api.projects module
---------------------------

View File

@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '29.21',
VERSION: '29.28',
LANGUAGE: 'None',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>composer-cli &mdash; Lorax 29.21 documentation</title>
<title>composer-cli &mdash; Lorax 29.28 documentation</title>
@ -58,7 +58,7 @@
<div class="version">
29.21
29.28
</div>
@ -214,7 +214,7 @@ group. They do not need to be root, but all of the <a class="reference external"
<tr><td class="option-group">
<kbd>-s, --socket</kbd></td>
<td><p class="first">Path to the socket file to listen on</p>
<p class="last">Default: “/run/weldr/api.socket”</p>
<p class="last">Default: &quot;/run/weldr/api.socket&quot;</p>
</td></tr>
<tr><td class="option-group">
<kbd>--log</kbd></td>
@ -222,7 +222,7 @@ group. They do not need to be root, but all of the <a class="reference external"
<tr><td class="option-group">
<kbd>-a, --api</kbd></td>
<td><p class="first">API Version to use</p>
<p class="last">Default: “0”</p>
<p class="last">Default: &quot;0&quot;</p>
</td></tr>
<tr><td class="option-group">
<kbd>--test</kbd></td>
@ -231,7 +231,7 @@ group. They do not need to be root, but all of the <a class="reference external"
</td></tr>
<tr><td class="option-group">
<kbd>-V</kbd></td>
<td><p class="first">show programs version number and exit</p>
<td><p class="first">show program's version number and exit</p>
<p class="last">Default: False</p>
</td></tr>
</tbody>
@ -250,7 +250,7 @@ group. They do not need to be root, but all of the <a class="reference external"
<dd>Show the last SIZE kB of the compose log.</dd>
<dt>compose cancel &lt;UUID&gt;</dt>
<dd>Cancel a running compose and delete any intermediate results.</dd>
<dt>compose delete &lt;UUID,&gt;</dt>
<dt>compose delete &lt;UUID,...&gt;</dt>
<dd>Delete the listed compose results.</dd>
<dt>compose info &lt;UUID&gt;</dt>
<dd>Show detailed information on the compose.</dd>
@ -264,27 +264,27 @@ group. They do not need to be root, but all of the <a class="reference external"
<dd>Download the output image from the compose. Filename depends on the type.</dd>
<dt>blueprints list</dt>
<dd>List the names of the available blueprints.</dd>
<dt>blueprints show &lt;BLUEPRINT,&gt;</dt>
<dt>blueprints show &lt;BLUEPRINT,...&gt;</dt>
<dd>Display the blueprint in TOML format.</dd>
<dt>blueprints changes &lt;BLUEPRINT,&gt;</dt>
<dt>blueprints changes &lt;BLUEPRINT,...&gt;</dt>
<dd>Display the changes for each blueprint.</dd>
<dt>blueprints diff &lt;BLUEPRINT&gt; &lt;FROM-COMMIT&gt; &lt;TO-COMMIT&gt;</dt>
<dd>Display the differences between 2 versions of a blueprint.
FROM-COMMIT can be a commit hash or NEWEST
TO-COMMIT can be a commit hash, NEWEST, or WORKSPACE</dd>
<dt>blueprints save &lt;BLUEPRINT,&gt;</dt>
<dt>blueprints save &lt;BLUEPRINT,...&gt;</dt>
<dd>Save the blueprint to a file, &lt;BLUEPRINT&gt;.toml</dd>
<dt>blueprints delete &lt;BLUEPRINT&gt;</dt>
<dd>Delete a blueprint from the server</dd>
<dt>blueprints depsolve &lt;BLUEPRINT,&gt;</dt>
<dt>blueprints depsolve &lt;BLUEPRINT,...&gt;</dt>
<dd>Display the packages needed to install the blueprint.</dd>
<dt>blueprints push &lt;BLUEPRINT&gt;</dt>
<dd>Push a blueprint TOML file to the server.</dd>
<dt>blueprints freeze &lt;BLUEPRINT,&gt;</dt>
<dd>Display the frozen blueprints modules and packages.</dd>
<dt>blueprints freeze show &lt;BLUEPRINT,&gt;</dt>
<dt>blueprints freeze &lt;BLUEPRINT,...&gt;</dt>
<dd>Display the frozen blueprint's modules and packages.</dd>
<dt>blueprints freeze show &lt;BLUEPRINT,...&gt;</dt>
<dd>Display the frozen blueprint in TOML format.</dd>
<dt>blueprints freeze save &lt;BLUEPRINT,&gt;</dt>
<dt>blueprints freeze save &lt;BLUEPRINT,...&gt;</dt>
<dd>Save the frozen blueprint to a file, &lt;blueprint-name&gt;.frozen.toml.</dd>
<dt>blueprints tag &lt;BLUEPRINT&gt;</dt>
<dd>Tag the most recent blueprint commit as a release.</dd>
@ -296,11 +296,11 @@ TO-COMMIT can be a commit hash, NEWEST, or WORKSPACE</dd>
<dd>List the available modules.</dd>
<dt>projects list</dt>
<dd>List the available projects.</dd>
<dt>projects info &lt;PROJECT,&gt;</dt>
<dt>projects info &lt;PROJECT,...&gt;</dt>
<dd>Show details about the listed projects.</dd>
<dt>sources list</dt>
<dd>List the available sources</dd>
<dt>sources info &lt;SOURCE-NAME,&gt;</dt>
<dt>sources info &lt;SOURCE-NAME,...&gt;</dt>
<dd>Details about the source.</dd>
<dt>sources add &lt;SOURCE.TOML&gt;</dt>
<dd>Add a package source to the server.</dd>
@ -330,8 +330,8 @@ saved by viewing the changelog - <code class="docutils literal notranslate"><spa
keep track of the build. You can also cancel the build if needed.</p>
<p>&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD
The available types of images is displayed by <code class="docutils literal notranslate"><span class="pre">composer-cli</span> <span class="pre">compose</span> <span class="pre">types</span></code>.
Currently this consists of: ami, ext4-filesystem, live-iso, partitioned-disk,
qcow2, tar, vhd, vmdk</p>
Currently this consists of: alibaba, ami, ext4-filesystem, google, hyper-v,
live-iso, openstack, partitioned-disk, qcow2, tar, vhd, vmdk</p>
</div>
<div class="section" id="monitor-the-build-status">
<h2>Monitor the build status<a class="headerlink" href="#monitor-the-build-status" title="Permalink to this headline"></a></h2>
@ -395,7 +395,7 @@ save the qcow2 image as <code class="docutils literal notranslate"><span class="
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>composer.cli package &mdash; Lorax 29.21 documentation</title>
<title>composer.cli package &mdash; Lorax 29.28 documentation</title>
@ -58,7 +58,7 @@
<div class="version">
29.21
29.28
</div>
@ -189,16 +189,16 @@
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>blueprints changes &lt;blueprint,&gt; Display the changes for each blueprint.</p>
<p>blueprints changes &lt;blueprint,...&gt; Display the changes for each blueprint.</p>
</dd></dl>
<dl class="function">
@ -209,7 +209,7 @@
<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> (<a class="reference external" href="https://docs.python.org/3/library/argparse.html#argparse.Namespace" title="(in Python v3.7)"><em>argparse.Namespace</em></a>) Cmdline arguments</td>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>opts</strong> (<a class="reference external" href="https://docs.python.org/3/library/argparse.html#argparse.Namespace" title="(in Python v3.7)"><em>argparse.Namespace</em></a>) -- Cmdline arguments</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Value to return from sys.exit()</td>
</tr>
@ -229,10 +229,10 @@
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
@ -250,16 +250,16 @@
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>blueprints depsolve &lt;blueprint,&gt; Display the packages needed to install the blueprint.</p>
<p>blueprints depsolve &lt;blueprint,...&gt; Display the packages needed to install the blueprint.</p>
</dd></dl>
<dl class="function">
@ -271,10 +271,10 @@
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
@ -296,18 +296,18 @@
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>blueprints freeze &lt;blueprint,&gt; Display the frozen blueprints modules and packages.
blueprints freeze show &lt;blueprint,&gt; Display the frozen blueprint in TOML format.
blueprints freeze save &lt;blueprint,&gt; Save the frozen blueprint to a file, &lt;blueprint-name&gt;.frozen.toml.</p>
<p>blueprints freeze &lt;blueprint,...&gt; Display the frozen blueprint's modules and packages.
blueprints freeze show &lt;blueprint,...&gt; Display the frozen blueprint in TOML format.
blueprints freeze save &lt;blueprint,...&gt; Save the frozen blueprint to a file, &lt;blueprint-name&gt;.frozen.toml.</p>
</dd></dl>
<dl class="function">
@ -319,16 +319,16 @@ blueprints freeze save &lt;blueprint,…&gt; Save the frozen blueprint to a file
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>blueprints freeze save &lt;blueprint,&gt; Save the frozen blueprint to a file, &lt;blueprint-name&gt;.frozen.toml.</p>
<p>blueprints freeze save &lt;blueprint,...&gt; Save the frozen blueprint to a file, &lt;blueprint-name&gt;.frozen.toml.</p>
</dd></dl>
<dl class="function">
@ -340,16 +340,16 @@ blueprints freeze save &lt;blueprint,…&gt; Save the frozen blueprint to a file
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>blueprints freeze show &lt;blueprint,&gt; Display the frozen blueprint in TOML format.</p>
<p>blueprints freeze show &lt;blueprint,...&gt; Display the frozen blueprint in TOML format.</p>
</dd></dl>
<dl class="function">
@ -361,10 +361,10 @@ blueprints freeze save &lt;blueprint,…&gt; Save the frozen blueprint to a file
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
@ -382,10 +382,10 @@ blueprints freeze save &lt;blueprint,…&gt; Save the frozen blueprint to a file
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
@ -403,16 +403,16 @@ blueprints freeze save &lt;blueprint,…&gt; Save the frozen blueprint to a file
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>blueprints save &lt;blueprint,&gt; Save the blueprint to a file, &lt;blueprint-name&gt;.toml</p>
<p>blueprints save &lt;blueprint,...&gt; Save the blueprint to a file, &lt;blueprint-name&gt;.toml</p>
</dd></dl>
<dl class="function">
@ -424,16 +424,16 @@ blueprints freeze save &lt;blueprint,…&gt; Save the frozen blueprint to a file
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>blueprints show &lt;blueprint,&gt; Display the blueprint in TOML format.</p>
<p>blueprints show &lt;blueprint,...&gt; Display the blueprint in TOML format.</p>
<p>Multiple blueprints will be separated by</p>
</dd></dl>
@ -446,10 +446,10 @@ blueprints freeze save &lt;blueprint,…&gt; Save the frozen blueprint to a file
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
@ -467,10 +467,10 @@ blueprints freeze save &lt;blueprint,…&gt; Save the frozen blueprint to a file
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
@ -488,10 +488,10 @@ blueprints freeze save &lt;blueprint,…&gt; Save the frozen blueprint to a file
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
@ -503,14 +503,14 @@ blueprints freeze save &lt;blueprint,…&gt; Save the frozen blueprint to a file
<dl class="function">
<dt id="composer.cli.blueprints.prettyCommitDetails">
<code class="descclassname">composer.cli.blueprints.</code><code class="descname">prettyCommitDetails</code><span class="sig-paren">(</span><em>change</em>, <em>indent=4</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/composer/cli/blueprints.html#prettyCommitDetails"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#composer.cli.blueprints.prettyCommitDetails" title="Permalink to this definition"></a></dt>
<dd><p>Print the blueprints change in a nice way</p>
<dd><p>Print the blueprint's change in a nice way</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>change</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><em>dict</em></a>) The individual blueprint change dict</li>
<li><strong>indent</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) Number of spaces to indent</li>
<li><strong>change</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><em>dict</em></a>) -- The individual blueprint change dict</li>
<li><strong>indent</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) -- Number of spaces to indent</li>
</ul>
</td>
</tr>
@ -526,7 +526,7 @@ blueprints freeze save &lt;blueprint,…&gt; Save the frozen blueprint to a file
<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>diff</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><em>dict</em></a>) Difference entry dict</td>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>diff</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><em>dict</em></a>) -- Difference entry dict</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Nice string</td>
</tr>
@ -555,11 +555,11 @@ blueprints freeze save &lt;blueprint,…&gt; Save the frozen blueprint to a file
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) unused in this function</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) -- unused in this function</li>
</ul>
</td>
</tr>
@ -577,7 +577,7 @@ blueprints freeze save &lt;blueprint,…&gt; Save the frozen blueprint to a file
<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> (<a class="reference external" href="https://docs.python.org/3/library/argparse.html#argparse.Namespace" title="(in Python v3.7)"><em>argparse.Namespace</em></a>) Cmdline arguments</td>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>opts</strong> (<a class="reference external" href="https://docs.python.org/3/library/argparse.html#argparse.Namespace" title="(in Python v3.7)"><em>argparse.Namespace</em></a>) -- Cmdline arguments</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Value to return from sys.exit()</td>
</tr>
@ -591,23 +591,23 @@ blueprints freeze save &lt;blueprint,…&gt; Save the frozen blueprint to a file
<dl class="function">
<dt id="composer.cli.compose.compose_delete">
<code class="descclassname">composer.cli.compose.</code><code class="descname">compose_delete</code><span class="sig-paren">(</span><em>socket_path</em>, <em>api_version</em>, <em>args</em>, <em>show_json=False</em>, <em>testmode=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/composer/cli/compose.html#compose_delete"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#composer.cli.compose.compose_delete" title="Permalink to this definition"></a></dt>
<dd><p>Delete a finished composes results</p>
<dd><p>Delete a finished compose's results</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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) unused in this function</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) -- unused in this function</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>compose delete &lt;uuid,&gt;</p>
<p>compose delete &lt;uuid,...&gt;</p>
<p>Delete the listed compose results. It will only delete results for composes that have finished
or failed, not a running compose.</p>
</dd></dl>
@ -615,17 +615,17 @@ or failed, not a running compose.</p>
<dl class="function">
<dt id="composer.cli.compose.compose_image">
<code class="descclassname">composer.cli.compose.</code><code class="descname">compose_image</code><span class="sig-paren">(</span><em>socket_path</em>, <em>api_version</em>, <em>args</em>, <em>show_json=False</em>, <em>testmode=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/composer/cli/compose.html#compose_image"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#composer.cli.compose.compose_image" title="Permalink to this definition"></a></dt>
<dd><p>Download the composes output image</p>
<dd><p>Download the compose's output 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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) unused in this function</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) -- unused in this function</li>
</ul>
</td>
</tr>
@ -645,11 +645,11 @@ of compose that was selected.</p>
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) unused in this function</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) -- unused in this function</li>
</ul>
</td>
</tr>
@ -674,35 +674,35 @@ of compose that was selected.</p>
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) unused in this function</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) -- unused in this function</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>compose log &lt;uuid&gt; [&lt;size&gt;kB]</p>
<p>This will display the last 1kB of the composes log file. Can be used to follow progress
<p>This will display the last 1kB of the compose's log file. Can be used to follow progress
during the build.</p>
</dd></dl>
<dl class="function">
<dt id="composer.cli.compose.compose_logs">
<code class="descclassname">composer.cli.compose.</code><code class="descname">compose_logs</code><span class="sig-paren">(</span><em>socket_path</em>, <em>api_version</em>, <em>args</em>, <em>show_json=False</em>, <em>testmode=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/composer/cli/compose.html#compose_logs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#composer.cli.compose.compose_logs" title="Permalink to this definition"></a></dt>
<dd><p>Download a tar of the composes logs</p>
<dd><p>Download a tar of the compose's 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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) unused in this function</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) -- unused in this function</li>
</ul>
</td>
</tr>
@ -715,17 +715,17 @@ during the build.</p>
<dl class="function">
<dt id="composer.cli.compose.compose_metadata">
<code class="descclassname">composer.cli.compose.</code><code class="descname">compose_metadata</code><span class="sig-paren">(</span><em>socket_path</em>, <em>api_version</em>, <em>args</em>, <em>show_json=False</em>, <em>testmode=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/composer/cli/compose.html#compose_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#composer.cli.compose.compose_metadata" title="Permalink to this definition"></a></dt>
<dd><p>Download a tar file of the composes metadata</p>
<dd><p>Download a tar file of the compose's metadata</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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) unused in this function</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) -- unused in this function</li>
</ul>
</td>
</tr>
@ -738,17 +738,17 @@ during the build.</p>
<dl class="function">
<dt id="composer.cli.compose.compose_results">
<code class="descclassname">composer.cli.compose.</code><code class="descname">compose_results</code><span class="sig-paren">(</span><em>socket_path</em>, <em>api_version</em>, <em>args</em>, <em>show_json=False</em>, <em>testmode=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/composer/cli/compose.html#compose_results"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#composer.cli.compose.compose_results" title="Permalink to this definition"></a></dt>
<dd><p>Download a tar file of the composes results</p>
<dd><p>Download a tar file of the compose's results</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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) unused in this function</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) -- unused in this function</li>
</ul>
</td>
</tr>
@ -768,11 +768,11 @@ It is saved as uuid.tar</p>
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) Set to 1 to simulate a failed compose, set to 2 to simulate a finished one.</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) -- Set to 1 to simulate a failed compose, set to 2 to simulate a finished one.</li>
</ul>
</td>
</tr>
@ -790,17 +790,17 @@ It is saved as uuid.tar</p>
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) unused in this function</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) -- unused in this function</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>This doesnt map directly to an API command, it combines the results from queue, finished,
<p>This doesn't map directly to an API command, it combines the results from queue, finished,
and failed so raw JSON output is not available.</p>
</dd></dl>
@ -813,11 +813,11 @@ and failed so raw JSON output is not available.</p>
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) unused in this function</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
<li><strong>testmode</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) -- unused in this function</li>
</ul>
</td>
</tr>
@ -841,7 +841,7 @@ include this extra information.</p>
<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> (<a class="reference external" href="https://docs.python.org/3/library/argparse.html#argparse.Namespace" title="(in Python v3.7)"><em>argparse.Namespace</em></a>) Cmdline arguments</td>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>opts</strong> (<a class="reference external" href="https://docs.python.org/3/library/argparse.html#argparse.Namespace" title="(in Python v3.7)"><em>argparse.Namespace</em></a>) -- Cmdline arguments</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Value to return from sys.exit()</td>
</tr>
@ -862,7 +862,7 @@ include this extra information.</p>
<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> (<a class="reference external" href="https://docs.python.org/3/library/argparse.html#argparse.Namespace" title="(in Python v3.7)"><em>argparse.Namespace</em></a>) Cmdline arguments</td>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>opts</strong> (<a class="reference external" href="https://docs.python.org/3/library/argparse.html#argparse.Namespace" title="(in Python v3.7)"><em>argparse.Namespace</em></a>) -- Cmdline arguments</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Value to return from sys.exit()</td>
</tr>
@ -881,16 +881,16 @@ include this extra information.</p>
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>projects info &lt;project,&gt;</p>
<p>projects info &lt;project,...&gt;</p>
</dd></dl>
<dl class="function">
@ -902,10 +902,10 @@ include this extra information.</p>
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
@ -926,10 +926,10 @@ include this extra information.</p>
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
@ -946,7 +946,7 @@ include this extra information.</p>
<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> (<a class="reference external" href="https://docs.python.org/3/library/argparse.html#argparse.Namespace" title="(in Python v3.7)"><em>argparse.Namespace</em></a>) Cmdline arguments</td>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>opts</strong> (<a class="reference external" href="https://docs.python.org/3/library/argparse.html#argparse.Namespace" title="(in Python v3.7)"><em>argparse.Namespace</em></a>) -- Cmdline arguments</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Value to return from sys.exit()</td>
</tr>
@ -965,10 +965,10 @@ include this extra information.</p>
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
@ -986,10 +986,10 @@ include this extra information.</p>
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
@ -1007,10 +1007,10 @@ include this extra information.</p>
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) Version of the API to talk to. eg. “0”</li>
<li><strong>args</strong> (<em>list of str</em>) List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) Set to True to show the JSON output instead of the human readable output</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- Version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>args</strong> (<em>list of str</em>) -- List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)"><em>bool</em></a>) -- Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
@ -1030,7 +1030,7 @@ include this extra information.</p>
<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> (<a class="reference external" href="https://docs.python.org/3/library/argparse.html#argparse.Namespace" title="(in Python v3.7)"><em>argparse.Namespace</em></a>) Cmdline arguments</td>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>opts</strong> (<a class="reference external" href="https://docs.python.org/3/library/argparse.html#argparse.Namespace" title="(in Python v3.7)"><em>argparse.Namespace</em></a>) -- Cmdline arguments</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Value to return from sys.exit()</td>
</tr>
@ -1051,7 +1051,7 @@ include this extra information.</p>
<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>args</strong> (<em>list of str</em>) list of strings with possible commas and spaces</td>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>args</strong> (<em>list of str</em>) -- list of strings with possible commas and spaces</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">List of all the items</td>
</tr>
@ -1060,7 +1060,7 @@ include this extra information.</p>
</tbody>
</table>
<p>Examples:</p>
<p>[“one,two”, “three”, “,four”, “,five,”] returns [“one”, “two”, “three”, “four”, “five”]</p>
<p>[&quot;one,two&quot;, &quot;three&quot;, &quot;,four&quot;, &quot;,five,&quot;] returns [&quot;one&quot;, &quot;two&quot;, &quot;three&quot;, &quot;four&quot;, &quot;five&quot;]</p>
</dd></dl>
<dl class="function">
@ -1071,9 +1071,9 @@ include this extra information.</p>
<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>blueprint_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 blueprints name</td>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>blueprint_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 blueprint's name</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The blueprint name with converted to - and .toml appended</td>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The blueprint name with ' ' converted to - and .toml appended</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>
@ -1089,7 +1089,7 @@ include this extra information.</p>
<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>result</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><em>dict</em></a>) JSON result from the http query</td>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>result</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><em>dict</em></a>) -- JSON result from the http query</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#tuple" title="(in Python v3.7)">tuple</a></td>
</tr>
@ -1109,7 +1109,7 @@ not to continue processing the results.</p>
<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>pkg</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><em>dict</em></a>) The package details</td>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>pkg</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><em>dict</em></a>) -- The package details</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">name-[epoch:]version-release-arch</td>
</tr>
@ -1127,9 +1127,9 @@ not to continue processing the results.</p>
<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>blueprint_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 blueprints name</td>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>blueprint_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 blueprint's name</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The blueprint name with converted to - and .toml appended</td>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The blueprint name with ' ' converted to - and .toml appended</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>
@ -1148,7 +1148,7 @@ not to continue processing the results.</p>
<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> (<a class="reference external" href="https://docs.python.org/3/library/argparse.html#argparse.Namespace" title="(in Python v3.7)"><em>argparse.Namespace</em></a>) Cmdline arguments</td>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>opts</strong> (<a class="reference external" href="https://docs.python.org/3/library/argparse.html#argparse.Namespace" title="(in Python v3.7)"><em>argparse.Namespace</em></a>) -- Cmdline arguments</td>
</tr>
</tbody>
</table>
@ -1201,7 +1201,7 @@ not to continue processing the results.</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>composer package &mdash; Lorax 29.21 documentation</title>
<title>composer package &mdash; Lorax 29.28 documentation</title>
@ -58,7 +58,7 @@
<div class="version">
29.21
29.28
</div>
@ -208,8 +208,8 @@
<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>api_version</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 version of the API to talk to. eg. “0”</li>
<li><strong>url</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 API route to talk to</li>
<li><strong>api_version</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 version of the API to talk to. eg. &quot;0&quot;</li>
<li><strong>url</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 API route to talk to</li>
</ul>
</td>
</tr>
@ -227,16 +227,16 @@
<dt id="composer.http_client.append_query">
<code class="descclassname">composer.http_client.</code><code class="descname">append_query</code><span class="sig-paren">(</span><em>url</em>, <em>query</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/composer/http_client.html#append_query"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#composer.http_client.append_query" title="Permalink to this definition"></a></dt>
<dd><p>Add a query argument to a URL</p>
<p>The query should be of the form “param1=what&amp;param2=ever”, i.e., no
leading ?. The new query data will be appended to any existing
<p>The query should be of the form &quot;param1=what&amp;param2=ever&quot;, i.e., no
leading '?'. The new query data will be appended to any existing
query 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"><ul class="first simple">
<li><strong>url</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 original URL</li>
<li><strong>query</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 query to append</li>
<li><strong>url</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 original URL</li>
<li><strong>query</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 query to append</li>
</ul>
</td>
</tr>
@ -259,8 +259,8 @@ query string.</p>
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>url</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) URL to send DELETE to</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>url</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- URL to send DELETE to</li>
</ul>
</td>
</tr>
@ -283,8 +283,8 @@ query string.</p>
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>url</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) URL to send POST to</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>url</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- URL to send POST to</li>
</ul>
</td>
</tr>
@ -300,7 +300,7 @@ query string.</p>
<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>response</strong> (<em>Response</em>) The urllib3 response object</td>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>response</strong> (<em>Response</em>) -- The urllib3 response object</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body">RuntimeError if it cannot find a filename in the header</td>
</tr>
@ -321,8 +321,8 @@ query string.</p>
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>url</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) URL to request</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>url</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- URL to request</li>
</ul>
</td>
</tr>
@ -347,8 +347,8 @@ fetch all results for the given request.</p>
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>url</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) URL to request</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>url</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- URL to request</li>
</ul>
</td>
</tr>
@ -371,8 +371,8 @@ fetch all results for the given request.</p>
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>url</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) URL to request</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>url</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- URL to request</li>
</ul>
</td>
</tr>
@ -395,9 +395,9 @@ fetch all results for the given request.</p>
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>url</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) URL to send POST to</li>
<li><strong>body</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 data for the body of the POST</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>url</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- URL to send POST to</li>
<li><strong>body</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 data for the body of the POST</li>
</ul>
</td>
</tr>
@ -420,9 +420,9 @@ fetch all results for the given request.</p>
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>url</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) URL to send POST to</li>
<li><strong>body</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 data for the body of the POST</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>url</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- URL to send POST to</li>
<li><strong>body</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 data for the body of the POST</li>
</ul>
</td>
</tr>
@ -445,9 +445,9 @@ fetch all results for the given request.</p>
<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>socket_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 the Unix socket to use for API communication</li>
<li><strong>url</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) URL to send POST to</li>
<li><strong>body</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 data for the body of the POST</li>
<li><strong>socket_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 the Unix socket to use for API communication</li>
<li><strong>url</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) -- URL to send POST to</li>
<li><strong>body</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 data for the body of the POST</li>
</ul>
</td>
</tr>
@ -532,7 +532,7 @@ fetch all results for the given request.</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -9,7 +9,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Index &mdash; Lorax 29.21 documentation</title>
<title>Index &mdash; Lorax 29.28 documentation</title>
@ -57,7 +57,7 @@
<div class="version">
29.21
29.28
</div>
@ -185,6 +185,8 @@
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pylorax.api.html#pylorax.api.compose.add_customizations">add_customizations() (in module pylorax.api.compose)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.gitrpm.GitRpmBuild.add_git_tarball">add_git_tarball() (pylorax.api.gitrpm.GitRpmBuild method)</a>
</li>
<li><a href="pylorax.html#pylorax.treeinfo.TreeInfo.add_section">add_section() (pylorax.treeinfo.TreeInfo method)</a>
</li>
@ -193,11 +195,11 @@
<li><a href="pylorax.api.html#pylorax.api.projects.api_changelog">api_changelog() (in module pylorax.api.projects)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.projects.api_time">api_time() (in module pylorax.api.projects)</a>
</li>
<li><a href="composer.html#composer.http_client.api_url">api_url() (in module composer.http_client)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="composer.html#composer.http_client.api_url">api_url() (in module composer.http_client)</a>
</li>
<li><a href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.append">append() (pylorax.ltmpl.LoraxTemplateRunner method)</a>
</li>
<li><a href="pylorax.html#pylorax.installer.append_initrd">append_initrd() (in module pylorax.installer)</a>
@ -238,10 +240,10 @@
</li>
<li><a href="composer.cli.html#composer.cli.blueprints.blueprints_freeze_show">blueprints_freeze_show() (in module composer.cli.blueprints)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="composer.cli.html#composer.cli.blueprints.blueprints_list">blueprints_list() (in module composer.cli.blueprints)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="composer.cli.html#composer.cli.blueprints.blueprints_push">blueprints_push() (in module composer.cli.blueprints)</a>
</li>
<li><a href="composer.cli.html#composer.cli.blueprints.blueprints_save">blueprints_save() (in module composer.cli.blueprints)</a>
@ -253,6 +255,8 @@
<li><a href="composer.cli.html#composer.cli.blueprints.blueprints_undo">blueprints_undo() (in module composer.cli.blueprints)</a>
</li>
<li><a href="composer.cli.html#composer.cli.blueprints.blueprints_workspace">blueprints_workspace() (in module composer.cli.blueprints)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.compose.bootloader_append">bootloader_append() (in module pylorax.api.compose)</a>
</li>
<li><a href="pylorax.html#pylorax.ltmpl.brace_expand">brace_expand() (in module pylorax.ltmpl)</a>
</li>
@ -271,6 +275,12 @@
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pylorax.html#pylorax.creator.calculate_disk_size">calculate_disk_size() (in module pylorax.creator)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.gitrpm.GitRpmBuild.check">check() (pylorax.api.gitrpm.GitRpmBuild method)</a>
</li>
<li><a href="pylorax.html#pylorax.creator.check_kickstart">check_kickstart() (in module pylorax.creator)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.queue.check_queues">check_queues() (in module pylorax.api.queue)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.checkparams.checkparams">checkparams() (in module pylorax.api.checkparams)</a>
</li>
@ -279,8 +289,12 @@
<li><a href="pylorax.html#pylorax.sysutils.chmod_">chmod_() (in module pylorax.sysutils)</a>
</li>
<li><a href="pylorax.html#pylorax.sysutils.chown_">chown_() (in module pylorax.sysutils)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.gitrpm.GitRpmBuild.clean">clean() (pylorax.api.gitrpm.GitRpmBuild method)</a>
</li>
<li><a href="pylorax.html#pylorax.treebuilder.RuntimeBuilder.cleanup">cleanup() (pylorax.treebuilder.RuntimeBuilder method)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.gitrpm.GitRpmBuild.cleanup_tmpdir">cleanup_tmpdir() (pylorax.api.gitrpm.GitRpmBuild method)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.recipes.commit_recipe">commit_recipe() (in module pylorax.api.recipes)</a>
</li>
@ -326,10 +340,10 @@
<li><a href="pylorax.api.html#pylorax.api.compose.compose_types">(in module pylorax.api.compose)</a>
</li>
</ul></li>
<li><a href="composer.html#module-composer">composer (module)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="composer.html#module-composer">composer (module)</a>
</li>
<li><a href="composer.cli.html#module-composer.cli">composer.cli (module)</a>
</li>
<li><a href="composer.cli.html#module-composer.cli.blueprints">composer.cli.blueprints (module)</a>
@ -377,10 +391,14 @@
<li><a href="pylorax.html#pylorax.treebuilder.TreeBuilder.copy_dracut_hooks">copy_dracut_hooks() (pylorax.treebuilder.TreeBuilder method)</a>
</li>
<li><a href="pylorax.html#pylorax.imgutils.copytree">copytree() (in module pylorax.imgutils)</a>
</li>
<li><a href="pylorax.html#pylorax.treebuilder.RuntimeBuilder.create_ext4_runtime">create_ext4_runtime() (pylorax.treebuilder.RuntimeBuilder method)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.gitrpm.create_gitrpm_repo">create_gitrpm_repo() (in module pylorax.api.gitrpm)</a>
</li>
<li><a href="pylorax.html#pylorax.creator.create_pxe_config">create_pxe_config() (in module pylorax.creator)</a>
</li>
<li><a href="pylorax.html#pylorax.treebuilder.RuntimeBuilder.create_runtime">create_runtime() (pylorax.treebuilder.RuntimeBuilder method)</a>
<li><a href="pylorax.html#pylorax.treebuilder.RuntimeBuilder.create_squashfs_runtime">create_squashfs_runtime() (pylorax.treebuilder.RuntimeBuilder method)</a>
</li>
<li><a href="pylorax.html#pylorax.installer.create_vagrant_metadata">create_vagrant_metadata() (in module pylorax.installer)</a>
</li>
@ -392,6 +410,8 @@
<li><a href="pylorax.api.html#pylorax.api.crossdomain.crossdomain">(in module pylorax.api.crossdomain)</a>
</li>
</ul></li>
<li><a href="pylorax.api.html#pylorax.api.compose.customize_ks_template">customize_ks_template() (in module pylorax.api.compose)</a>
</li>
</ul></td>
</tr></table>
@ -491,6 +511,8 @@
<li><a href="pylorax.html#pylorax.monitor.LogRequestHandler.finish">finish() (pylorax.monitor.LogRequestHandler method)</a>
</li>
<li><a href="pylorax.html#pylorax.treebuilder.RuntimeBuilder.finished">finished() (pylorax.treebuilder.RuntimeBuilder method)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.compose.firewall_cmd">firewall_cmd() (in module pylorax.api.compose)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.recipes.Recipe.freeze">freeze() (pylorax.api.recipes.Recipe method)</a>
</li>
@ -507,6 +529,8 @@
<li><a href="pylorax.html#pylorax.treebuilder.generate_module_info">generate_module_info() (in module pylorax.treebuilder)</a>
</li>
<li><a href="pylorax.html#pylorax.creator.get_arch">get_arch() (in module pylorax.creator)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.gitrpm.GitRpmBuild.get_base_dir">get_base_dir() (pylorax.api.gitrpm.GitRpmBuild method)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.dnfbase.get_base_object">get_base_object() (in module pylorax.api.dnfbase)</a>
</li>
@ -517,24 +541,42 @@
<li><a href="pylorax.api.html#pylorax.api.queue.get_compose_type">get_compose_type() (in module pylorax.api.queue)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.config.ComposerConfig.get_default">get_default() (pylorax.api.config.ComposerConfig method)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.compose.get_default_services">get_default_services() (in module pylorax.api.compose)</a>
</li>
<li><a href="pylorax.html#pylorax.dnfbase.get_dnf_base_object">get_dnf_base_object() (in module pylorax.dnfbase)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.compose.get_extra_pkgs">get_extra_pkgs() (in module pylorax.api.compose)</a>
</li>
<li><a href="composer.html#composer.http_client.get_filename">get_filename() (in module composer.http_client)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.compose.get_firewall_settings">get_firewall_settings() (in module pylorax.api.compose)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.queue.get_image_name">get_image_name() (in module pylorax.api.queue)</a>
</li>
<li><a href="pylorax.html#pylorax.mount.IsoMountpoint.get_iso_label">get_iso_label() (pylorax.mount.IsoMountpoint method)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.compose.get_kernel_append">get_kernel_append() (in module pylorax.api.compose)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pylorax.html#pylorax.mount.IsoMountpoint.get_iso_label">get_iso_label() (pylorax.mount.IsoMountpoint method)</a>
<li><a href="pylorax.api.html#pylorax.api.compose.get_keyboard_layout">get_keyboard_layout() (in module pylorax.api.compose)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.compose.get_languages">get_languages() (in module pylorax.api.compose)</a>
</li>
<li><a href="pylorax.html#pylorax.imgutils.get_loop_name">get_loop_name() (in module pylorax.imgutils)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.gitrpm.get_repo_description">get_repo_description() (in module pylorax.api.gitrpm)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.projects.get_repo_sources">get_repo_sources() (in module pylorax.api.projects)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.recipes.get_revision_from_tag">get_revision_from_tag() (in module pylorax.api.recipes)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.compose.get_services">get_services() (in module pylorax.api.compose)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.projects.get_source_ids">get_source_ids() (in module pylorax.api.projects)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.compose.get_timezone_settings">get_timezone_settings() (in module pylorax.api.compose)</a>
</li>
<li><a href="composer.html#composer.http_client.get_url_json">get_url_json() (in module composer.http_client)</a>
</li>
@ -543,8 +585,12 @@
<li><a href="composer.html#composer.http_client.get_url_raw">get_url_raw() (in module composer.http_client)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.recipes.gfile">gfile() (in module pylorax.api.recipes)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.gitrpm.GitArchiveTarball">GitArchiveTarball (class in pylorax.api.gitrpm)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.server.GitLock">GitLock (class in pylorax.api.server)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.gitrpm.GitRpmBuild">GitRpmBuild (class in pylorax.api.gitrpm)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.recipes.Recipe.group_names">group_names (pylorax.api.recipes.Recipe attribute)</a>
</li>
@ -575,6 +621,8 @@
<li><a href="pylorax.html#pylorax.Lorax.init_file_logging">init_file_logging() (pylorax.Lorax method)</a>
</li>
<li><a href="pylorax.html#pylorax.Lorax.init_stream_logging">init_stream_logging() (pylorax.Lorax method)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.bisect.insort_left">insort_left() (in module pylorax.api.bisect)</a>
</li>
<li><a href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.install">install() (pylorax.ltmpl.LoraxTemplateRunner method)</a>
@ -592,8 +640,12 @@
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.installkernel">installkernel() (pylorax.ltmpl.LoraxTemplateRunner method)</a>
</li>
<li><a href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.installpkg">installpkg() (pylorax.ltmpl.LoraxTemplateRunner method)</a>
<li><a href="pylorax.html#pylorax.ltmpl.LiveTemplateRunner.installpkg">installpkg() (pylorax.ltmpl.LiveTemplateRunner method)</a>
<ul>
<li><a href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.installpkg">(pylorax.ltmpl.LoraxTemplateRunner method)</a>
</li>
</ul></li>
<li><a href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.installupgradeinitrd">installupgradeinitrd() (pylorax.ltmpl.LoraxTemplateRunner method)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.recipes.is_commit_tag">is_commit_tag() (in module pylorax.api.recipes)</a>
@ -621,6 +673,12 @@
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pylorax.html#pylorax.treebuilder.TreeBuilder.kernels">kernels (pylorax.treebuilder.TreeBuilder attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pylorax.api.html#pylorax.api.compose.keyboard_cmd">keyboard_cmd() (in module pylorax.api.compose)</a>
</li>
<li><a href="pylorax.html#pylorax.imgutils.kpartx_disk_img">kpartx_disk_img() (in module pylorax.imgutils)</a>
</li>
</ul></td>
</tr></table>
@ -628,6 +686,8 @@
<h2 id="L">L</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pylorax.api.html#pylorax.api.compose.lang_cmd">lang_cmd() (in module pylorax.api.compose)</a>
</li>
<li><a href="pylorax.html#pylorax.ArchData.lib64_arches">lib64_arches (pylorax.ArchData attribute)</a>
</li>
<li><a href="pylorax.html#pylorax.sysutils.linktree">linktree() (in module pylorax.sysutils)</a>
@ -637,6 +697,8 @@
<li><a href="pylorax.api.html#pylorax.api.recipes.list_commit_files">list_commit_files() (in module pylorax.api.recipes)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.recipes.list_commits">list_commits() (in module pylorax.api.recipes)</a>
</li>
<li><a href="pylorax.html#pylorax.ltmpl.LiveTemplateRunner">LiveTemplateRunner (class in pylorax.ltmpl)</a>
</li>
<li><a href="pylorax.html#pylorax.cmdline.lmc_parser">lmc_parser() (in module pylorax.cmdline)</a>
</li>
@ -653,11 +715,11 @@
<li><a href="pylorax.html#pylorax.monitor.LogServer.log_check">log_check() (pylorax.monitor.LogServer method)</a>
</li>
<li><a href="pylorax.html#pylorax.log_selinux_state">log_selinux_state() (in module pylorax)</a>
</li>
<li><a href="pylorax.html#pylorax.monitor.LogMonitor">LogMonitor (class in pylorax.monitor)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pylorax.html#pylorax.monitor.LogMonitor">LogMonitor (class in pylorax.monitor)</a>
</li>
<li><a href="pylorax.html#pylorax.monitor.LogRequestHandler">LogRequestHandler (class in pylorax.monitor)</a>
</li>
<li><a href="pylorax.html#pylorax.monitor.LogServer">LogServer (class in pylorax.monitor)</a>
@ -697,6 +759,8 @@
<li><a href="pylorax.api.html#pylorax.api.queue.make_compose">make_compose() (in module pylorax.api.queue)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.config.make_dnf_dirs">make_dnf_dirs() (in module pylorax.api.config)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.gitrpm.make_git_rpm">make_git_rpm() (in module pylorax.api.gitrpm)</a>
</li>
<li><a href="pylorax.html#pylorax.creator.make_image">make_image() (in module pylorax.creator)</a>
</li>
@ -723,11 +787,11 @@
<li><a href="pylorax.html#pylorax.imgutils.mkext4img">mkext4img() (in module pylorax.imgutils)</a>
</li>
<li><a href="pylorax.html#pylorax.imgutils.mkfsimage">mkfsimage() (in module pylorax.imgutils)</a>
</li>
<li><a href="pylorax.html#pylorax.imgutils.mkfsimage_from_disk">mkfsimage_from_disk() (in module pylorax.imgutils)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pylorax.html#pylorax.imgutils.mkfsimage_from_disk">mkfsimage_from_disk() (in module pylorax.imgutils)</a>
</li>
<li><a href="pylorax.html#pylorax.imgutils.mkhfsimg">mkhfsimg() (in module pylorax.imgutils)</a>
</li>
<li><a href="pylorax.html#pylorax.imgutils.mkqcow2">mkqcow2() (in module pylorax.imgutils)</a>
@ -770,11 +834,13 @@
<h2 id="N">N</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pylorax.html#pylorax.installer.novirt_install">novirt_install() (in module pylorax.installer)</a>
<li><a href="pylorax.api.html#pylorax.api.recipes.NewRecipeGit">NewRecipeGit() (in module pylorax.api.recipes)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pylorax.html#pylorax.installer.novirt_log_check">novirt_log_check() (in module pylorax.installer)</a>
<li><a href="pylorax.html#pylorax.installer.novirt_cancel_check">novirt_cancel_check() (in module pylorax.installer)</a>
</li>
<li><a href="pylorax.html#pylorax.installer.novirt_install">novirt_install() (in module pylorax.installer)</a>
</li>
</ul></td>
</tr></table>
@ -807,6 +873,8 @@
<li><a href="pylorax.html#pylorax.base.BaseLoraxClass.perror">perror() (pylorax.base.BaseLoraxClass method)</a>
</li>
<li><a href="pylorax.html#pylorax.base.BaseLoraxClass.pinfo">pinfo() (pylorax.base.BaseLoraxClass method)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.projects.pkg_to_build">pkg_to_build() (in module pylorax.api.projects)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.projects.pkg_to_dep">pkg_to_dep() (in module pylorax.api.projects)</a>
</li>
@ -864,6 +932,8 @@
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pylorax.api.html#module-pylorax.api.bisect">pylorax.api.bisect (module)</a>
</li>
<li><a href="pylorax.api.html#module-pylorax.api.checkparams">pylorax.api.checkparams (module)</a>
</li>
<li><a href="pylorax.api.html#module-pylorax.api.cmdline">pylorax.api.cmdline (module)</a>
@ -877,6 +947,8 @@
<li><a href="pylorax.api.html#module-pylorax.api.dnfbase">pylorax.api.dnfbase (module)</a>
</li>
<li><a href="pylorax.api.html#module-pylorax.api.errors">pylorax.api.errors (module)</a>
</li>
<li><a href="pylorax.api.html#module-pylorax.api.gitrpm">pylorax.api.gitrpm (module)</a>
</li>
<li><a href="pylorax.api.html#module-pylorax.api.projects">pylorax.api.projects (module)</a>
</li>
@ -979,6 +1051,8 @@
<li><a href="pylorax.api.html#pylorax.api.recipes.RecipeError">RecipeError</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.recipes.RecipeFileError">RecipeFileError</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.recipes.RecipeGit">RecipeGit (class in pylorax.api.recipes)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.recipes.RecipeGroup">RecipeGroup (class in pylorax.api.recipes)</a>
</li>
@ -1007,6 +1081,8 @@
</li>
</ul></li>
<li><a href="pylorax.api.html#pylorax.api.server.GitLock.repo">repo (pylorax.api.server.GitLock attribute)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.recipes.repo_file_exists">repo_file_exists() (in module pylorax.api.recipes)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.compose.repo_to_ks">repo_to_ks() (in module pylorax.api.compose)</a>
</li>
@ -1027,7 +1103,7 @@
<li><a href="pylorax.html#pylorax.Lorax.run">run() (pylorax.Lorax method)</a>
<ul>
<li><a href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.run">(pylorax.ltmpl.LoraxTemplateRunner method)</a>
<li><a href="pylorax.html#pylorax.ltmpl.TemplateRunner.run">(pylorax.ltmpl.TemplateRunner method)</a>
</li>
</ul></li>
<li><a href="pylorax.html#pylorax.creator.run_creator">run_creator() (in module pylorax.creator)</a>
@ -1050,6 +1126,8 @@
<h2 id="S">S</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pylorax.api.html#pylorax.api.compose.services_cmd">services_cmd() (in module pylorax.api.compose)</a>
</li>
<li><a href="pylorax.html#pylorax.executils.setenv">setenv() (in module pylorax.executils)</a>
</li>
<li><a href="pylorax.html#pylorax.monitor.LogRequestHandler.setup">setup() (pylorax.monitor.LogRequestHandler method)</a>
@ -1069,11 +1147,11 @@
<li><a href="composer.cli.html#composer.cli.sources.sources_cmd">sources_cmd() (in module composer.cli.sources)</a>
</li>
<li><a href="composer.cli.html#composer.cli.sources.sources_delete">sources_delete() (in module composer.cli.sources)</a>
</li>
<li><a href="composer.cli.html#composer.cli.sources.sources_info">sources_info() (in module composer.cli.sources)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="composer.cli.html#composer.cli.sources.sources_info">sources_info() (in module composer.cli.sources)</a>
</li>
<li><a href="composer.cli.html#composer.cli.sources.sources_list">sources_list() (in module composer.cli.sources)</a>
</li>
<li><a href="pylorax.html#pylorax.ltmpl.split_and_expand">split_and_expand() (in module pylorax.ltmpl)</a>
@ -1109,6 +1187,8 @@
<li><a href="pylorax.api.html#pylorax.api.v0.take_limits">take_limits() (in module pylorax.api.v0)</a>
</li>
<li><a href="pylorax.html#pylorax.Lorax.templatedir">templatedir (pylorax.Lorax attribute)</a>
</li>
<li><a href="pylorax.html#pylorax.ltmpl.TemplateRunner">TemplateRunner (class in pylorax.ltmpl)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.compose.test_templates">test_templates() (in module pylorax.api.compose)</a>
</li>
@ -1117,6 +1197,8 @@
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pylorax.api.html#pylorax.api.timestamp.timestamp_dict">timestamp_dict() (in module pylorax.api.timestamp)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.compose.timezone_cmd">timezone_cmd() (in module pylorax.api.compose)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.recipes.Recipe.toml">toml() (pylorax.api.recipes.Recipe method)</a>
</li>
@ -1205,6 +1287,8 @@
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pylorax.api.html#pylorax.api.recipes.write_commit">write_commit() (in module pylorax.api.recipes)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.gitrpm.GitArchiveTarball.write_file">write_file() (pylorax.api.gitrpm.GitArchiveTarball method)</a>
</li>
<li><a href="pylorax.api.html#pylorax.api.compose.write_ks_group">write_ks_group() (in module pylorax.api.compose)</a>
</li>
@ -1257,7 +1341,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome to Loraxs documentation! &mdash; Lorax 29.21 documentation</title>
<title>Welcome to Lorax&#39;s documentation! &mdash; Lorax 29.28 documentation</title>
@ -57,7 +57,7 @@
<div class="version">
29.21
29.28
</div>
@ -135,7 +135,7 @@
<li><a href="#">Docs</a> &raquo;</li>
<li>Welcome to Loraxs documentation!</li>
<li>Welcome to Lorax's documentation!</li>
<li class="wy-breadcrumbs-aside">
@ -155,7 +155,7 @@
<div itemprop="articleBody">
<div class="section" id="welcome-to-lorax-s-documentation">
<h1>Welcome to Loraxs documentation!<a class="headerlink" href="#welcome-to-lorax-s-documentation" title="Permalink to this headline"></a></h1>
<h1>Welcome to Lorax's documentation!<a class="headerlink" href="#welcome-to-lorax-s-documentation" title="Permalink to this headline"></a></h1>
<p>Contents:</p>
<div class="toctree-wrapper compound">
<ul>
@ -228,7 +228,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Introduction to Lorax &mdash; Lorax 29.21 documentation</title>
<title>Introduction to Lorax &mdash; Lorax 29.28 documentation</title>
@ -29,7 +29,7 @@
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Lorax" href="lorax.html" />
<link rel="prev" title="Welcome to Loraxs documentation!" href="index.html" />
<link rel="prev" title="Welcome to Lorax&#39;s documentation!" href="index.html" />
<script src="_static/js/modernizr.min.js"></script>
@ -58,7 +58,7 @@
<div class="version">
29.21
29.28
</div>
@ -166,14 +166,14 @@ of the iso for all of the supported architectures.</p>
</div>
<div class="section" id="before-lorax">
<h1>Before Lorax<a class="headerlink" href="#before-lorax" title="Permalink to this headline"></a></h1>
<p>Tree building tools such as pungi and revisor rely on buildinstall in
<p>Tree building tools such as pungi and revisor rely on 'buildinstall' in
anaconda/scripts/ to produce the boot images and other such control files
in the final tree. The existing buildinstall scripts written in a mix of
bash and Python are unmaintainable. Lorax is an attempt to replace them
with something more flexible.</p>
<p>EXISTING WORKFLOW:</p>
<p>pungi and other tools call scripts/buildinstall, which in turn call other
scripts to do the image building and data generation. Heres how it
scripts to do the image building and data generation. Here's how it
currently looks:</p>
<blockquote>
<div><dl class="docutils">
@ -200,7 +200,7 @@ maketreeinfo.py, makestamp.py, and buildinstall</li>
First, almost all knowledge of what goes in to the stage 1 and stage 2
images lives in upd-instroot. The mk-images* scripts copy things from the
root created by upd-instroot in order to build the stage 1 image, though
its not completely clear from reading the scripts.</p>
it's not completely clear from reading the scripts.</p>
<p>NEW IDEAS:</p>
<p>Create a new central driver with all information living in Python modules.
Configuration files will provide the knowledge previously contained in the
@ -218,7 +218,7 @@ upd-instroot and mk-images* scripts.</p>
<a href="lorax.html" class="btn btn-neutral float-right" title="Lorax" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="index.html" class="btn btn-neutral" title="Welcome to Loraxs documentation!" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
<a href="index.html" class="btn btn-neutral" title="Welcome to Lorax&#39;s documentation!" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
@ -251,7 +251,7 @@ upd-instroot and mk-images* scripts.</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>livemedia-creator &mdash; Lorax 29.21 documentation</title>
<title>livemedia-creator &mdash; Lorax 29.28 documentation</title>
@ -58,7 +58,7 @@
<div class="version">
29.21
29.28
</div>
@ -112,7 +112,7 @@
<li class="toctree-l2"><a class="reference internal" href="#tar-file-creation">TAR File Creation</a></li>
<li class="toctree-l2"><a class="reference internal" href="#live-image-for-pxe-boot">Live Image for PXE Boot</a></li>
<li class="toctree-l2"><a class="reference internal" href="#atomic-live-image-for-pxe-boot">Atomic Live Image for PXE Boot</a></li>
<li class="toctree-l2"><a class="reference internal" href="#using-mock-and-no-virt-to-create-images">Using Mock and no-virt to Create Images</a></li>
<li class="toctree-l2"><a class="reference internal" href="#using-mock-and-no-virt-to-create-images">Using Mock and --no-virt to Create Images</a></li>
<li class="toctree-l2"><a class="reference internal" href="#using-mock-and-qemu-to-create-images">Using Mock and qemu to Create Images</a></li>
<li class="toctree-l2"><a class="reference internal" href="#openstack-image-creation">OpenStack Image Creation</a></li>
<li class="toctree-l2"><a class="reference internal" href="#docker-image-creation">Docker Image Creation</a></li>
@ -210,7 +210,7 @@ OpenStack.</p>
<p>The general idea is to use qemu with kickstart and an Anaconda boot.iso to
install into a disk image and then use the disk image to create the bootable
media.</p>
<p>livemedia-creator help will describe all of the options available. At the
<p>livemedia-creator --help will describe all of the options available. At the
minimum you need:</p>
<p><code class="docutils literal notranslate"><span class="pre">--make-iso</span></code> to create a final bootable .iso or one of the other <code class="docutils literal notranslate"><span class="pre">--make-*</span></code> options.</p>
<p><code class="docutils literal notranslate"><span class="pre">--iso</span></code> to specify the Anaconda install media to use with qemu.</p>
@ -226,7 +226,7 @@ you have the anaconda-tui package installed.</p>
<h2>livemedia-creator cmdline arguments<a class="headerlink" href="#livemedia-creator-cmdline-arguments" title="Permalink to this headline"></a></h2>
<p>Create Live Install Media</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">usage</span><span class="p">:</span> <span class="n">livemedia</span><span class="o">-</span><span class="n">creator</span> <span class="p">[</span><span class="o">-</span><span class="n">h</span><span class="p">]</span>
<span class="p">(</span><span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">iso</span> <span class="o">|</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">disk</span> <span class="o">|</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">fsimage</span> <span class="o">|</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">appliance</span> <span class="o">|</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">ami</span> <span class="o">|</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">tar</span> <span class="o">|</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">pxe</span><span class="o">-</span><span class="n">live</span> <span class="o">|</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">ostree</span><span class="o">-</span><span class="n">live</span> <span class="o">|</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">oci</span> <span class="o">|</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">vagrant</span><span class="p">)</span>
<span class="p">(</span><span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">iso</span> <span class="o">|</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">disk</span> <span class="o">|</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">fsimage</span> <span class="o">|</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">appliance</span> <span class="o">|</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">ami</span> <span class="o">|</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">tar</span> <span class="o">|</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">tar</span><span class="o">-</span><span class="n">disk</span> <span class="o">|</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">pxe</span><span class="o">-</span><span class="n">live</span> <span class="o">|</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">ostree</span><span class="o">-</span><span class="n">live</span> <span class="o">|</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">oci</span> <span class="o">|</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">vagrant</span><span class="p">)</span>
<span class="p">[</span><span class="o">--</span><span class="n">iso</span> <span class="n">ISO</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">iso</span><span class="o">-</span><span class="n">only</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">iso</span><span class="o">-</span><span class="n">name</span> <span class="n">ISO_NAME</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">ks</span> <span class="n">KS</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">image</span><span class="o">-</span><span class="n">only</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">no</span><span class="o">-</span><span class="n">virt</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">proxy</span> <span class="n">PROXY</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">anaconda</span><span class="o">-</span><span class="n">arg</span> <span class="n">ANACONDA_ARGS</span><span class="p">]</span>
@ -234,11 +234,14 @@ you have the anaconda-tui package installed.</p>
<span class="p">[</span><span class="o">--</span><span class="n">logfile</span> <span class="n">LOGFILE</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">lorax</span><span class="o">-</span><span class="n">templates</span> <span class="n">LORAX_TEMPLATES</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">tmp</span> <span class="n">TMP</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">resultdir</span> <span class="n">RESULT_DIR</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">macboot</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">nomacboot</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">extra</span><span class="o">-</span><span class="n">boot</span><span class="o">-</span><span class="n">args</span> <span class="n">EXTRA_BOOT_ARGS</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">disk</span><span class="o">-</span><span class="n">image</span> <span class="n">DISK_IMAGE</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">keep</span><span class="o">-</span><span class="n">image</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">fs</span><span class="o">-</span><span class="n">image</span> <span class="n">FS_IMAGE</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">image</span><span class="o">-</span><span class="n">name</span> <span class="n">IMAGE_NAME</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">fs</span><span class="o">-</span><span class="n">label</span> <span class="n">FS_LABEL</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">image</span><span class="o">-</span><span class="nb">type</span> <span class="n">IMAGE_TYPE</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">qemu</span><span class="o">-</span><span class="n">arg</span> <span class="n">QEMU_ARGS</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">qcow2</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">qcow2</span><span class="o">-</span><span class="n">arg</span> <span class="n">QEMU_ARGS</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">compression</span> <span class="n">COMPRESSION</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">tar</span><span class="o">-</span><span class="n">disk</span><span class="o">-</span><span class="n">name</span> <span class="n">TAR_DISK_NAME</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">fs</span><span class="o">-</span><span class="n">label</span> <span class="n">FS_LABEL</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">image</span><span class="o">-</span><span class="n">size</span><span class="o">-</span><span class="n">align</span> <span class="n">IMAGE_SIZE_ALIGN</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">image</span><span class="o">-</span><span class="nb">type</span> <span class="n">IMAGE_TYPE</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">qemu</span><span class="o">-</span><span class="n">arg</span> <span class="n">QEMU_ARGS</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">qcow2</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">qcow2</span><span class="o">-</span><span class="n">arg</span> <span class="n">QEMU_ARGS</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">compression</span> <span class="n">COMPRESSION</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">compress</span><span class="o">-</span><span class="n">arg</span> <span class="n">COMPRESS_ARGS</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">app</span><span class="o">-</span><span class="n">name</span> <span class="n">APP_NAME</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">app</span><span class="o">-</span><span class="n">template</span> <span class="n">APP_TEMPLATE</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">app</span><span class="o">-</span><span class="n">file</span> <span class="n">APP_FILE</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">ram</span> <span class="n">MEMORY</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">vcpus</span> <span class="n">VCPUS</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">vnc</span> <span class="n">VNC</span><span class="p">]</span>
@ -293,6 +296,12 @@ you have the anaconda-tui package installed.</p>
<p class="last">Default: False</p>
</td></tr>
<tr><td class="option-group" colspan="2">
<kbd>--make-tar-disk</kbd></td>
</tr>
<tr><td>&#160;</td><td><p class="first">Build a tar of a partitioned disk image</p>
<p class="last">Default: False</p>
</td></tr>
<tr><td class="option-group" colspan="2">
<kbd>--make-pxe-live</kbd></td>
</tr>
<tr><td>&#160;</td><td><p class="first">Build a live pxe boot squashfs image</p>
@ -319,12 +328,12 @@ you have the anaconda-tui package installed.</p>
<td>Anaconda installation .iso path to use for qemu</td></tr>
<tr><td class="option-group">
<kbd>--iso-only</kbd></td>
<td><p class="first">Remove all iso creation artifacts except the boot.iso, combine with iso-name to rename the boot.iso</p>
<td><p class="first">Remove all iso creation artifacts except the boot.iso, combine with --iso-name to rename the boot.iso</p>
<p class="last">Default: False</p>
</td></tr>
<tr><td class="option-group">
<kbd>--iso-name</kbd></td>
<td>Name of output iso file for iso-only. Default is boot.iso</td></tr>
<td>Name of output iso file for --iso-only. Default is boot.iso</td></tr>
<tr><td class="option-group">
<kbd>--ks</kbd></td>
<td>Kickstart file defining the install.</td></tr>
@ -373,20 +382,26 @@ you have the anaconda-tui package installed.</p>
<tr><td class="option-group">
<kbd>--nomacboot</kbd></td>
<td>Default: True</td></tr>
<tr><td class="option-group" colspan="2">
<kbd>--extra-boot-args</kbd></td>
</tr>
<tr><td>&#160;</td><td><p class="first">Extra arguments to add to the bootloader kernel cmdline in the templates</p>
<p class="last">Default: &quot;&quot;</p>
</td></tr>
<tr><td class="option-group">
<kbd>--title</kbd></td>
<td><p class="first">Substituted for &#64;TITLE&#64; in bootloader config files</p>
<p class="last">Default: “Linux Live Media”</p>
<p class="last">Default: &quot;Linux Live Media&quot;</p>
</td></tr>
<tr><td class="option-group">
<kbd>--project</kbd></td>
<td><p class="first">substituted for &#64;PROJECT&#64; in bootloader config files</p>
<p class="last">Default: “Linux”</p>
<p class="last">Default: &quot;Linux&quot;</p>
</td></tr>
<tr><td class="option-group">
<kbd>--releasever</kbd></td>
<td><p class="first">substituted for &#64;VERSION&#64; in bootloader config files</p>
<p class="last">Default: “29”</p>
<p class="last">Default: &quot;29&quot;</p>
</td></tr>
<tr><td class="option-group">
<kbd>--volid</kbd></td>
@ -400,7 +415,7 @@ you have the anaconda-tui package installed.</p>
<td>Cancel installer after X minutes</td></tr>
<tr><td class="option-group">
<kbd>-V</kbd></td>
<td>show programs version number and exit</td></tr>
<td>show program's version number and exit</td></tr>
</tbody>
</table>
</div>
@ -424,14 +439,24 @@ you have the anaconda-tui package installed.</p>
<tr><td class="option-group">
<kbd>--image-name</kbd></td>
<td>Name of output file to create. Used for tar, fs and disk image. Default is a random name.</td></tr>
<tr><td class="option-group" colspan="2">
<kbd>--tar-disk-name</kbd></td>
</tr>
<tr><td>&#160;</td><td>Name of the archive member for make-tar-disk.</td></tr>
<tr><td class="option-group">
<kbd>--fs-label</kbd></td>
<td><p class="first">Label to set on fsimage, default is Anaconda</p>
<p class="last">Default: “Anaconda”</p>
<td><p class="first">Label to set on fsimage, default is 'Anaconda'</p>
<p class="last">Default: &quot;Anaconda&quot;</p>
</td></tr>
<tr><td class="option-group" colspan="2">
<kbd>--image-size-align</kbd></td>
</tr>
<tr><td>&#160;</td><td><p class="first">Create a disk image with a size that is a multiple of this value in MiB.</p>
<p class="last">Default: 0</p>
</td></tr>
<tr><td class="option-group">
<kbd>--image-type</kbd></td>
<td>Create an image with qemu-img. See qemu-img help for supported formats.</td></tr>
<td>Create an image with qemu-img. See qemu-img --help for supported formats.</td></tr>
<tr><td class="option-group">
<kbd>--qemu-arg</kbd></td>
<td><p class="first">Arguments to pass to qemu-img. Pass once for each argument, they will be used for ALL calls to qemu-img.</p>
@ -450,7 +475,7 @@ you have the anaconda-tui package installed.</p>
<tr><td class="option-group">
<kbd>--compression</kbd></td>
<td><p class="first">Compression binary for make-tar. xz, lzma, gzip, and bzip2 are supported. xz is the default.</p>
<p class="last">Default: “xz”</p>
<p class="last">Default: &quot;xz&quot;</p>
</td></tr>
<tr><td class="option-group">
<kbd>--compress-arg</kbd></td>
@ -475,7 +500,7 @@ you have the anaconda-tui package installed.</p>
<tr><td class="option-group">
<kbd>--app-file</kbd></td>
<td><p class="first">Appliance template results file.</p>
<p class="last">Default: “appliance.xml”</p>
<p class="last">Default: &quot;appliance.xml&quot;</p>
</td></tr>
</tbody>
</table>
@ -506,7 +531,7 @@ you have the anaconda-tui package installed.</p>
<tr><td class="option-group">
<kbd>--ovmf-path</kbd></td>
<td><p class="first">Path to OVMF firmware</p>
<p class="last">Default: “/usr/share/edk2/ovmf/”</p>
<p class="last">Default: &quot;/usr/share/edk2/ovmf/&quot;</p>
</td></tr>
<tr><td class="option-group">
<kbd>--virt-uefi</kbd></td>
@ -521,7 +546,7 @@ you have the anaconda-tui package installed.</p>
<tr><td class="option-group">
<kbd>--with-rng</kbd></td>
<td><p class="first">RNG device for QEMU (none for no RNG)</p>
<p class="last">Default: “/dev/random”</p>
<p class="last">Default: &quot;/dev/random&quot;</p>
</td></tr>
</tbody>
</table>
@ -622,14 +647,14 @@ kickstart is used to customize the installed system in the same way that
current spin-kickstarts do.</p>
<p>livemedia-creator monitors the install process for problems by watching the
install logs. They are written to the current directory or to the base
directory specified by the logfile command. You can also monitor the install
directory specified by the --logfile command. You can also monitor the install
by using a vnc client. This is recommended when first modifying a kickstart,
since there are still places where Anaconda may get stuck without the log
monitor catching it.</p>
<p>The output from this process is a partitioned disk image. kpartx can be used
to mount and examine it when there is a problem with the install. It can also
be booted using kvm.</p>
<p>When creating an iso the disk images / partition is copied into a formatted
<p>When creating an iso the disk image's / partition is copied into a formatted
filesystem image which is then used as the input to lorax for creation of the
final media.</p>
<p>The final image is created by lorax, using the templates in /usr/share/lorax/live/
@ -638,7 +663,7 @@ templates are written using the Mako template system with some extra commands
added by lorax.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The output from make-iso includes the artifacts used to create the boot.iso;
<p class="last">The output from --make-iso includes the artifacts used to create the boot.iso;
the kernel, initrd, the squashfs filesystem, etc. If you only want the
boot.iso you can pass <code class="docutils literal notranslate"><span class="pre">--iso-only</span></code> and the other files will be removed. You
can also name the iso by using <code class="docutils literal notranslate"><span class="pre">--iso-name</span> <span class="pre">my-live.iso</span></code>.</p>
@ -655,9 +680,9 @@ changes. Here are the steps I used to convert the Fedora XFCE spin.</p>
<ol class="arabic">
<li><p class="first">Flatten the xfce kickstart using ksflatten</p>
</li>
<li><p class="first">Add zerombr so you dont get the disk init dialog</p>
<li><p class="first">Add zerombr so you don't get the disk init dialog</p>
</li>
<li><p class="first">Add clearpart all</p>
<li><p class="first">Add clearpart --all</p>
</li>
<li><p class="first">Add swap partition</p>
</li>
@ -665,7 +690,7 @@ changes. Here are the steps I used to convert the Fedora XFCE spin.</p>
</li>
<li><p class="first">Add shutdown to the kickstart</p>
</li>
<li><p class="first">Add network bootproto=dhcp activate to activate the network
<li><p class="first">Add network --bootproto=dhcp --activate to activate the network
This works for F16 builds but for F15 and before you need to pass
something on the cmdline that activate the network, like sshd:</p>
<blockquote>
@ -692,12 +717,12 @@ that you create to the %wheel group so that sudo works if you wanted to.</p>
</li>
<li><p class="first">Remove /etc/fstab in %post, dracut handles mounting the rootfs</p>
<p><code class="docutils literal notranslate"><span class="pre">cat</span> <span class="pre">/dev/null</span> <span class="pre">&gt;</span> <span class="pre">/dev/fstab</span></code></p>
<p>Do this only for live isos, the filesystem will be mounted read only if
<p>Do this only for live iso's, the filesystem will be mounted read only if
there is no /etc/fstab</p>
</li>
<li><p class="first">Dont delete initramfs files from /boot in %post</p>
<li><p class="first">Don't delete initramfs files from /boot in %post</p>
</li>
<li><p class="first">When creating live isos you need to have, at least, these packages in the %package section::
<li><p class="first">When creating live iso's you need to have, at least, these packages in the %package section::
dracut-config-generic
dracut-live
-dracut-config-rescue
@ -724,10 +749,10 @@ livemedia-creator like this:</p>
packages will get cached, so your kickstart url would look like:</p>
<blockquote>
<div><code class="docutils literal notranslate"><span class="pre">url</span> <span class="pre">--url=&quot;http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/x86_64/os/&quot;</span></code></div></blockquote>
<p>You can also add an update repo, but dont name it updates. Add proxy to it
<p>You can also add an update repo, but don't name it updates. Add --proxy to it
as well. You can use all of the <a class="reference external" href="https://pykickstart.readthedocs.io/en/latest/kickstart-docs.html#chapter-2-kickstart-commands-in-fedora">kickstart commands</a> in your kickstart. Make sure there
is only one <code class="docutils literal notranslate"><span class="pre">url</span></code> command, other repos have to use the <code class="docutils literal notranslate"><span class="pre">repo</span></code> command and cannot be
named <code class="docutils literal notranslate"><span class="pre">updates</span></code> which is reserved for Anacondas use. eg.:</p>
named <code class="docutils literal notranslate"><span class="pre">updates</span></code> which is reserved for Anaconda's use. eg.:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">url</span> <span class="o">--</span><span class="n">url</span><span class="o">=</span><span class="n">PRIMARY</span><span class="o">-</span><span class="n">REPO</span><span class="o">-</span><span class="n">URL</span> <span class="o">--</span><span class="n">proxy</span><span class="o">=</span><span class="n">PROXY</span><span class="o">-</span><span class="n">URL</span>
<span class="n">repo</span> <span class="o">--</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;repo1&quot;</span> <span class="o">--</span><span class="n">baseurl</span><span class="o">=</span><span class="n">FIRST</span><span class="o">-</span><span class="n">REPO</span><span class="o">-</span><span class="n">URL</span> <span class="o">--</span><span class="n">proxy</span><span class="o">=</span><span class="n">PROXY</span><span class="o">-</span><span class="n">URL</span>
<span class="n">repo</span> <span class="o">--</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;repo2&quot;</span> <span class="o">--</span><span class="n">baseurl</span><span class="o">=</span><span class="n">SECOND</span><span class="o">-</span><span class="n">REPO_URL</span> <span class="o">--</span><span class="n">proxy</span><span class="o">=</span><span class="n">PROXY</span><span class="o">-</span><span class="n">URL</span>
@ -738,26 +763,26 @@ named <code class="docutils literal notranslate"><span class="pre">updates</span
<div class="section" id="anaconda-image-install-no-virt">
<h2>Anaconda image install (no-virt)<a class="headerlink" href="#anaconda-image-install-no-virt" title="Permalink to this headline"></a></h2>
<p>You can create images without using qemu by passing <code class="docutils literal notranslate"><span class="pre">--no-virt</span></code> on the
cmdline. This will use Anacondas directory install feature to handle the
cmdline. This will use Anaconda's directory install feature to handle the
install. There are a couple of things to keep in mind when doing this:</p>
<ol class="arabic simple">
<li>It will be most reliable when building images for the same release that the
host is running. Because Anaconda has expectations about the system it is
running under you may encounter strange bugs if you try to build newer or
older releases.</li>
<li>It may totally trash your host. So far I havent had this happen, but the
<li>It may totally trash your host. So far I haven't had this happen, but the
possibility exists that a bug in Anaconda could result in it operating on
real devices. I recommend running it in a virt or on a system that you can
afford to lose all data from.</li>
</ol>
<p>The logs from anaconda will be placed in an ./anaconda/ directory in either
the current directory or in the directory used for logfile</p>
the current directory or in the directory used for --logfile</p>
<p>Example cmdline:</p>
<p><code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">livemedia-creator</span> <span class="pre">--make-iso</span> <span class="pre">--no-virt</span> <span class="pre">--ks=./fedora-livemedia.ks</span></code></p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Using no-virt to create a partitioned disk image (eg. make-disk or
make-vagrant) will only create disks usable on the host platform (BIOS
<p class="last">Using no-virt to create a partitioned disk image (eg. --make-disk or
--make-vagrant) will only create disks usable on the host platform (BIOS
or UEFI). You can create BIOS partitioned disk images on UEFI by using
virt.</p>
</div>
@ -770,7 +795,7 @@ be reported as a bug.</p>
</div>
<div class="section" id="ami-images">
<h2>AMI Images<a class="headerlink" href="#ami-images" title="Permalink to this headline"></a></h2>
<p>Amazon EC2 images can be created by using the make-ami switch and an appropriate
<p>Amazon EC2 images can be created by using the --make-ami switch and an appropriate
kickstart file. All of the work to customize the image is handled by the kickstart.
The example currently included was modified from the cloud-kickstarts version so
that it would work with livemedia-creator.</p>
@ -781,7 +806,7 @@ that it would work with livemedia-creator.</p>
</div>
<div class="section" id="appliance-creation">
<h2>Appliance Creation<a class="headerlink" href="#appliance-creation" title="Permalink to this headline"></a></h2>
<p>livemedia-creator can now replace appliance-tools by using the make-appliance
<p>livemedia-creator can now replace appliance-tools by using the --make-appliance
switch. This will create the partitioned disk image and an XML file that can be
used with virt-image to setup a virtual system.</p>
<p>The XML is generated using the Mako template from
@ -800,16 +825,16 @@ Each entry has the following attributes:</p>
<div><p><code class="docutils literal notranslate"><span class="pre">name</span></code>
base name of the disk image file</p>
<p><code class="docutils literal notranslate"><span class="pre">format</span></code>
“raw”</p>
&quot;raw&quot;</p>
<p><code class="docutils literal notranslate"><span class="pre">checksum_type</span></code>
“sha256”</p>
&quot;sha256&quot;</p>
<p><code class="docutils literal notranslate"><span class="pre">checksum</span></code>
sha256 checksum of the disk image</p>
</div></blockquote>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">name</span></code>
Name of appliance, from app-name argument</p>
Name of appliance, from --app-name argument</p>
<p><code class="docutils literal notranslate"><span class="pre">arch</span></code>
Architecture</p>
<p><code class="docutils literal notranslate"><span class="pre">memory</span></code>
@ -875,9 +900,9 @@ kickstart in docs/fedora-atomic-pxe-live-novirt.ks. This also works inside the
mock environment.</p>
</div>
<div class="section" id="using-mock-and-no-virt-to-create-images">
<h2>Using Mock and no-virt to Create Images<a class="headerlink" href="#using-mock-and-no-virt-to-create-images" title="Permalink to this headline"></a></h2>
<h2>Using Mock and --no-virt to Create Images<a class="headerlink" href="#using-mock-and-no-virt-to-create-images" title="Permalink to this headline"></a></h2>
<p>As of lorax version 22.2 you can use livemedia-creator and anaconda version
22.15 inside of a mock chroot with make-iso and make-fsimage.</p>
22.15 inside of a mock chroot with --make-iso and --make-fsimage.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">As of mock 1.3.4 you need to use <code class="docutils literal notranslate"><span class="pre">--old-chroot</span></code> with mock. Mock now defaults to using systemd-nspawn
@ -995,26 +1020,26 @@ add <code class="docutils literal notranslate"><span class="pre">mknod</span> <s
<div class="section" id="openstack-image-creation">
<h2>OpenStack Image Creation<a class="headerlink" href="#openstack-image-creation" title="Permalink to this headline"></a></h2>
<p>OpenStack supports partitioned disk images so <code class="docutils literal notranslate"><span class="pre">--make-disk</span></code> can be used to
create images for importing into glance, OpenStacks image storage component.
create images for importing into glance, OpenStack's image storage component.
You need to have access to an OpenStack provider that allows image uploads, or
setup your own using the instructions from the <a class="reference external" href="https://www.rdoproject.org/Quickstart">RDO Project</a>.</p>
<p>The example kickstart, fedora-openstack.ks, is only slightly different than the
fedora-minimal.ks one. It adds the cloud-init and cloud-utils-growpart
packages. OpenStack supports setting up the image using cloud-init, and
cloud-utils-growpart will grow the image to fit the instances disk size.</p>
cloud-utils-growpart will grow the image to fit the instance's disk size.</p>
<p>Create a qcow2 image using the kickstart like this:</p>
<blockquote>
<div><code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">livemedia-creator</span> <span class="pre">--make-disk</span> <span class="pre">--iso=/path/to/boot.iso</span> <span class="pre">--ks=/path/to/fedora-openstack.ks</span> <span class="pre">--image-type=qcow2</span></code></div></blockquote>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">On the RHEL7 version of lmc <code class="docutils literal notranslate"><span class="pre">--image-type</span></code> isnt supported. You can only create a bare partitioned disk image.</p>
<p class="last">On the RHEL7 version of lmc <code class="docutils literal notranslate"><span class="pre">--image-type</span></code> isn't supported. You can only create a bare partitioned disk image.</p>
</div>
<p>Import the resulting disk image into the OpenStack system, either via the web UI, or glance on the cmdline:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">glance</span> <span class="n">image</span><span class="o">-</span><span class="n">create</span> <span class="o">--</span><span class="n">name</span> <span class="s2">&quot;fedora-openstack&quot;</span> <span class="o">--</span><span class="ow">is</span><span class="o">-</span><span class="n">public</span> <span class="n">true</span> <span class="o">--</span><span class="n">disk</span><span class="o">-</span><span class="nb">format</span> <span class="n">qcow2</span> \
<span class="o">--</span><span class="n">container</span><span class="o">-</span><span class="nb">format</span> <span class="n">bare</span> <span class="o">--</span><span class="n">file</span> <span class="o">./</span><span class="n">fedora</span><span class="o">-</span><span class="n">openstack</span><span class="o">.</span><span class="n">qcow2</span>
</pre></div>
</div>
<p>If qcow2 wasnt used then <code class="docutils literal notranslate"><span class="pre">--disk-format</span></code> should be set to raw.</p>
<p>If qcow2 wasn't used then <code class="docutils literal notranslate"><span class="pre">--disk-format</span></code> should be set to raw.</p>
</div>
<div class="section" id="docker-image-creation">
<h2>Docker Image Creation<a class="headerlink" href="#docker-image-creation" title="Permalink to this headline"></a></h2>
@ -1039,7 +1064,7 @@ OCI images using the following command:</p>
<p>You must provide the config.json and runtime.json files to be included in the bundle,
their specifications can be found <a class="reference external" href="https://github.com/opencontainers/specs">on the OCI github project</a>
output will be in the results directory with a default name of bundle.tar.xz</p>
<p>This will work with <code class="docutils literal notranslate"><span class="pre">--no-virt</span></code> and inside a mock since it doesnt use any
<p>This will work with <code class="docutils literal notranslate"><span class="pre">--no-virt</span></code> and inside a mock since it doesn't use any
partitioned disk images.</p>
</div>
<div class="section" id="vagrant-image-creation">
@ -1065,16 +1090,9 @@ use of partitioned disk images and qcow2.</p>
<h2>Creating UEFI disk images with virt<a class="headerlink" href="#creating-uefi-disk-images-with-virt" title="Permalink to this headline"></a></h2>
<p>Partitioned disk images can only be created for the same platform as the host system (BIOS or
UEFI). You can use virt to create BIOS images on UEFI systems, and it is also possible
to create UEFI images on BIOS systems using OVMF. You first need to setup your system with
the OVMF firmware. The details can be <a class="reference external" href="http://www.linux-kvm.org/page/OVMF">found here linux-kvm OVMF page</a>
but it amounts to:</p>
<ol class="arabic simple">
<li>Download the firmware.repo from <a class="reference external" href="https://www.kraxel.org/repos/">Gerd Hoffmann</a> and install it
in /etc/yum.repos.d/</li>
<li>Install the edk2.git-ovmf-x64 package</li>
<li>Copy /usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd to /usr/share/OVMF/OVMF_CODE.fd</li>
<li>Copy /usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd to /usr/share/OVMF/OVMF_VARS.fd</li>
</ol>
to create UEFI images on BIOS systems using OVMF firmware and qemu.</p>
<p>Install the lorax-lmc-virt package, this will install qemu and the OVMF
firmware files.</p>
<p>Now you can run livemedia-creator with <code class="docutils literal notranslate"><span class="pre">--virt-uefi</span></code> to boot and install using UEFI:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">livemedia</span><span class="o">-</span><span class="n">creator</span> <span class="o">--</span><span class="n">make</span><span class="o">-</span><span class="n">disk</span> <span class="o">--</span><span class="n">virt</span><span class="o">-</span><span class="n">uefi</span> <span class="o">--</span><span class="n">iso</span><span class="o">=/</span><span class="n">path</span><span class="o">/</span><span class="n">to</span><span class="o">/</span><span class="n">boot</span><span class="o">.</span><span class="n">iso</span> \
<span class="o">--</span><span class="n">ks</span><span class="o">=/</span><span class="n">path</span><span class="o">/</span><span class="n">to</span><span class="o">/</span><span class="n">fedora</span><span class="o">-</span><span class="n">minimal</span><span class="o">.</span><span class="n">ks</span>
@ -1084,12 +1102,10 @@ in /etc/yum.repos.d/</li>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">part</span> <span class="o">/</span><span class="n">boot</span><span class="o">/</span><span class="n">efi</span> <span class="o">--</span><span class="n">fstype</span><span class="o">=</span><span class="s2">&quot;efi&quot;</span> <span class="o">--</span><span class="n">size</span><span class="o">=</span><span class="mi">500</span>
</pre></div>
</div>
<p>Or use <code class="docutils literal notranslate"><span class="pre">reqpart</span></code> in the kickstart and Anaconda will create the required partitions.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">When using the resulting image with the current version of OVMF (edk2.git-ovmf-x64-0-20151103.b1295.ge5cffca)
it will not boot automatically because there is a problem with the fallback path.
You can boot it by entering the UEFI shell and running EFI/fedora/shim.efi and
then using efibootmgr to setup the correct boot entry.</p>
<p class="last">The --virt-uefi method is currently only supported on the x86_64 architecture.</p>
</div>
</div>
<div class="section" id="debugging-problems">
@ -1113,7 +1129,7 @@ to the terminal and examine it by logging into the VM. eg.:</p>
</div>
<p>If it does get stuck the best way to cancel is to use kill -9 on the qemu pid,
lmc will detect that the process died and cleanup.</p>
<p>If lmc didnt handle the cleanup for some reason you can do this:
<p>If lmc didn't handle the cleanup for some reason you can do this:
1. <code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">umount</span> <span class="pre">/tmp/lmc-XXXX</span></code> to unmount the iso from its mountpoint.
2. <code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">rm</span> <span class="pre">-rf</span> <span class="pre">/tmp/lmc-XXXX</span></code>
3. <code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">rm</span> <span class="pre">/var/tmp/lmc-disk-XXXXX</span></code> to remove the disk image.</p>
@ -1183,7 +1199,7 @@ report bugs against the lorax component.</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>lorax-composer &mdash; Lorax 29.21 documentation</title>
<title>lorax-composer &mdash; Lorax 29.28 documentation</title>
@ -58,7 +58,7 @@
<div class="version">
29.21
29.28
</div>
@ -104,11 +104,17 @@
<li class="toctree-l3"><a class="reference internal" href="#packages-and-modules">[[packages]] and [[modules]]</a></li>
<li class="toctree-l3"><a class="reference internal" href="#groups">[[groups]]</a></li>
<li class="toctree-l3"><a class="reference internal" href="#customizations">Customizations</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#customizations-kernel">[customizations.kernel]</a></li>
<li class="toctree-l4"><a class="reference internal" href="#customizations-sshkey">[[customizations.sshkey]]</a></li>
<li class="toctree-l4"><a class="reference internal" href="#customizations-user">[[customizations.user]]</a></li>
<li class="toctree-l4"><a class="reference internal" href="#customizations-group">[[customizations.group]]</a></li>
<li class="toctree-l4"><a class="reference internal" href="#customizations-timezone">[customizations.timezone]</a></li>
<li class="toctree-l4"><a class="reference internal" href="#customizations-locale">[customizations.locale]</a></li>
<li class="toctree-l4"><a class="reference internal" href="#customizations-firewall">[customizations.firewall]</a></li>
<li class="toctree-l4"><a class="reference internal" href="#customizations-services">[customizations.services]</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#repos-git">[[repos.git]]</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#adding-output-types">Adding Output Types</a><ul>
@ -200,7 +206,7 @@
</table>
<p><code class="docutils literal notranslate"><span class="pre">lorax-composer</span></code> is an API server that allows you to build disk images using
<a class="reference internal" href="#blueprints">Blueprints</a> to describe the package versions to be installed into the image.
It is compatible with the Weldr projects bdcs-api REST protocol. More
It is compatible with the Weldr project's bdcs-api REST protocol. More
information on Weldr can be found <a class="reference external" href="http://www.weldr.io">on the Weldr blog</a>.</p>
<p>Behind the scenes it uses <a class="reference external" href="livemedia-creator.html">livemedia-creator</a> and
<a class="reference external" href="https://anaconda-installer.readthedocs.io/en/latest/">Anaconda</a> to handle the
@ -247,7 +253,7 @@ A new directory with correct permissions will be created the first time the serv
socket activation at the same time. It is therefore recommended that you run it directly
on the command line only for testing or development purposes. For real use or development
of other projects that simply use the API, you should stick to socket activation only.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">/path/to/blueprints/</span></code> directory is where the blueprints git repo will
<p>The <code class="docutils literal notranslate"><span class="pre">/path/to/blueprints/</span></code> directory is where the blueprints' git repo will
be created, and all the blueprints created with the <code class="docutils literal notranslate"><span class="pre">/api/v0/blueprints/new</span></code>
route will be stored. If there are blueprint <code class="docutils literal notranslate"><span class="pre">.toml</span></code> files in the top level
of the directory they will be imported into the blueprint git storage when
@ -302,40 +308,40 @@ images using <code class="docutils literal notranslate"><span class="pre">lorax-
<tr><td class="option-group">
<kbd>--socket</kbd></td>
<td><p class="first">Path to the socket file to listen on</p>
<p class="last">Default: “/run/weldr/api.socket”</p>
<p class="last">Default: &quot;/run/weldr/api.socket&quot;</p>
</td></tr>
<tr><td class="option-group">
<kbd>--user</kbd></td>
<td><p class="first">User to use for reduced permissions</p>
<p class="last">Default: “weldr”</p>
<p class="last">Default: &quot;root&quot;</p>
</td></tr>
<tr><td class="option-group">
<kbd>--group</kbd></td>
<td><p class="first">Group to set ownership of the socket to</p>
<p class="last">Default: “weldr”</p>
<p class="last">Default: &quot;weldr&quot;</p>
</td></tr>
<tr><td class="option-group">
<kbd>--log</kbd></td>
<td><p class="first">Path to logfile (/var/log/lorax-composer/composer.log)</p>
<p class="last">Default: “/var/log/lorax-composer/composer.log”</p>
<p class="last">Default: &quot;/var/log/lorax-composer/composer.log&quot;</p>
</td></tr>
<tr><td class="option-group">
<kbd>--mockfiles</kbd></td>
<td><p class="first">Path to JSON files used for /api/mock/ paths (/var/tmp/bdcs-mockfiles/)</p>
<p class="last">Default: “/var/tmp/bdcs-mockfiles/”</p>
<p class="last">Default: &quot;/var/tmp/bdcs-mockfiles/&quot;</p>
</td></tr>
<tr><td class="option-group">
<kbd>--sharedir</kbd></td>
<td>Directory containing all the templates. Overrides config file sharedir</td></tr>
<tr><td class="option-group">
<kbd>-V</kbd></td>
<td><p class="first">show programs version number and exit</p>
<td><p class="first">show program's version number and exit</p>
<p class="last">Default: False</p>
</td></tr>
<tr><td class="option-group">
<kbd>-c, --config</kbd></td>
<td><p class="first">Path to lorax-composer configuration file.</p>
<p class="last">Default: “/etc/lorax/composer.conf”</p>
<p class="last">Default: &quot;/etc/lorax/composer.conf&quot;</p>
</td></tr>
<tr><td class="option-group">
<kbd>--releasever</kbd></td>
@ -343,7 +349,7 @@ images using <code class="docutils literal notranslate"><span class="pre">lorax-
<tr><td class="option-group">
<kbd>--tmp</kbd></td>
<td><p class="first">Top level temporary directory</p>
<p class="last">Default: “/var/tmp”</p>
<p class="last">Default: &quot;/var/tmp&quot;</p>
</td></tr>
<tr><td class="option-group">
<kbd>--proxy</kbd></td>
@ -366,7 +372,7 @@ are owned by <code class="docutils literal notranslate"><span class="pre">root:w
to control <code class="docutils literal notranslate"><span class="pre">lorax-composer</span></code>.</p>
<p>At startup the server will check for the correct permissions and
ownership of a pre-existing directory, or it will create a new one if it
doesnt exist. The socket path and group owners name can be changed from the
doesn't exist. The socket path and group owner's name can be changed from the
cmdline by passing it the <code class="docutils literal notranslate"><span class="pre">--socket</span></code> and <code class="docutils literal notranslate"><span class="pre">--group</span></code> arguments.</p>
<p>It will then drop root privileges for the API thread and run as the <code class="docutils literal notranslate"><span class="pre">weldr</span></code>
user. The queue and compose thread still runs as root because it needs to be
@ -400,7 +406,7 @@ when it is written to disk. It should be short and descriptive.</p>
<p><code class="docutils literal notranslate"><span class="pre">version</span></code> is a <a class="reference external" href="https://semver.org/">semver compatible</a> version number. If
a new blueprint is uploaded with the same <code class="docutils literal notranslate"><span class="pre">version</span></code> the server will
automatically bump the PATCH level of the <code class="docutils literal notranslate"><span class="pre">version</span></code>. If the <code class="docutils literal notranslate"><span class="pre">version</span></code>
doesnt match it will be used as is. eg. Uploading a blueprint with <code class="docutils literal notranslate"><span class="pre">version</span></code>
doesn't match it will be used as is. eg. Uploading a blueprint with <code class="docutils literal notranslate"><span class="pre">version</span></code>
set to <code class="docutils literal notranslate"><span class="pre">0.1.0</span></code> when the existing blueprint <code class="docutils literal notranslate"><span class="pre">version</span></code> is <code class="docutils literal notranslate"><span class="pre">0.0.1</span></code> will
result in the new blueprint being stored as <code class="docutils literal notranslate"><span class="pre">version</span> <span class="pre">0.1.0</span></code>.</p>
<div class="section" id="packages-and-modules">
@ -425,20 +431,35 @@ for selecting optional packages.</p>
</div>
<div class="section" id="customizations">
<h3>Customizations<a class="headerlink" href="#customizations" title="Permalink to this headline"></a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">[[customizations]]</span></code> section can be used to configure the hostname of the final image. eg.:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[[</span><span class="n">customizations</span><span class="p">]]</span>
<p>The <code class="docutils literal notranslate"><span class="pre">[customizations]</span></code> section can be used to configure the hostname of the final image. eg.:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">customizations</span><span class="p">]</span>
<span class="n">hostname</span> <span class="o">=</span> <span class="s2">&quot;baseimage&quot;</span>
</pre></div>
</div>
<p>This is optional and may be left out to use the defaults.</p>
<div class="section" id="customizations-kernel">
<h4>[customizations.kernel]<a class="headerlink" href="#customizations-kernel" title="Permalink to this headline"></a></h4>
<p>This allows you to append arguments to the bootloader's kernel commandline. This will not have any
effect on <code class="docutils literal notranslate"><span class="pre">tar</span></code> or <code class="docutils literal notranslate"><span class="pre">ext4-filesystem</span></code> images since they do not include a bootloader.</p>
<p>For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">customizations</span><span class="o">.</span><span class="n">kernel</span><span class="p">]</span>
<span class="n">append</span> <span class="o">=</span> <span class="s2">&quot;nosmt=force&quot;</span>
</pre></div>
</div>
</div>
<div class="section" id="customizations-sshkey">
<h4>[[customizations.sshkey]]<a class="headerlink" href="#customizations-sshkey" title="Permalink to this headline"></a></h4>
<p>Set an existing users ssh key in the final image:</p>
<p>Set an existing user's ssh key in the final image:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[[</span><span class="n">customizations</span><span class="o">.</span><span class="n">sshkey</span><span class="p">]]</span>
<span class="n">user</span> <span class="o">=</span> <span class="s2">&quot;root&quot;</span>
<span class="n">key</span> <span class="o">=</span> <span class="s2">&quot;PUBLIC SSH KEY&quot;</span>
</pre></div>
</div>
<p>The key will be added to the users authorized_keys file.</p>
<p>The key will be added to the user's authorized_keys file.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last"><code class="docutils literal notranslate"><span class="pre">key</span></code> expects the entire content of <code class="docutils literal notranslate"><span class="pre">~/.ssh/id_rsa.pub</span></code></p>
</div>
</div>
<div class="section" id="customizations-user">
<h4>[[customizations.user]]<a class="headerlink" href="#customizations-user" title="Permalink to this headline"></a></h4>
@ -458,6 +479,10 @@ All fields for this section are optional except for the <code class="docutils li
</div>
<p>If the password starts with <code class="docutils literal notranslate"><span class="pre">$6$</span></code>, <code class="docutils literal notranslate"><span class="pre">$5$</span></code>, or <code class="docutils literal notranslate"><span class="pre">$2b$</span></code> it will be stored as
an encrypted password. Otherwise it will be treated as a plain text password.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last"><code class="docutils literal notranslate"><span class="pre">key</span></code> expects the entire content of <code class="docutils literal notranslate"><span class="pre">~/.ssh/id_rsa.pub</span></code></p>
</div>
</div>
<div class="section" id="customizations-group">
<h4>[[customizations.group]]<a class="headerlink" href="#customizations-group" title="Permalink to this headline"></a></h4>
@ -468,6 +493,113 @@ an encrypted password. Otherwise it will be treated as a plain text password.</p
</pre></div>
</div>
</div>
<div class="section" id="customizations-timezone">
<h4>[customizations.timezone]<a class="headerlink" href="#customizations-timezone" title="Permalink to this headline"></a></h4>
<p>Customizing the timezone and the NTP servers to use for the system:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">customizations</span><span class="o">.</span><span class="n">timezone</span><span class="p">]</span>
<span class="n">timezone</span> <span class="o">=</span> <span class="s2">&quot;US/Eastern&quot;</span>
<span class="n">ntpservers</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;0.north-america.pool.ntp.org&quot;</span><span class="p">,</span> <span class="s2">&quot;1.north-america.pool.ntp.org&quot;</span><span class="p">]</span>
</pre></div>
</div>
<p>The values supported by <code class="docutils literal notranslate"><span class="pre">timezone</span></code> can be listed by running <code class="docutils literal notranslate"><span class="pre">timedatectl</span> <span class="pre">list-timezones</span></code>.</p>
<p>If no timezone is setup the system will default to using <cite>UTC</cite>. The ntp servers are also
optional and will default to using the distribution defaults which are fine for most uses.</p>
<p>In some image types there are already NTP servers setup, eg. Google cloud image, and they
cannot be overridden because they are required to boot in the selected environment. But the
timezone will be updated to the one selected in the blueprint.</p>
</div>
<div class="section" id="customizations-locale">
<h4>[customizations.locale]<a class="headerlink" href="#customizations-locale" title="Permalink to this headline"></a></h4>
<p>Customize the locale settings for the system:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">customizations</span><span class="o">.</span><span class="n">locale</span><span class="p">]</span>
<span class="n">languages</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;en_US.UTF-8&quot;</span><span class="p">]</span>
<span class="n">keyboard</span> <span class="o">=</span> <span class="s2">&quot;us&quot;</span>
</pre></div>
</div>
<p>The values supported by <code class="docutils literal notranslate"><span class="pre">languages</span></code> can be listed by running <code class="docutils literal notranslate"><span class="pre">localectl</span> <span class="pre">list-locales</span></code> from
the command line.</p>
<p>The values supported by <code class="docutils literal notranslate"><span class="pre">keyboard</span></code> can be listed by running <code class="docutils literal notranslate"><span class="pre">localectl</span> <span class="pre">list-keymaps</span></code> from
the command line.</p>
<p>Multiple languages can be added. The first one becomes the
primary, and the others are added as secondary. One or the other of <code class="docutils literal notranslate"><span class="pre">languages</span></code>
or <code class="docutils literal notranslate"><span class="pre">keyboard</span></code> must be included (or both) in the section.</p>
</div>
<div class="section" id="customizations-firewall">
<h4>[customizations.firewall]<a class="headerlink" href="#customizations-firewall" title="Permalink to this headline"></a></h4>
<p>By default the firewall blocks all access except for services that enable their ports explicitly,
like <code class="docutils literal notranslate"><span class="pre">sshd</span></code>. This command can be used to open other ports or services. Ports are configured using
the port:protocol format:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">customizations</span><span class="o">.</span><span class="n">firewall</span><span class="p">]</span>
<span class="n">ports</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;22:tcp&quot;</span><span class="p">,</span> <span class="s2">&quot;80:tcp&quot;</span><span class="p">,</span> <span class="s2">&quot;imap:tcp&quot;</span><span class="p">,</span> <span class="s2">&quot;53:tcp&quot;</span><span class="p">,</span> <span class="s2">&quot;53:udp&quot;</span><span class="p">]</span>
</pre></div>
</div>
<p>Numeric ports, or their names from <code class="docutils literal notranslate"><span class="pre">/etc/services</span></code> can be used in the <code class="docutils literal notranslate"><span class="pre">ports</span></code> enabled/disabled lists.</p>
<p>The blueprint settings extend any existing settings in the image templates, so if <code class="docutils literal notranslate"><span class="pre">sshd</span></code> is
already enabled it will extend the list of ports with the ones listed by the blueprint.</p>
<p>If the distribution uses <code class="docutils literal notranslate"><span class="pre">firewalld</span></code> you can specify services listed by <code class="docutils literal notranslate"><span class="pre">firewall-cmd</span> <span class="pre">--get-services</span></code>
in a <code class="docutils literal notranslate"><span class="pre">customizations.firewall.services</span></code> section:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">customizations</span><span class="o">.</span><span class="n">firewall</span><span class="o">.</span><span class="n">services</span><span class="p">]</span>
<span class="n">enabled</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;ftp&quot;</span><span class="p">,</span> <span class="s2">&quot;ntp&quot;</span><span class="p">,</span> <span class="s2">&quot;dhcp&quot;</span><span class="p">]</span>
<span class="n">disabled</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;telnet&quot;</span><span class="p">]</span>
</pre></div>
</div>
<p>Remember that the <code class="docutils literal notranslate"><span class="pre">firewall.services</span></code> are different from the names in <code class="docutils literal notranslate"><span class="pre">/etc/services</span></code>.</p>
<p>Both are optional, if they are not used leave them out or set them to an empty list <code class="docutils literal notranslate"><span class="pre">[]</span></code>. If you
only want the default firewall setup this section can be omitted from the blueprint.</p>
<p>NOTE: The <code class="docutils literal notranslate"><span class="pre">Google</span></code> and <code class="docutils literal notranslate"><span class="pre">OpenStack</span></code> templates explicitly disable the firewall for their environment.
This cannot be overridden by the blueprint.</p>
</div>
<div class="section" id="customizations-services">
<h4>[customizations.services]<a class="headerlink" href="#customizations-services" title="Permalink to this headline"></a></h4>
<p>This section can be used to control which services are enabled at boot time.
Some image types already have services enabled or disabled in order for the
image to work correctly, and cannot be overridden. eg. <code class="docutils literal notranslate"><span class="pre">ami</span></code> requires
<code class="docutils literal notranslate"><span class="pre">sshd</span></code>, <code class="docutils literal notranslate"><span class="pre">chronyd</span></code>, and <code class="docutils literal notranslate"><span class="pre">cloud-init</span></code>. Without them the image will not
boot. Blueprint services are added to, not replacing, the list already in the
templates, if any.</p>
<p>The service names are systemd service units. You may specify any systemd unit
file accepted by <code class="docutils literal notranslate"><span class="pre">systemctl</span> <span class="pre">enable</span></code> eg. <code class="docutils literal notranslate"><span class="pre">cockpit.socket</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">customizations</span><span class="o">.</span><span class="n">services</span><span class="p">]</span>
<span class="n">enabled</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;sshd&quot;</span><span class="p">,</span> <span class="s2">&quot;cockpit.socket&quot;</span><span class="p">,</span> <span class="s2">&quot;httpd&quot;</span><span class="p">]</span>
<span class="n">disabled</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;postfix&quot;</span><span class="p">,</span> <span class="s2">&quot;telnetd&quot;</span><span class="p">]</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="repos-git">
<h3>[[repos.git]]<a class="headerlink" href="#repos-git" title="Permalink to this headline"></a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">[[repos.git]]</span></code> entries are used to add files from a <cite>git repository&lt;https://git-scm.com/&gt;</cite>
repository to the created image. The repository is cloned, the specified <code class="docutils literal notranslate"><span class="pre">ref</span></code> is checked out
and an rpm is created to install the files to a <code class="docutils literal notranslate"><span class="pre">destination</span></code> path. The rpm includes a summary
with the details of the repository and reference used to create it. The rpm is also included in the
image build metadata.</p>
<p>To create an rpm named <code class="docutils literal notranslate"><span class="pre">server-config-1.0-1.noarch.rpm</span></code> you would add this to your blueprint:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[[</span><span class="n">repos</span><span class="o">.</span><span class="n">git</span><span class="p">]]</span>
<span class="n">rpmname</span><span class="o">=</span><span class="s2">&quot;server-config&quot;</span>
<span class="n">rpmversion</span><span class="o">=</span><span class="s2">&quot;1.0&quot;</span>
<span class="n">rpmrelease</span><span class="o">=</span><span class="s2">&quot;1&quot;</span>
<span class="n">summary</span><span class="o">=</span><span class="s2">&quot;Setup files for server deployment&quot;</span>
<span class="n">repo</span><span class="o">=</span><span class="s2">&quot;PATH OF GIT REPO TO CLONE&quot;</span>
<span class="n">ref</span><span class="o">=</span><span class="s2">&quot;v1.0&quot;</span>
<span class="n">destination</span><span class="o">=</span><span class="s2">&quot;/opt/server/&quot;</span>
</pre></div>
</div>
<ul class="simple">
<li>rpmname: Name of the rpm to create, also used as the prefix name in the tar archive</li>
<li>rpmversion: Version of the rpm, eg. &quot;1.0.0&quot;</li>
<li>rpmrelease: Release of the rpm, eg. &quot;1&quot;</li>
<li>summary: Summary string for the rpm</li>
<li>repo: URL of the get repo to clone and create the archive from</li>
<li>ref: Git reference to check out. eg. origin/branch-name, git tag, or git commit hash</li>
<li>destination: Path to install the / of the git repo at when installing the rpm</li>
</ul>
<p>An rpm will be created with the contents of the git repository referenced, with the files
being installed under <code class="docutils literal notranslate"><span class="pre">/opt/server/</span></code> in this case.</p>
<p><code class="docutils literal notranslate"><span class="pre">ref</span></code> can be any valid git reference for use with <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">archive</span></code>. eg. to use the head
of a branch set it to <code class="docutils literal notranslate"><span class="pre">origin/branch-name</span></code>, a tag name, or a commit hash.</p>
<p>Note that the repository is cloned in full each time a build is started, so pointing to a
repository with a large amount of history may take a while to clone and use a significant
amount of disk space. The clone is temporary and is removed once the rpm is created.</p>
</div>
</div>
<div class="section" id="adding-output-types">
@ -516,7 +648,7 @@ the contents of the iso as well as the boot.iso itself.</p>
</div>
<div class="section" id="package-sources">
<h2>Package Sources<a class="headerlink" href="#package-sources" title="Permalink to this headline"></a></h2>
<p>By default lorax-composer uses the hosts configured repositories. It copies
<p>By default lorax-composer uses the host's configured repositories. It copies
the <code class="docutils literal notranslate"><span class="pre">*.repo</span></code> files from <code class="docutils literal notranslate"><span class="pre">/etc/yum.repos.d/</span></code> into
<code class="docutils literal notranslate"><span class="pre">/var/lib/lorax/composer/repos.d/</span></code> at startup, these are immutable system
repositories and cannot be deleted or changed. If you want to add additional
@ -639,7 +771,7 @@ sources from <code class="docutils literal notranslate"><span class="pre">/etc/y
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lorax &mdash; Lorax 29.21 documentation</title>
<title>Lorax &mdash; Lorax 29.28 documentation</title>
@ -58,7 +58,7 @@
<div class="version">
29.21
29.28
</div>
@ -186,7 +186,7 @@
</tr>
</tbody>
</table>
<p>“I am the Lorax. I speak for the trees [and images].”</p>
<p>&quot;I am the Lorax. I speak for the trees [and images].&quot;</p>
<p>The <a class="reference external" href="https://github.com/rhinstaller/lorax">lorax</a> tool is used to create the
<a class="reference external" href="https://github.com/rhinstaller/anaconda">Anaconda</a> installer boot.iso as
well as the basic release tree, and .treeinfo metadata file. Its dependencies
@ -210,7 +210,7 @@ repositories.</p>
<span class="p">[</span><span class="o">--</span><span class="n">add</span><span class="o">-</span><span class="n">arch</span><span class="o">-</span><span class="n">template</span><span class="o">-</span><span class="n">var</span> <span class="n">ADD_ARCH_TEMPLATE_VARS</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">noverify</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">sharedir</span> <span class="n">SHAREDIR</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">enablerepo</span> <span class="p">[</span><span class="n">repo</span><span class="p">]]</span>
<span class="p">[</span><span class="o">--</span><span class="n">disablerepo</span> <span class="p">[</span><span class="n">repo</span><span class="p">]]</span> <span class="p">[</span><span class="o">--</span><span class="n">rootfs</span><span class="o">-</span><span class="n">size</span> <span class="n">ROOTFS_SIZE</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">noverifyssl</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">dnfplugin</span> <span class="n">DNFPLUGINS</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">noverifyssl</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">dnfplugin</span> <span class="n">DNFPLUGINS</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">squashfs</span><span class="o">-</span><span class="n">only</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">dracut</span><span class="o">-</span><span class="n">arg</span> <span class="n">DRACUT_ARGS</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">V</span><span class="p">]</span>
<span class="n">OUTPUTDIR</span>
</pre></div>
@ -235,7 +235,7 @@ repositories.</p>
<tbody valign="top">
<tr><td class="option-group">
<kbd>-V</kbd></td>
<td>show programs version number and exit</td></tr>
<td>show program's version number and exit</td></tr>
</tbody>
</table>
</div>
@ -282,12 +282,12 @@ repositories.</p>
<tr><td class="option-group">
<kbd>-t, --variant</kbd></td>
<td><p class="first">variant name</p>
<p class="last">Default: “”</p>
<p class="last">Default: &quot;&quot;</p>
</td></tr>
<tr><td class="option-group">
<kbd>-b, --bugurl</kbd></td>
<td><p class="first">bug reporting URL for the product</p>
<p class="last">Default: “your distribution provided bug reporting tool”</p>
<p class="last">Default: &quot;your distribution provided bug reporting tool&quot;</p>
</td></tr>
<tr><td class="option-group">
<kbd>--isfinal</kbd></td>
@ -295,7 +295,7 @@ repositories.</p>
<tr><td class="option-group">
<kbd>-c, --config</kbd></td>
<td><p class="first">config file</p>
<p class="last">Default: “/etc/lorax/lorax.conf”</p>
<p class="last">Default: &quot;/etc/lorax/lorax.conf&quot;</p>
</td></tr>
<tr><td class="option-group">
<kbd>--proxy</kbd></td>
@ -335,14 +335,14 @@ repositories.</p>
<tr><td class="option-group">
<kbd>--tmp</kbd></td>
<td><p class="first">Top level temporary directory</p>
<p class="last">Default: “/var/tmp”</p>
<p class="last">Default: &quot;/var/tmp/lorax&quot;</p>
</td></tr>
<tr><td class="option-group">
<kbd>--cachedir</kbd></td>
<td>DNF cache directory. Default is a temporary dir.</td></tr>
<tr><td class="option-group">
<kbd>--workdir</kbd></td>
<td>Work directory, overrides tmp. Default is a temporary dir under /var/tmp</td></tr>
<td>Work directory, overrides --tmp. Default is a temporary dir under /var/tmp/lorax</td></tr>
<tr><td class="option-group">
<kbd>--force</kbd></td>
<td><p class="first">Run even when the destination directory exists</p>
@ -404,6 +404,12 @@ repositories.</p>
<td><p class="first">Enable a DNF plugin by name/glob, or * to enable all of them.</p>
<p class="last">Default: []</p>
</td></tr>
<tr><td class="option-group" colspan="2">
<kbd>--squashfs-only</kbd></td>
</tr>
<tr><td>&#160;</td><td><p class="first">Use a plain squashfs filesystem for the runtime.</p>
<p class="last">Default: False</p>
</td></tr>
</tbody>
</table>
</div>
@ -475,7 +481,7 @@ unneeded services are disabled, some of which can interfere with the
installation. A number of template commands are used here:</p>
<ul class="simple">
<li><a class="reference internal" href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.append" title="pylorax.ltmpl.LoraxTemplateRunner.append"><code class="xref py py-func docutils literal notranslate"><span class="pre">append</span></code></a> to add text to a file.</li>
<li><a class="reference internal" href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.chmod" title="pylorax.ltmpl.LoraxTemplateRunner.chmod"><code class="xref py py-func docutils literal notranslate"><span class="pre">chmod</span></code></a> changes the files mode.</li>
<li><a class="reference internal" href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.chmod" title="pylorax.ltmpl.LoraxTemplateRunner.chmod"><code class="xref py py-func docutils literal notranslate"><span class="pre">chmod</span></code></a> changes the file's mode.</li>
<li><a class="reference internal" href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.install" title="pylorax.ltmpl.LoraxTemplateRunner.install"><code class="xref py py-func docutils literal notranslate"><span class="pre">install</span></code></a> to install a file into the installroot.</li>
<li><a class="reference internal" href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.mkdir" title="pylorax.ltmpl.LoraxTemplateRunner.mkdir"><code class="xref py py-func docutils literal notranslate"><span class="pre">mkdir</span></code></a> makes a new directory.</li>
<li><a class="reference internal" href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.move" title="pylorax.ltmpl.LoraxTemplateRunner.move"><code class="xref py py-func docutils literal notranslate"><span class="pre">move</span></code></a> to move a file into the installroot</li>
@ -488,14 +494,14 @@ installation. A number of template commands are used here:</p>
</div>
<div class="section" id="runtime-cleanup-tmpl">
<h3>runtime-cleanup.tmpl<a class="headerlink" href="#runtime-cleanup-tmpl" title="Permalink to this headline"></a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">runtime-cleanup.tmpl</span></code> template is used to remove files that arent strictly needed
<p>The <code class="docutils literal notranslate"><span class="pre">runtime-cleanup.tmpl</span></code> template is used to remove files that aren't strictly needed
by the installation environment. In addition to the <code class="docutils literal notranslate"><span class="pre">remove</span></code> template command it uses:</p>
<ul class="simple">
<li><a class="reference internal" href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.removepkg" title="pylorax.ltmpl.LoraxTemplateRunner.removepkg"><code class="xref py py-func docutils literal notranslate"><span class="pre">removepkg</span></code></a>
remove all of a specific packages contents. A package may be pulled in as a dependency, but
remove all of a specific package's contents. A package may be pulled in as a dependency, but
not really used. eg. sound support.</li>
<li><a class="reference internal" href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.removefrom" title="pylorax.ltmpl.LoraxTemplateRunner.removefrom"><code class="xref py py-func docutils literal notranslate"><span class="pre">removefrom</span></code></a>
Removes some files from a package. A file glob can be used, or the allbut option to
Removes some files from a package. A file glob can be used, or the --allbut option to
remove everything except a select few.</li>
<li><a class="reference internal" href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.removekmod" title="pylorax.ltmpl.LoraxTemplateRunner.removekmod"><code class="xref py py-func docutils literal notranslate"><span class="pre">removekmod</span></code></a>
Removes kernel modules</li>
@ -505,7 +511,7 @@ Removes kernel modules</li>
<h3>The squashfs filesystem<a class="headerlink" href="#the-squashfs-filesystem" title="Permalink to this headline"></a></h3>
<p>After <code class="docutils literal notranslate"><span class="pre">runtime-*.tmpl</span></code> templates have finished their work lorax creates an
empty ext4 filesystem, copies the remaining files to it, and makes a squashfs
filesystem of it. This file is the / of the boot.isos installer environment
filesystem of it. This file is the / of the boot.iso's installer environment
and is what is in the LiveOS/squashfs.img file on the iso.</p>
</div>
<div class="section" id="iso-creation">
@ -575,7 +581,7 @@ should) select the specific template directory by passing <code class="docutils
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>src &mdash; Lorax 29.21 documentation</title>
<title>src &mdash; Lorax 29.28 documentation</title>
@ -58,7 +58,7 @@
<div class="version">
29.21
29.28
</div>
@ -191,6 +191,7 @@
<li class="toctree-l2"><a class="reference internal" href="pylorax.html#subpackages">Subpackages</a><ul>
<li class="toctree-l3"><a class="reference internal" href="pylorax.api.html">pylorax.api package</a><ul>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#submodules">Submodules</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.bisect">pylorax.api.bisect module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.checkparams">pylorax.api.checkparams module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.cmdline">pylorax.api.cmdline module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.compose">pylorax.api.compose module</a></li>
@ -198,6 +199,7 @@
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.crossdomain">pylorax.api.crossdomain module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.dnfbase">pylorax.api.dnfbase module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.errors">pylorax.api.errors module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.gitrpm">pylorax.api.gitrpm module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.projects">pylorax.api.projects module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.queue">pylorax.api.queue module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.recipes">pylorax.api.recipes module</a></li>
@ -281,7 +283,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

Binary file not shown.

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Product and Updates Images &mdash; Lorax 29.21 documentation</title>
<title>Product and Updates Images &mdash; Lorax 29.28 documentation</title>
@ -58,7 +58,7 @@
<div class="version">
29.21
29.28
</div>
@ -167,7 +167,7 @@ runtime. The x86, ppc, ppc64le and aarch64 templates all look for
install chroot while creating the final install tree. If there are files in
those directories lorax will create images/product.img and/or
images/updates.img</p>
<p>These archives are just like an anaconda updates image their contents are
<p>These archives are just like an anaconda updates image -- their contents are
copied over the top of the filesystem at boot time so that you can drop in
files to add to or replace anything on the filesystem.</p>
<p>Anaconda has several places that it looks for updates, the one for product.img
@ -223,7 +223,7 @@ command or the installpkgs paramater of <a class="reference internal" href="pylo
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Python Module Index &mdash; Lorax 29.21 documentation</title>
<title>Python Module Index &mdash; Lorax 29.28 documentation</title>
@ -59,7 +59,7 @@
<div class="version">
29.21
29.28
</div>
@ -244,6 +244,11 @@
<td>&#160;&#160;&#160;
<a href="pylorax.api.html#module-pylorax.api"><code class="xref">pylorax.api</code></a></td><td>
<em></em></td></tr>
<tr class="cg-2">
<td></td>
<td>&#160;&#160;&#160;
<a href="pylorax.api.html#module-pylorax.api.bisect"><code class="xref">pylorax.api.bisect</code></a></td><td>
<em></em></td></tr>
<tr class="cg-2">
<td></td>
<td>&#160;&#160;&#160;
@ -279,6 +284,11 @@
<td>&#160;&#160;&#160;
<a href="pylorax.api.html#module-pylorax.api.errors"><code class="xref">pylorax.api.errors</code></a></td><td>
<em></em></td></tr>
<tr class="cg-2">
<td></td>
<td>&#160;&#160;&#160;
<a href="pylorax.api.html#module-pylorax.api.gitrpm"><code class="xref">pylorax.api.gitrpm</code></a></td><td>
<em></em></td></tr>
<tr class="cg-2">
<td></td>
<td>&#160;&#160;&#160;
@ -446,7 +456,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Search &mdash; Lorax 29.21 documentation</title>
<title>Search &mdash; Lorax 29.28 documentation</title>
@ -56,7 +56,7 @@
<div class="version">
29.21
29.28
</div>
@ -199,7 +199,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'29.21',
VERSION:'29.28',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "COMPOSER-CLI" "1" "Nov 29, 2018" "29.21" "Lorax"
.TH "COMPOSER-CLI" "1" "May 07, 2019" "29.28" "Lorax"
.SH NAME
composer-cli \- Composer Cmdline Utility Documentation
.
@ -222,8 +222,8 @@ keep track of the build. You can also cancel the build if needed.
.sp
<<<<<<< HEAD
The available types of images is displayed by \fBcomposer\-cli compose types\fP\&.
Currently this consists of: ami, ext4\-filesystem, live\-iso, partitioned\-disk,
qcow2, tar, vhd, vmdk
Currently this consists of: alibaba, ami, ext4\-filesystem, google, hyper\-v,
live\-iso, openstack, partitioned\-disk, qcow2, tar, vhd, vmdk
.SH MONITOR THE BUILD STATUS
.sp
Monitor it using \fBcomposer\-cli compose status\fP, which will show the status of

View File

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "LIVEMEDIA-CREATOR" "1" "Nov 29, 2018" "29.21" "Lorax"
.TH "LIVEMEDIA-CREATOR" "1" "May 07, 2019" "29.28" "Lorax"
.SH NAME
livemedia-creator \- Live Media Creator Documentation
.
@ -78,7 +78,7 @@ Create Live Install Media
.nf
.ft C
usage: livemedia\-creator [\-h]
(\-\-make\-iso | \-\-make\-disk | \-\-make\-fsimage | \-\-make\-appliance | \-\-make\-ami | \-\-make\-tar | \-\-make\-pxe\-live | \-\-make\-ostree\-live | \-\-make\-oci | \-\-make\-vagrant)
(\-\-make\-iso | \-\-make\-disk | \-\-make\-fsimage | \-\-make\-appliance | \-\-make\-ami | \-\-make\-tar | \-\-make\-tar\-disk | \-\-make\-pxe\-live | \-\-make\-ostree\-live | \-\-make\-oci | \-\-make\-vagrant)
[\-\-iso ISO] [\-\-iso\-only] [\-\-iso\-name ISO_NAME]
[\-\-ks KS] [\-\-image\-only] [\-\-no\-virt] [\-\-proxy PROXY]
[\-\-anaconda\-arg ANACONDA_ARGS]
@ -86,11 +86,14 @@ usage: livemedia\-creator [\-h]
[\-\-logfile LOGFILE]
[\-\-lorax\-templates LORAX_TEMPLATES] [\-\-tmp TMP]
[\-\-resultdir RESULT_DIR] [\-\-macboot] [\-\-nomacboot]
[\-\-extra\-boot\-args EXTRA_BOOT_ARGS]
[\-\-disk\-image DISK_IMAGE] [\-\-keep\-image]
[\-\-fs\-image FS_IMAGE] [\-\-image\-name IMAGE_NAME]
[\-\-fs\-label FS_LABEL] [\-\-image\-type IMAGE_TYPE]
[\-\-qemu\-arg QEMU_ARGS] [\-\-qcow2]
[\-\-qcow2\-arg QEMU_ARGS] [\-\-compression COMPRESSION]
[\-\-tar\-disk\-name TAR_DISK_NAME] [\-\-fs\-label FS_LABEL]
[\-\-image\-size\-align IMAGE_SIZE_ALIGN]
[\-\-image\-type IMAGE_TYPE] [\-\-qemu\-arg QEMU_ARGS]
[\-\-qcow2] [\-\-qcow2\-arg QEMU_ARGS]
[\-\-compression COMPRESSION]
[\-\-compress\-arg COMPRESS_ARGS] [\-\-app\-name APP_NAME]
[\-\-app\-template APP_TEMPLATE] [\-\-app\-file APP_FILE]
[\-\-ram MEMORY] [\-\-vcpus VCPUS] [\-\-vnc VNC]
@ -142,6 +145,11 @@ Build a tar of the root filesystem
.sp
Default: False
.TP
.B\-\-make\-tar\-disk
Build a tar of a partitioned disk image
.sp
Default: False
.TP
.B\-\-make\-pxe\-live
Build a live pxe boot squashfs image
.sp
@ -220,6 +228,11 @@ Default: True
.B\-\-nomacboot
Default: True
.TP
.B\-\-extra\-boot\-args
Extra arguments to add to the bootloader kernel cmdline in the templates
.sp
Default: ""
.TP
.B\-\-title
Substituted for @TITLE@ in bootloader config files
.sp
@ -264,11 +277,19 @@ Path to existing filesystem image to use for creating final image.
.B\-\-image\-name
Name of output file to create. Used for tar, fs and disk image. Default is a random name.
.TP
.B\-\-tar\-disk\-name
Name of the archive member for make\-tar\-disk.
.TP
.B\-\-fs\-label
Label to set on fsimage, default is \(aqAnaconda\(aq
.sp
Default: "Anaconda"
.TP
.B\-\-image\-size\-align
Create a disk image with a size that is a multiple of this value in MiB.
.sp
Default: 0
.TP
.B\-\-image\-type
Create an image with qemu\-img. See qemu\-img \-\-help for supported formats.
.TP
@ -1044,20 +1065,10 @@ use of partitioned disk images and qcow2.
.sp
Partitioned disk images can only be created for the same platform as the host system (BIOS or
UEFI). You can use virt to create BIOS images on UEFI systems, and it is also possible
to create UEFI images on BIOS systems using OVMF. You first need to setup your system with
the OVMF firmware. The details can be \fI\%found here linux\-kvm OVMF page\fP
but it amounts to:
.INDENT 0.0
.IP 1. 3
Download the firmware.repo from \fI\%Gerd Hoffmann\fP and install it
in /etc/yum.repos.d/
.IP 2. 3
Install the edk2.git\-ovmf\-x64 package
.IP 3. 3
Copy /usr/share/edk2.git/ovmf\-x64/OVMF_CODE\-pure\-efi.fd to /usr/share/OVMF/OVMF_CODE.fd
.IP 4. 3
Copy /usr/share/edk2.git/ovmf\-x64/OVMF_VARS\-pure\-efi.fd to /usr/share/OVMF/OVMF_VARS.fd
.UNINDENT
to create UEFI images on BIOS systems using OVMF firmware and qemu.
.sp
Install the lorax\-lmc\-virt package, this will install qemu and the OVMF
firmware files.
.sp
Now you can run livemedia\-creator with \fB\-\-virt\-uefi\fP to boot and install using UEFI:
.INDENT 0.0
@ -1084,13 +1095,12 @@ part /boot/efi \-\-fstype="efi" \-\-size=500
.UNINDENT
.UNINDENT
.sp
Or use \fBreqpart\fP in the kickstart and Anaconda will create the required partitions.
.sp
\fBNOTE:\fP
.INDENT 0.0
.INDENT 3.5
When using the resulting image with the current version of OVMF (edk2.git\-ovmf\-x64\-0\-20151103.b1295.ge5cffca)
it will not boot automatically because there is a problem with the fallback path.
You can boot it by entering the UEFI shell and running EFI/fedora/shim.efi and
then using efibootmgr to setup the correct boot entry.
The \-\-virt\-uefi method is currently only supported on the x86_64 architecture.
.UNINDENT
.UNINDENT
.SH DEBUGGING PROBLEMS

View File

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "LORAX-COMPOSER" "1" "Nov 29, 2018" "29.21" "Lorax"
.TH "LORAX-COMPOSER" "1" "May 07, 2019" "29.28" "Lorax"
.SH NAME
lorax-composer \- Lorax Composer Documentation
.
@ -151,7 +151,7 @@ Default: "/run/weldr/api.socket"
.B\-\-user
User to use for reduced permissions
.sp
Default: "weldr"
Default: "root"
.TP
.B\-\-group
Group to set ownership of the socket to
@ -277,18 +277,37 @@ For purposes of blueprints, mandatory and default packages will be installed. T
for selecting optional packages.
.SS Customizations
.sp
The \fB[[customizations]]\fP section can be used to configure the hostname of the final image. eg.:
The \fB[customizations]\fP section can be used to configure the hostname of the final image. eg.:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
[[customizations]]
[customizations]
hostname = "baseimage"
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
This is optional and may be left out to use the defaults.
.SS [customizations.kernel]
.sp
This allows you to append arguments to the bootloader\(aqs kernel commandline. This will not have any
effect on \fBtar\fP or \fBext4\-filesystem\fP images since they do not include a bootloader.
.sp
For example:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
[customizations.kernel]
append = "nosmt=force"
.ft P
.fi
.UNINDENT
.UNINDENT
.SS [[customizations.sshkey]]
.sp
Set an existing user\(aqs ssh key in the final image:
@ -305,8 +324,14 @@ key = "PUBLIC SSH KEY"
.UNINDENT
.UNINDENT
.sp
The key will be added to the user\(aqs authorized_keys file. Expected value is the content
of ~/.ssh/id_rsa.pub.
The key will be added to the user\(aqs authorized_keys file.
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
\fBkey\fP expects the entire content of \fB~/.ssh/id_rsa.pub\fP
.UNINDENT
.UNINDENT
.SS [[customizations.user]]
.sp
Add a user to the image, and/or set their ssh key.
@ -332,8 +357,14 @@ gid = 1200
.UNINDENT
.sp
If the password starts with \fB$6$\fP, \fB$5$\fP, or \fB$2b$\fP it will be stored as
an encrypted password. Otherwise it will be treated as a plain text password. For
ssh keys the expected value is the content of ~/.ssh/id_rsa.pub.
an encrypted password. Otherwise it will be treated as a plain text password.
.sp
\fBWARNING:\fP
.INDENT 0.0
.INDENT 3.5
\fBkey\fP expects the entire content of \fB~/.ssh/id_rsa.pub\fP
.UNINDENT
.UNINDENT
.SS [[customizations.group]]
.sp
Add a group to the image. \fBname\fP is required and \fBgid\fP is optional:
@ -349,6 +380,174 @@ gid = 1130
.fi
.UNINDENT
.UNINDENT
.SS [customizations.timezone]
.sp
Customizing the timezone and the NTP servers to use for the system:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
[customizations.timezone]
timezone = "US/Eastern"
ntpservers = ["0.north\-america.pool.ntp.org", "1.north\-america.pool.ntp.org"]
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
The values supported by \fBtimezone\fP can be listed by running \fBtimedatectl list\-timezones\fP\&.
.sp
If no timezone is setup the system will default to using \fIUTC\fP\&. The ntp servers are also
optional and will default to using the distribution defaults which are fine for most uses.
.sp
In some image types there are already NTP servers setup, eg. Google cloud image, and they
cannot be overridden because they are required to boot in the selected environment. But the
timezone will be updated to the one selected in the blueprint.
.SS [customizations.locale]
.sp
Customize the locale settings for the system:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
[customizations.locale]
languages = ["en_US.UTF\-8"]
keyboard = "us"
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
The values supported by \fBlanguages\fP can be listed by running \fBlocalectl list\-locales\fP from
the command line.
.sp
The values supported by \fBkeyboard\fP can be listed by running \fBlocalectl list\-keymaps\fP from
the command line.
.sp
Multiple languages can be added. The first one becomes the
primary, and the others are added as secondary. One or the other of \fBlanguages\fP
or \fBkeyboard\fP must be included (or both) in the section.
.SS [customizations.firewall]
.sp
By default the firewall blocks all access except for services that enable their ports explicitly,
like \fBsshd\fP\&. This command can be used to open other ports or services. Ports are configured using
the port:protocol format:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
[customizations.firewall]
ports = ["22:tcp", "80:tcp", "imap:tcp", "53:tcp", "53:udp"]
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Numeric ports, or their names from \fB/etc/services\fP can be used in the \fBports\fP enabled/disabled lists.
.sp
The blueprint settings extend any existing settings in the image templates, so if \fBsshd\fP is
already enabled it will extend the list of ports with the ones listed by the blueprint.
.sp
If the distribution uses \fBfirewalld\fP you can specify services listed by \fBfirewall\-cmd \-\-get\-services\fP
in a \fBcustomizations.firewall.services\fP section:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
[customizations.firewall.services]
enabled = ["ftp", "ntp", "dhcp"]
disabled = ["telnet"]
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Remember that the \fBfirewall.services\fP are different from the names in \fB/etc/services\fP\&.
.sp
Both are optional, if they are not used leave them out or set them to an empty list \fB[]\fP\&. If you
only want the default firewall setup this section can be omitted from the blueprint.
.sp
NOTE: The \fBGoogle\fP and \fBOpenStack\fP templates explicitly disable the firewall for their environment.
This cannot be overridden by the blueprint.
.SS [customizations.services]
.sp
This section can be used to control which services are enabled at boot time.
Some image types already have services enabled or disabled in order for the
image to work correctly, and cannot be overridden. eg. \fBami\fP requires
\fBsshd\fP, \fBchronyd\fP, and \fBcloud\-init\fP\&. Without them the image will not
boot. Blueprint services are added to, not replacing, the list already in the
templates, if any.
.sp
The service names are systemd service units. You may specify any systemd unit
file accepted by \fBsystemctl enable\fP eg. \fBcockpit.socket\fP:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
[customizations.services]
enabled = ["sshd", "cockpit.socket", "httpd"]
disabled = ["postfix", "telnetd"]
.ft P
.fi
.UNINDENT
.UNINDENT
.SS [[repos.git]]
.sp
The \fB[[repos.git]]\fP entries are used to add files from a \fIgit repository<https://git\-scm.com/>\fP
repository to the created image. The repository is cloned, the specified \fBref\fP is checked out
and an rpm is created to install the files to a \fBdestination\fP path. The rpm includes a summary
with the details of the repository and reference used to create it. The rpm is also included in the
image build metadata.
.sp
To create an rpm named \fBserver\-config\-1.0\-1.noarch.rpm\fP you would add this to your blueprint:
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
[[repos.git]]
rpmname="server\-config"
rpmversion="1.0"
rpmrelease="1"
summary="Setup files for server deployment"
repo="PATH OF GIT REPO TO CLONE"
ref="v1.0"
destination="/opt/server/"
.ft P
.fi
.UNINDENT
.UNINDENT
.INDENT 0.0
.IP \(bu 2
rpmname: Name of the rpm to create, also used as the prefix name in the tar archive
.IP \(bu 2
rpmversion: Version of the rpm, eg. "1.0.0"
.IP \(bu 2
rpmrelease: Release of the rpm, eg. "1"
.IP \(bu 2
summary: Summary string for the rpm
.IP \(bu 2
repo: URL of the get repo to clone and create the archive from
.IP \(bu 2
ref: Git reference to check out. eg. origin/branch\-name, git tag, or git commit hash
.IP \(bu 2
destination: Path to install the / of the git repo at when installing the rpm
.UNINDENT
.sp
An rpm will be created with the contents of the git repository referenced, with the files
being installed under \fB/opt/server/\fP in this case.
.sp
\fBref\fP can be any valid git reference for use with \fBgit archive\fP\&. eg. to use the head
of a branch set it to \fBorigin/branch\-name\fP, a tag name, or a commit hash.
.sp
Note that the repository is cloned in full each time a build is started, so pointing to a
repository with a large amount of history may take a while to clone and use a significant
amount of disk space. The clone is temporary and is removed once the rpm is created.
.SH ADDING OUTPUT TYPES
.sp
\fBlivemedia\-creator\fP supports a large number of output types, and only some of

View File

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "LORAX" "1" "Nov 29, 2018" "29.21" "Lorax"
.TH "LORAX" "1" "May 07, 2019" "29.28" "Lorax"
.SH NAME
lorax \- Lorax Documentation
.
@ -67,7 +67,7 @@ usage: lorax [\-h] \-p PRODUCT \-v VERSION \-r RELEASE [\-s REPOSITORY]
[\-\-add\-arch\-template\-var ADD_ARCH_TEMPLATE_VARS] [\-\-noverify]
[\-\-sharedir SHAREDIR] [\-\-enablerepo [repo]]
[\-\-disablerepo [repo]] [\-\-rootfs\-size ROOTFS_SIZE]
[\-\-noverifyssl] [\-\-dnfplugin DNFPLUGINS]
[\-\-noverifyssl] [\-\-dnfplugin DNFPLUGINS] [\-\-squashfs\-only]
[\-\-dracut\-arg DRACUT_ARGS] [\-V]
OUTPUTDIR
.ft P
@ -170,13 +170,13 @@ Default: ./lorax.log
.B\-\-tmp
Top level temporary directory
.sp
Default: "/var/tmp"
Default: "/var/tmp/lorax"
.TP
.B\-\-cachedir
DNF cache directory. Default is a temporary dir.
.TP
.B\-\-workdir
Work directory, overrides \-\-tmp. Default is a temporary dir under /var/tmp
Work directory, overrides \-\-tmp. Default is a temporary dir under /var/tmp/lorax
.TP
.B\-\-force
Run even when the destination directory exists
@ -235,6 +235,11 @@ Default: False
Enable a DNF plugin by name/glob, or * to enable all of them.
.sp
Default: []
.TP
.B\-\-squashfs\-only
Use a plain squashfs filesystem for the runtime.
.sp
Default: False
.UNINDENT
.SS dracut arguments
.INDENT 0.0

View File

@ -4,6 +4,14 @@ pylorax.api package
Submodules
----------
pylorax.api.bisect module
-------------------------
.. automodule:: pylorax.api.bisect
:members:
:undoc-members:
:show-inheritance:
pylorax.api.checkparams module
------------------------------
@ -60,6 +68,14 @@ pylorax.api.errors module
:undoc-members:
:show-inheritance:
pylorax.api.gitrpm module
-------------------------
.. automodule:: pylorax.api.gitrpm
:members:
:undoc-members:
:show-inheritance:
pylorax.api.projects module
---------------------------