Update lorax 19.7.18 (lorax-composer) Documentation

This commit is contained in:
Brian C. Lane 2018-06-29 13:46:27 -07:00
parent 7eea788457
commit b065e6dcaa
87 changed files with 2317 additions and 13949 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: 747437aa7a4b09fa19b6c379d5c03d4c
config: 66d7c44afa220f9e7a6f61390f7186ec
tags: fbb0d17656682115ca4d033fb2f83ba1

Binary file not shown.

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>composer.cli &mdash; Lorax 19.7.15 documentation</title>
<title>composer.cli &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../index.html" />
<link rel="up" title="Module code" href="../index.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" accesskey="U">Module code</a> &raquo;</li>
</ul>
</div>
@ -49,7 +49,6 @@
<div class="body">
<h1>Source code for composer.cli</h1><div class="highlight"><pre>
<span class="c">#!/usr/bin/python</span>
<span class="c">#</span>
<span class="c"># composer-cli</span>
<span class="c">#</span>
@ -75,12 +74,14 @@
<span class="kn">from</span> <span class="nn">composer.cli.modules</span> <span class="kn">import</span> <span class="n">modules_cmd</span>
<span class="kn">from</span> <span class="nn">composer.cli.projects</span> <span class="kn">import</span> <span class="n">projects_cmd</span>
<span class="kn">from</span> <span class="nn">composer.cli.compose</span> <span class="kn">import</span> <span class="n">compose_cmd</span>
<span class="kn">from</span> <span class="nn">composer.cli.sources</span> <span class="kn">import</span> <span class="n">sources_cmd</span>
<span class="n">command_map</span> <span class="o">=</span> <span class="p">{</span>
<span class="s">&quot;blueprints&quot;</span><span class="p">:</span> <span class="n">blueprints_cmd</span><span class="p">,</span>
<span class="s">&quot;modules&quot;</span><span class="p">:</span> <span class="n">modules_cmd</span><span class="p">,</span>
<span class="s">&quot;projects&quot;</span><span class="p">:</span> <span class="n">projects_cmd</span><span class="p">,</span>
<span class="s">&quot;compose&quot;</span><span class="p">:</span> <span class="n">compose_cmd</span>
<span class="s">&quot;compose&quot;</span><span class="p">:</span> <span class="n">compose_cmd</span><span class="p">,</span>
<span class="s">&quot;sources&quot;</span><span class="p">:</span> <span class="n">sources_cmd</span>
<span class="p">}</span>
@ -90,15 +91,12 @@
<span class="sd"> :param opts: Cmdline arguments</span>
<span class="sd"> :type opts: argparse.Namespace</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</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="s">&quot;Missing command&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">1</span>
<span class="k">elif</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">command_map</span><span class="p">:</span>
<span class="c"># Making sure opts.args is not empty (thus, has a command and subcommand)</span>
<span class="c"># is already handled in src/bin/composer-cli.</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">command_map</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="s">&quot;Unknown command </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="k">return</span> <span class="mi">1</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</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="s">&quot;Missing </span><span class="si">%s</span><span class="s"> sub-command&quot;</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="k">return</span> <span class="mi">1</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">return</span> <span class="n">command_map</span><span class="p">[</span><span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]](</span><span class="n">opts</span><span class="p">)</span>
@ -138,7 +136,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
</ul>
</div>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>composer.cli.blueprints &mdash; Lorax 19.7.15 documentation</title>
<title>composer.cli.blueprints &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../../index.html" />
<link rel="up" title="composer.cli" href="../cli.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../cli.html" accesskey="U">composer.cli</a> &raquo;</li>
</ul>
@ -73,6 +73,7 @@
<span class="kn">import</span> <span class="nn">json</span>
<span class="kn">from</span> <span class="nn">composer</span> <span class="kn">import</span> <span class="n">http_client</span> <span class="k">as</span> <span class="n">client</span>
<span class="kn">from</span> <span class="nn">composer.cli.help</span> <span class="kn">import</span> <span class="n">blueprints_help</span>
<span class="kn">from</span> <span class="nn">composer.cli.utilities</span> <span class="kn">import</span> <span class="n">argify</span><span class="p">,</span> <span class="n">frozen_toml_filename</span><span class="p">,</span> <span class="n">toml_filename</span><span class="p">,</span> <span class="n">handle_api_result</span>
<span class="kn">from</span> <span class="nn">composer.cli.utilities</span> <span class="kn">import</span> <span class="n">packageNEVRA</span>
@ -100,7 +101,10 @@
<span class="s">&quot;undo&quot;</span><span class="p">:</span> <span class="n">blueprints_undo</span><span class="p">,</span>
<span class="s">&quot;workspace&quot;</span><span class="p">:</span> <span class="n">blueprints_workspace</span>
<span class="p">}</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">cmd_map</span><span class="p">:</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;help&quot;</span> <span class="ow">or</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;--help&quot;</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="n">blueprints_help</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">0</span>
<span class="k">elif</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">cmd_map</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="s">&quot;Unknown blueprints command: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="k">return</span> <span class="mi">1</span>
@ -603,7 +607,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../cli.html" >composer.cli</a> &raquo;</li>
</ul>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>composer.cli.compose &mdash; Lorax 19.7.15 documentation</title>
<title>composer.cli.compose &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../../index.html" />
<link rel="up" title="composer.cli" href="../cli.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../cli.html" accesskey="U">composer.cli</a> &raquo;</li>
</ul>
@ -73,6 +73,7 @@
<span class="kn">import</span> <span class="nn">json</span>
<span class="kn">from</span> <span class="nn">composer</span> <span class="kn">import</span> <span class="n">http_client</span> <span class="k">as</span> <span class="n">client</span>
<span class="kn">from</span> <span class="nn">composer.cli.help</span> <span class="kn">import</span> <span class="n">compose_help</span>
<span class="kn">from</span> <span class="nn">composer.cli.utilities</span> <span class="kn">import</span> <span class="n">argify</span><span class="p">,</span> <span class="n">handle_api_result</span><span class="p">,</span> <span class="n">packageNEVRA</span>
<div class="viewcode-block" id="compose_cmd"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.compose.compose_cmd">[docs]</a><span class="k">def</span> <span class="nf">compose_cmd</span><span class="p">(</span><span class="n">opts</span><span class="p">):</span>
@ -98,7 +99,10 @@
<span class="s">&quot;logs&quot;</span><span class="p">:</span> <span class="n">compose_logs</span><span class="p">,</span>
<span class="s">&quot;image&quot;</span><span class="p">:</span> <span class="n">compose_image</span><span class="p">,</span>
<span class="p">}</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">cmd_map</span><span class="p">:</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span> <span class="o">==</span> <span class="s">&quot;help&quot;</span> <span class="ow">or</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span> <span class="o">==</span> <span class="s">&quot;--help&quot;</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="n">compose_help</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">0</span>
<span class="k">elif</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">cmd_map</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="s">&quot;Unknown compose command: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="k">return</span> <span class="mi">1</span>
@ -540,7 +544,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../cli.html" >composer.cli</a> &raquo;</li>
</ul>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>composer.cli.modules &mdash; Lorax 19.7.15 documentation</title>
<title>composer.cli.modules &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../../index.html" />
<link rel="up" title="composer.cli" href="../cli.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../cli.html" accesskey="U">composer.cli</a> &raquo;</li>
</ul>
@ -72,6 +72,7 @@
<span class="kn">import</span> <span class="nn">json</span>
<span class="kn">from</span> <span class="nn">composer</span> <span class="kn">import</span> <span class="n">http_client</span> <span class="k">as</span> <span class="n">client</span>
<span class="kn">from</span> <span class="nn">composer.cli.help</span> <span class="kn">import</span> <span class="n">modules_help</span>
<div class="viewcode-block" id="modules_cmd"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.modules.modules_cmd">[docs]</a><span class="k">def</span> <span class="nf">modules_cmd</span><span class="p">(</span><span class="n">opts</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Process modules commands</span>
@ -81,7 +82,10 @@
<span class="sd"> :returns: Value to return from sys.exit()</span>
<span class="sd"> :rtype: int</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">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">!=</span> <span class="s">&quot;list&quot;</span><span class="p">:</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;help&quot;</span> <span class="ow">or</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;--help&quot;</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="n">modules_help</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">0</span>
<span class="k">elif</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">!=</span> <span class="s">&quot;list&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="s">&quot;Unknown modules command: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="k">return</span> <span class="mi">1</span>
@ -127,7 +131,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../cli.html" >composer.cli</a> &raquo;</li>
</ul>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>composer.cli.projects &mdash; Lorax 19.7.15 documentation</title>
<title>composer.cli.projects &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../../index.html" />
<link rel="up" title="composer.cli" href="../cli.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../cli.html" accesskey="U">composer.cli</a> &raquo;</li>
</ul>
@ -73,6 +73,7 @@
<span class="kn">import</span> <span class="nn">textwrap</span>
<span class="kn">from</span> <span class="nn">composer</span> <span class="kn">import</span> <span class="n">http_client</span> <span class="k">as</span> <span class="n">client</span>
<span class="kn">from</span> <span class="nn">composer.cli.help</span> <span class="kn">import</span> <span class="n">projects_help</span>
<div class="viewcode-block" id="projects_cmd"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.projects.projects_cmd">[docs]</a><span class="k">def</span> <span class="nf">projects_cmd</span><span class="p">(</span><span class="n">opts</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Process projects commands</span>
@ -86,7 +87,10 @@
<span class="s">&quot;list&quot;</span><span class="p">:</span> <span class="n">projects_list</span><span class="p">,</span>
<span class="s">&quot;info&quot;</span><span class="p">:</span> <span class="n">projects_info</span><span class="p">,</span>
<span class="p">}</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">cmd_map</span><span class="p">:</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;help&quot;</span> <span class="ow">or</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;--help&quot;</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="n">projects_help</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">0</span>
<span class="k">elif</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">cmd_map</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="s">&quot;Unknown projects command: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="k">return</span> <span class="mi">1</span>
@ -189,7 +193,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../cli.html" >composer.cli</a> &raquo;</li>
</ul>

View File

@ -1,613 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>composer.cli.recipes &mdash; Lorax 19.7.11 documentation</title>
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '19.7.11',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</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>
<link rel="top" title="Lorax 19.7.11 documentation" href="../../../index.html" />
<link rel="up" title="composer.cli" href="../cli.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.11 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../cli.html" accesskey="U">composer.cli</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<h1>Source code for composer.cli.recipes</h1><div class="highlight"><pre>
<span class="c">#</span>
<span class="c"># Copyright (C) 2018 Red Hat, Inc.</span>
<span class="c">#</span>
<span class="c"># This program is free software; you can redistribute it and/or modify</span>
<span class="c"># it under the terms of the GNU General Public License as published by</span>
<span class="c"># the Free Software Foundation; either version 2 of the License, or</span>
<span class="c"># (at your option) any later version.</span>
<span class="c">#</span>
<span class="c"># This program is distributed in the hope that it will be useful,</span>
<span class="c"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<span class="c"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
<span class="c"># GNU General Public License for more details.</span>
<span class="c">#</span>
<span class="c"># You should have received a copy of the GNU General Public License</span>
<span class="c"># along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
<span class="c">#</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="s">&quot;composer-cli&quot;</span><span class="p">)</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">json</span>
<span class="kn">from</span> <span class="nn">composer</span> <span class="kn">import</span> <span class="n">http_client</span> <span class="k">as</span> <span class="n">client</span>
<span class="kn">from</span> <span class="nn">composer.cli.utilities</span> <span class="kn">import</span> <span class="n">argify</span><span class="p">,</span> <span class="n">frozen_toml_filename</span><span class="p">,</span> <span class="n">toml_filename</span><span class="p">,</span> <span class="n">handle_api_result</span>
<span class="kn">from</span> <span class="nn">composer.cli.utilities</span> <span class="kn">import</span> <span class="n">packageNEVRA</span>
<div class="viewcode-block" id="recipes_cmd"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.recipes.recipes_cmd">[docs]</a><span class="k">def</span> <span class="nf">recipes_cmd</span><span class="p">(</span><span class="n">opts</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Process recipes commands</span>
<span class="sd"> :param opts: Cmdline arguments</span>
<span class="sd"> :type opts: argparse.Namespace</span>
<span class="sd"> :returns: Value to return from sys.exit()</span>
<span class="sd"> :rtype: int</span>
<span class="sd"> This dispatches the recipes commands to a function</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">cmd_map</span> <span class="o">=</span> <span class="p">{</span>
<span class="s">&quot;list&quot;</span><span class="p">:</span> <span class="n">recipes_list</span><span class="p">,</span>
<span class="s">&quot;show&quot;</span><span class="p">:</span> <span class="n">recipes_show</span><span class="p">,</span>
<span class="s">&quot;changes&quot;</span><span class="p">:</span> <span class="n">recipes_changes</span><span class="p">,</span>
<span class="s">&quot;diff&quot;</span><span class="p">:</span> <span class="n">recipes_diff</span><span class="p">,</span>
<span class="s">&quot;save&quot;</span><span class="p">:</span> <span class="n">recipes_save</span><span class="p">,</span>
<span class="s">&quot;delete&quot;</span><span class="p">:</span> <span class="n">recipes_delete</span><span class="p">,</span>
<span class="s">&quot;depsolve&quot;</span><span class="p">:</span> <span class="n">recipes_depsolve</span><span class="p">,</span>
<span class="s">&quot;push&quot;</span><span class="p">:</span> <span class="n">recipes_push</span><span class="p">,</span>
<span class="s">&quot;freeze&quot;</span><span class="p">:</span> <span class="n">recipes_freeze</span><span class="p">,</span>
<span class="s">&quot;tag&quot;</span><span class="p">:</span> <span class="n">recipes_tag</span><span class="p">,</span>
<span class="s">&quot;undo&quot;</span><span class="p">:</span> <span class="n">recipes_undo</span><span class="p">,</span>
<span class="s">&quot;workspace&quot;</span><span class="p">:</span> <span class="n">recipes_workspace</span>
<span class="p">}</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">cmd_map</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="s">&quot;Unknown recipes command: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="k">return</span> <span class="mi">1</span>
<span class="k">return</span> <span class="n">cmd_map</span><span class="p">[</span><span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]](</span><span class="n">opts</span><span class="o">.</span><span class="n">socket</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">api_version</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">2</span><span class="p">:],</span> <span class="n">opts</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="recipes_list"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.recipes.recipes_list">[docs]</a><span class="k">def</span> <span class="nf">recipes_list</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Output the list of available recipes</span>
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
<span class="sd"> :type socket_path: str</span>
<span class="sd"> :param api_version: Version of the API to talk to. eg. &quot;0&quot;</span>
<span class="sd"> :type api_version: str</span>
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
<span class="sd"> :type args: list of str</span>
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
<span class="sd"> :type show_json: bool</span>
<span class="sd"> recipes list</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">&quot;/recipes/list&quot;</span><span class="p">)</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">get_url_json</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span>
<span class="k">if</span> <span class="n">show_json</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="mi">4</span><span class="p">))</span>
<span class="k">return</span> <span class="mi">0</span>
<span class="k">print</span><span class="p">(</span><span class="s">&quot;Recipes: &quot;</span> <span class="o">+</span> <span class="s">&quot;, &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="n">r</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">result</span><span class="p">[</span><span class="s">&quot;recipes&quot;</span><span class="p">]]))</span>
<span class="k">return</span> <span class="mi">0</span>
</div>
<div class="viewcode-block" id="recipes_show"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.recipes.recipes_show">[docs]</a><span class="k">def</span> <span class="nf">recipes_show</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Show the recipes, in TOML format</span>
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
<span class="sd"> :type socket_path: str</span>
<span class="sd"> :param api_version: Version of the API to talk to. eg. &quot;0&quot;</span>
<span class="sd"> :type api_version: str</span>
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
<span class="sd"> :type args: list of str</span>
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
<span class="sd"> :type show_json: bool</span>
<span class="sd"> recipes show &lt;recipe,...&gt; Display the recipe in TOML format.</span>
<span class="sd"> Multiple recipes will be separated by \n\n</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">for</span> <span class="n">recipe</span> <span class="ow">in</span> <span class="n">argify</span><span class="p">(</span><span class="n">args</span><span class="p">):</span>
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">&quot;/recipes/info/</span><span class="si">%s</span><span class="s">?format=toml&quot;</span> <span class="o">%</span> <span class="n">recipe</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="n">client</span><span class="o">.</span><span class="n">get_url_raw</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n\n</span><span class="s">&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">0</span>
</div>
<div class="viewcode-block" id="recipes_changes"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.recipes.recipes_changes">[docs]</a><span class="k">def</span> <span class="nf">recipes_changes</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Display the changes for each of the recipes</span>
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
<span class="sd"> :type socket_path: str</span>
<span class="sd"> :param api_version: Version of the API to talk to. eg. &quot;0&quot;</span>
<span class="sd"> :type api_version: str</span>
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
<span class="sd"> :type args: list of str</span>
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
<span class="sd"> :type show_json: bool</span>
<span class="sd"> recipes changes &lt;recipe,...&gt; Display the changes for each recipe.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">&quot;/recipes/changes/</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="s">&quot;,&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">argify</span><span class="p">(</span><span class="n">args</span><span class="p">))))</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">get_url_json</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span>
<span class="k">if</span> <span class="n">show_json</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="mi">4</span><span class="p">))</span>
<span class="k">return</span> <span class="mi">0</span>
<span class="k">for</span> <span class="n">recipe</span> <span class="ow">in</span> <span class="n">result</span><span class="p">[</span><span class="s">&quot;recipes&quot;</span><span class="p">]:</span>
<span class="k">print</span><span class="p">(</span><span class="n">recipe</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">])</span>
<span class="k">for</span> <span class="n">change</span> <span class="ow">in</span> <span class="n">recipe</span><span class="p">[</span><span class="s">&quot;changes&quot;</span><span class="p">]:</span>
<span class="n">prettyCommitDetails</span><span class="p">(</span><span class="n">change</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">0</span>
</div>
<div class="viewcode-block" id="prettyCommitDetails"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.recipes.prettyCommitDetails">[docs]</a><span class="k">def</span> <span class="nf">prettyCommitDetails</span><span class="p">(</span><span class="n">change</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="mi">4</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Print the recipe&#39;s change in a nice way</span>
<span class="sd"> :param change: The individual recipe change dict</span>
<span class="sd"> :type change: dict</span>
<span class="sd"> :param indent: Number of spaces to indent</span>
<span class="sd"> :type indent: int</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">def</span> <span class="nf">revision</span><span class="p">():</span>
<span class="k">if</span> <span class="n">change</span><span class="p">[</span><span class="s">&quot;revision&quot;</span><span class="p">]:</span>
<span class="k">return</span> <span class="s">&quot; revision </span><span class="si">%d</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">change</span><span class="p">[</span><span class="s">&quot;revision&quot;</span><span class="p">]</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="s">&quot;&quot;</span>
<span class="k">print</span> <span class="s">&quot; &quot;</span> <span class="o">*</span> <span class="n">indent</span> <span class="o">+</span> <span class="n">change</span><span class="p">[</span><span class="s">&quot;timestamp&quot;</span><span class="p">]</span> <span class="o">+</span> <span class="s">&quot; &quot;</span> <span class="o">+</span> <span class="n">change</span><span class="p">[</span><span class="s">&quot;commit&quot;</span><span class="p">]</span> <span class="o">+</span> <span class="n">revision</span><span class="p">()</span>
<span class="k">print</span> <span class="s">&quot; &quot;</span> <span class="o">*</span> <span class="n">indent</span> <span class="o">+</span> <span class="n">change</span><span class="p">[</span><span class="s">&quot;message&quot;</span><span class="p">]</span> <span class="o">+</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span>
</div>
<div class="viewcode-block" id="recipes_diff"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.recipes.recipes_diff">[docs]</a><span class="k">def</span> <span class="nf">recipes_diff</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Display the differences between 2 versions of a recipe</span>
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
<span class="sd"> :type socket_path: str</span>
<span class="sd"> :param api_version: Version of the API to talk to. eg. &quot;0&quot;</span>
<span class="sd"> :type api_version: str</span>
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
<span class="sd"> :type args: list of str</span>
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
<span class="sd"> :type show_json: bool</span>
<span class="sd"> recipes diff &lt;recipe-name&gt; Display the differences between 2 versions of a recipe.</span>
<span class="sd"> &lt;from-commit&gt; Commit hash or NEWEST</span>
<span class="sd"> &lt;to-commit&gt; Commit hash, NEWEST, or WORKSPACE</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</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="s">&quot;recipes diff is missing the recipe name, from commit, and to commit&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">1</span>
<span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</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="s">&quot;recipes diff is missing the from commit, and the to commit&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">1</span>
<span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</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="s">&quot;recipes diff is missing the to commit&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">1</span>
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">&quot;/recipes/diff/</span><span class="si">%s</span><span class="s">/</span><span class="si">%s</span><span class="s">/</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">args</span><span class="p">[</span><span class="mi">2</span><span class="p">]))</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">get_url_json</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span>
<span class="k">if</span> <span class="n">show_json</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="mi">4</span><span class="p">))</span>
<span class="k">return</span> <span class="mi">0</span>
<span class="k">if</span> <span class="n">result</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&quot;error&quot;</span><span class="p">,</span> <span class="bp">False</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">result</span><span class="p">[</span><span class="s">&quot;error&quot;</span><span class="p">][</span><span class="s">&quot;msg&quot;</span><span class="p">])</span>
<span class="k">return</span> <span class="mi">1</span>
<span class="k">for</span> <span class="n">diff</span> <span class="ow">in</span> <span class="n">result</span><span class="p">[</span><span class="s">&quot;diff&quot;</span><span class="p">]:</span>
<span class="k">print</span><span class="p">(</span><span class="n">prettyDiffEntry</span><span class="p">(</span><span class="n">diff</span><span class="p">))</span>
<span class="k">return</span> <span class="mi">0</span>
</div>
<div class="viewcode-block" id="prettyDiffEntry"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.recipes.prettyDiffEntry">[docs]</a><span class="k">def</span> <span class="nf">prettyDiffEntry</span><span class="p">(</span><span class="n">diff</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Generate nice diff entry string.</span>
<span class="sd"> :param diff: Difference entry dict</span>
<span class="sd"> :type diff: dict</span>
<span class="sd"> :returns: Nice string</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">def</span> <span class="nf">change</span><span class="p">(</span><span class="n">diff</span><span class="p">):</span>
<span class="k">if</span> <span class="n">diff</span><span class="p">[</span><span class="s">&quot;old&quot;</span><span class="p">]</span> <span class="ow">and</span> <span class="n">diff</span><span class="p">[</span><span class="s">&quot;new&quot;</span><span class="p">]:</span>
<span class="k">return</span> <span class="s">&quot;Changed&quot;</span>
<span class="k">elif</span> <span class="n">diff</span><span class="p">[</span><span class="s">&quot;new&quot;</span><span class="p">]</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">diff</span><span class="p">[</span><span class="s">&quot;old&quot;</span><span class="p">]:</span>
<span class="k">return</span> <span class="s">&quot;Added&quot;</span>
<span class="k">elif</span> <span class="n">diff</span><span class="p">[</span><span class="s">&quot;old&quot;</span><span class="p">]</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">diff</span><span class="p">[</span><span class="s">&quot;new&quot;</span><span class="p">]:</span>
<span class="k">return</span> <span class="s">&quot;Removed&quot;</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="s">&quot;Unknown&quot;</span>
<span class="k">def</span> <span class="nf">name</span><span class="p">(</span><span class="n">diff</span><span class="p">):</span>
<span class="k">if</span> <span class="n">diff</span><span class="p">[</span><span class="s">&quot;old&quot;</span><span class="p">]:</span>
<span class="k">return</span> <span class="n">diff</span><span class="p">[</span><span class="s">&quot;old&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span>
<span class="k">elif</span> <span class="n">diff</span><span class="p">[</span><span class="s">&quot;new&quot;</span><span class="p">]:</span>
<span class="k">return</span> <span class="n">diff</span><span class="p">[</span><span class="s">&quot;new&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="s">&quot;Unknown&quot;</span>
<span class="k">def</span> <span class="nf">details</span><span class="p">(</span><span class="n">diff</span><span class="p">):</span>
<span class="k">if</span> <span class="n">change</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span> <span class="o">==</span> <span class="s">&quot;Changed&quot;</span><span class="p">:</span>
<span class="k">if</span> <span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span> <span class="o">==</span> <span class="s">&quot;Description&quot;</span><span class="p">:</span>
<span class="k">return</span> <span class="s">&#39;&quot;</span><span class="si">%s</span><span class="s">&quot; -&gt; &quot;</span><span class="si">%s</span><span class="s">&quot;&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">diff</span><span class="p">[</span><span class="s">&quot;old&quot;</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)],</span> <span class="n">diff</span><span class="p">[</span><span class="s">&quot;old&quot;</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)])</span>
<span class="k">elif</span> <span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span> <span class="o">==</span> <span class="s">&quot;Version&quot;</span><span class="p">:</span>
<span class="k">return</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> -&gt; </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">diff</span><span class="p">[</span><span class="s">&quot;old&quot;</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)],</span> <span class="n">diff</span><span class="p">[</span><span class="s">&quot;old&quot;</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)])</span>
<span class="k">elif</span> <span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&quot;Module&quot;</span><span class="p">,</span> <span class="s">&quot;Package&quot;</span><span class="p">]:</span>
<span class="k">return</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> </span><span class="si">%s</span><span class="s"> -&gt; </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">diff</span><span class="p">[</span><span class="s">&quot;old&quot;</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)][</span><span class="s">&quot;name&quot;</span><span class="p">],</span> <span class="n">diff</span><span class="p">[</span><span class="s">&quot;old&quot;</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)][</span><span class="s">&quot;version&quot;</span><span class="p">],</span>
<span class="n">diff</span><span class="p">[</span><span class="s">&quot;new&quot;</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)][</span><span class="s">&quot;version&quot;</span><span class="p">])</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="s">&quot;Unknown&quot;</span>
<span class="k">elif</span> <span class="n">change</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span> <span class="o">==</span> <span class="s">&quot;Added&quot;</span><span class="p">:</span>
<span class="k">if</span> <span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&quot;Module&quot;</span><span class="p">,</span> <span class="s">&quot;Package&quot;</span><span class="p">]:</span>
<span class="k">return</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">diff</span><span class="p">[</span><span class="s">&quot;new&quot;</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)][</span><span class="s">&quot;name&quot;</span><span class="p">],</span> <span class="n">diff</span><span class="p">[</span><span class="s">&quot;new&quot;</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)][</span><span class="s">&quot;version&quot;</span><span class="p">])</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="s">&quot; &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="n">diff</span><span class="p">[</span><span class="s">&quot;new&quot;</span><span class="p">][</span><span class="n">k</span><span class="p">]</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">diff</span><span class="p">[</span><span class="s">&quot;new&quot;</span><span class="p">]])</span>
<span class="k">elif</span> <span class="n">change</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span> <span class="o">==</span> <span class="s">&quot;Removed&quot;</span><span class="p">:</span>
<span class="k">if</span> <span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&quot;Module&quot;</span><span class="p">,</span> <span class="s">&quot;Package&quot;</span><span class="p">]:</span>
<span class="k">return</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">diff</span><span class="p">[</span><span class="s">&quot;old&quot;</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)][</span><span class="s">&quot;name&quot;</span><span class="p">],</span> <span class="n">diff</span><span class="p">[</span><span class="s">&quot;old&quot;</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)][</span><span class="s">&quot;version&quot;</span><span class="p">])</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="s">&quot; &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="n">diff</span><span class="p">[</span><span class="s">&quot;old&quot;</span><span class="p">][</span><span class="n">k</span><span class="p">]</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">diff</span><span class="p">[</span><span class="s">&quot;old&quot;</span><span class="p">]])</span>
<span class="k">return</span> <span class="n">change</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; &quot;</span> <span class="o">+</span> <span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; &quot;</span> <span class="o">+</span> <span class="n">details</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="recipes_save"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.recipes.recipes_save">[docs]</a><span class="k">def</span> <span class="nf">recipes_save</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Save the recipe to a TOML file</span>
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
<span class="sd"> :type socket_path: str</span>
<span class="sd"> :param api_version: Version of the API to talk to. eg. &quot;0&quot;</span>
<span class="sd"> :type api_version: str</span>
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
<span class="sd"> :type args: list of str</span>
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
<span class="sd"> :type show_json: bool</span>
<span class="sd"> recipes save &lt;recipe,...&gt; Save the recipe to a file, &lt;recipe-name&gt;.toml</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">for</span> <span class="n">recipe</span> <span class="ow">in</span> <span class="n">argify</span><span class="p">(</span><span class="n">args</span><span class="p">):</span>
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">&quot;/recipes/info/</span><span class="si">%s</span><span class="s">?format=toml&quot;</span> <span class="o">%</span> <span class="n">recipe</span><span class="p">)</span>
<span class="n">recipe_toml</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">get_url_raw</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span>
<span class="nb">open</span><span class="p">(</span><span class="n">toml_filename</span><span class="p">(</span><span class="n">recipe</span><span class="p">),</span> <span class="s">&quot;w&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">recipe_toml</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">0</span>
</div>
<div class="viewcode-block" id="recipes_delete"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.recipes.recipes_delete">[docs]</a><span class="k">def</span> <span class="nf">recipes_delete</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Delete a recipe from the server</span>
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
<span class="sd"> :type socket_path: str</span>
<span class="sd"> :param api_version: Version of the API to talk to. eg. &quot;0&quot;</span>
<span class="sd"> :type api_version: str</span>
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
<span class="sd"> :type args: list of str</span>
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
<span class="sd"> :type show_json: bool</span>
<span class="sd"> delete &lt;recipe&gt; Delete a recipe from the server</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">&quot;/recipes/delete/</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">delete_url_json</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span>
<span class="k">return</span> <span class="n">handle_api_result</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">show_json</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="recipes_depsolve"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.recipes.recipes_depsolve">[docs]</a><span class="k">def</span> <span class="nf">recipes_depsolve</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Display the packages needed to install the recipe</span>
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
<span class="sd"> :type socket_path: str</span>
<span class="sd"> :param api_version: Version of the API to talk to. eg. &quot;0&quot;</span>
<span class="sd"> :type api_version: str</span>
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
<span class="sd"> :type args: list of str</span>
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
<span class="sd"> :type show_json: bool</span>
<span class="sd"> recipes depsolve &lt;recipe,...&gt; Display the packages needed to install the recipe.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">&quot;/recipes/depsolve/</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="s">&quot;,&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">argify</span><span class="p">(</span><span class="n">args</span><span class="p">))))</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">get_url_json</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span>
<span class="k">if</span> <span class="n">show_json</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="mi">4</span><span class="p">))</span>
<span class="k">return</span> <span class="mi">0</span>
<span class="k">for</span> <span class="n">recipe</span> <span class="ow">in</span> <span class="n">result</span><span class="p">[</span><span class="s">&quot;recipes&quot;</span><span class="p">]:</span>
<span class="k">if</span> <span class="n">recipe</span><span class="p">[</span><span class="s">&quot;recipe&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&quot;version&quot;</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">):</span>
<span class="k">print</span><span class="p">(</span><span class="s">&quot;Recipe: </span><span class="si">%s</span><span class="s"> v</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">recipe</span><span class="p">[</span><span class="s">&quot;recipe&quot;</span><span class="p">][</span><span class="s">&quot;name&quot;</span><span class="p">],</span> <span class="n">recipe</span><span class="p">[</span><span class="s">&quot;recipe&quot;</span><span class="p">][</span><span class="s">&quot;version&quot;</span><span class="p">]))</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="s">&quot;Recipe: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">recipe</span><span class="p">[</span><span class="s">&quot;recipe&quot;</span><span class="p">][</span><span class="s">&quot;name&quot;</span><span class="p">]))</span>
<span class="k">for</span> <span class="n">dep</span> <span class="ow">in</span> <span class="n">recipe</span><span class="p">[</span><span class="s">&quot;dependencies&quot;</span><span class="p">]:</span>
<span class="k">print</span><span class="p">(</span><span class="s">&quot; &quot;</span> <span class="o">+</span> <span class="n">packageNEVRA</span><span class="p">(</span><span class="n">dep</span><span class="p">))</span>
<span class="k">return</span> <span class="mi">0</span>
</div>
<div class="viewcode-block" id="recipes_push"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.recipes.recipes_push">[docs]</a><span class="k">def</span> <span class="nf">recipes_push</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Push a recipe TOML file to the server, updating the recipe</span>
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
<span class="sd"> :type socket_path: str</span>
<span class="sd"> :param api_version: Version of the API to talk to. eg. &quot;0&quot;</span>
<span class="sd"> :type api_version: str</span>
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
<span class="sd"> :type args: list of str</span>
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
<span class="sd"> :type show_json: bool</span>
<span class="sd"> push &lt;recipe&gt; Push a recipe TOML file to the server.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">&quot;/recipes/new&quot;</span><span class="p">)</span>
<span class="n">rval</span> <span class="o">=</span> <span class="mi">0</span>
<span class="k">for</span> <span class="n">recipe</span> <span class="ow">in</span> <span class="n">argify</span><span class="p">(</span><span class="n">args</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">recipe</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="s">&quot;Missing recipe file: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">recipe</span><span class="p">)</span>
<span class="k">continue</span>
<span class="n">recipe_toml</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">recipe</span><span class="p">,</span> <span class="s">&quot;r&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">post_url_toml</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">,</span> <span class="n">recipe_toml</span><span class="p">)</span>
<span class="k">if</span> <span class="n">handle_api_result</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">show_json</span><span class="p">):</span>
<span class="n">rval</span> <span class="o">=</span> <span class="mi">1</span>
<span class="k">return</span> <span class="n">rval</span>
</div>
<div class="viewcode-block" id="recipes_freeze"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.recipes.recipes_freeze">[docs]</a><span class="k">def</span> <span class="nf">recipes_freeze</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Handle the recipes freeze commands</span>
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
<span class="sd"> :type socket_path: str</span>
<span class="sd"> :param api_version: Version of the API to talk to. eg. &quot;0&quot;</span>
<span class="sd"> :type api_version: str</span>
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
<span class="sd"> :type args: list of str</span>
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
<span class="sd"> :type show_json: bool</span>
<span class="sd"> recipes freeze &lt;recipe,...&gt; Display the frozen recipe&#39;s modules and packages.</span>
<span class="sd"> recipes freeze show &lt;recipe,...&gt; Display the frozen recipe in TOML format.</span>
<span class="sd"> recipes freeze save &lt;recipe,...&gt; Save the frozen recipe to a file, &lt;recipe-name&gt;.frozen.toml.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;show&quot;</span><span class="p">:</span>
<span class="k">return</span> <span class="n">recipes_freeze_show</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">:],</span> <span class="n">show_json</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;save&quot;</span><span class="p">:</span>
<span class="k">return</span> <span class="n">recipes_freeze_save</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">:],</span> <span class="n">show_json</span><span class="p">)</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</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="s">&quot;freeze is missing the recipe name&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">1</span>
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">&quot;/recipes/freeze/</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="s">&quot;,&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">argify</span><span class="p">(</span><span class="n">args</span><span class="p">))))</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">get_url_json</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span>
<span class="k">if</span> <span class="n">show_json</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="mi">4</span><span class="p">))</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">for</span> <span class="n">entry</span> <span class="ow">in</span> <span class="n">result</span><span class="p">[</span><span class="s">&quot;recipes&quot;</span><span class="p">]:</span>
<span class="n">recipe</span> <span class="o">=</span> <span class="n">entry</span><span class="p">[</span><span class="s">&quot;recipe&quot;</span><span class="p">]</span>
<span class="k">if</span> <span class="n">recipe</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&quot;version&quot;</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">):</span>
<span class="k">print</span><span class="p">(</span><span class="s">&quot;Recipe: </span><span class="si">%s</span><span class="s"> v</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">recipe</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">],</span> <span class="n">recipe</span><span class="p">[</span><span class="s">&quot;version&quot;</span><span class="p">]))</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="s">&quot;Recipe: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">recipe</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">]))</span>
<span class="k">for</span> <span class="n">m</span> <span class="ow">in</span> <span class="n">recipe</span><span class="p">[</span><span class="s">&quot;modules&quot;</span><span class="p">]:</span>
<span class="k">print</span><span class="p">(</span><span class="s">&quot; </span><span class="si">%s</span><span class="s">-</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">m</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">],</span> <span class="n">m</span><span class="p">[</span><span class="s">&quot;version&quot;</span><span class="p">]))</span>
<span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">recipe</span><span class="p">[</span><span class="s">&quot;packages&quot;</span><span class="p">]:</span>
<span class="k">print</span><span class="p">(</span><span class="s">&quot; </span><span class="si">%s</span><span class="s">-</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">p</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">],</span> <span class="n">p</span><span class="p">[</span><span class="s">&quot;version&quot;</span><span class="p">]))</span>
<span class="c"># Print any errors</span>
<span class="k">for</span> <span class="n">err</span> <span class="ow">in</span> <span class="n">result</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&quot;errors&quot;</span><span class="p">,</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="s">&quot;</span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">err</span><span class="p">[</span><span class="s">&quot;recipe&quot;</span><span class="p">],</span> <span class="n">err</span><span class="p">[</span><span class="s">&quot;msg&quot;</span><span class="p">])</span>
<span class="c"># Return a 1 if there are any errors</span>
<span class="k">if</span> <span class="n">result</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&quot;errors&quot;</span><span class="p">,</span> <span class="p">[]):</span>
<span class="k">return</span> <span class="mi">1</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="mi">0</span>
</div>
<div class="viewcode-block" id="recipes_freeze_show"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.recipes.recipes_freeze_show">[docs]</a><span class="k">def</span> <span class="nf">recipes_freeze_show</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Show the frozen recipe in TOML format</span>
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
<span class="sd"> :type socket_path: str</span>
<span class="sd"> :param api_version: Version of the API to talk to. eg. &quot;0&quot;</span>
<span class="sd"> :type api_version: str</span>
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
<span class="sd"> :type args: list of str</span>
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
<span class="sd"> :type show_json: bool</span>
<span class="sd"> recipes freeze show &lt;recipe,...&gt; Display the frozen recipe in TOML format.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</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="s">&quot;freeze show is missing the recipe name&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">1</span>
<span class="k">for</span> <span class="n">recipe</span> <span class="ow">in</span> <span class="n">argify</span><span class="p">(</span><span class="n">args</span><span class="p">):</span>
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">&quot;/recipes/freeze/</span><span class="si">%s</span><span class="s">?format=toml&quot;</span> <span class="o">%</span> <span class="n">recipe</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="n">client</span><span class="o">.</span><span class="n">get_url_raw</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">))</span>
<span class="k">return</span> <span class="mi">0</span>
</div>
<div class="viewcode-block" id="recipes_freeze_save"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.recipes.recipes_freeze_save">[docs]</a><span class="k">def</span> <span class="nf">recipes_freeze_save</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Save the frozen recipe to a TOML file</span>
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
<span class="sd"> :type socket_path: str</span>
<span class="sd"> :param api_version: Version of the API to talk to. eg. &quot;0&quot;</span>
<span class="sd"> :type api_version: str</span>
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
<span class="sd"> :type args: list of str</span>
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
<span class="sd"> :type show_json: bool</span>
<span class="sd"> recipes freeze save &lt;recipe,...&gt; Save the frozen recipe to a file, &lt;recipe-name&gt;.frozen.toml.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</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="s">&quot;freeze save is missing the recipe name&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">1</span>
<span class="k">for</span> <span class="n">recipe</span> <span class="ow">in</span> <span class="n">argify</span><span class="p">(</span><span class="n">args</span><span class="p">):</span>
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">&quot;/recipes/freeze/</span><span class="si">%s</span><span class="s">?format=toml&quot;</span> <span class="o">%</span> <span class="n">recipe</span><span class="p">)</span>
<span class="n">recipe_toml</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">get_url_raw</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span>
<span class="nb">open</span><span class="p">(</span><span class="n">frozen_toml_filename</span><span class="p">(</span><span class="n">recipe</span><span class="p">),</span> <span class="s">&quot;w&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">recipe_toml</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">0</span>
</div>
<div class="viewcode-block" id="recipes_tag"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.recipes.recipes_tag">[docs]</a><span class="k">def</span> <span class="nf">recipes_tag</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Tag the most recent recipe commit as a release</span>
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
<span class="sd"> :type socket_path: str</span>
<span class="sd"> :param api_version: Version of the API to talk to. eg. &quot;0&quot;</span>
<span class="sd"> :type api_version: str</span>
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
<span class="sd"> :type args: list of str</span>
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
<span class="sd"> :type show_json: bool</span>
<span class="sd"> recipes tag &lt;recipe&gt; Tag the most recent recipe commit as a release.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">&quot;/recipes/tag/</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">post_url</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">handle_api_result</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">show_json</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="recipes_undo"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.recipes.recipes_undo">[docs]</a><span class="k">def</span> <span class="nf">recipes_undo</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Undo changes to a recipe</span>
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
<span class="sd"> :type socket_path: str</span>
<span class="sd"> :param api_version: Version of the API to talk to. eg. &quot;0&quot;</span>
<span class="sd"> :type api_version: str</span>
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
<span class="sd"> :type args: list of str</span>
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
<span class="sd"> :type show_json: bool</span>
<span class="sd"> recipes undo &lt;recipe&gt; &lt;commit&gt; Undo changes to a recipe by reverting to the selected commit.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</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="s">&quot;undo is missing the recipe name and commit hash&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">1</span>
<span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</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="s">&quot;undo is missing commit hash&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">1</span>
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">&quot;/recipes/undo/</span><span class="si">%s</span><span class="s">/</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">post_url</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">handle_api_result</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">show_json</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="recipes_workspace"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.recipes.recipes_workspace">[docs]</a><span class="k">def</span> <span class="nf">recipes_workspace</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Push the recipe TOML to the temporary workspace storage</span>
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
<span class="sd"> :type socket_path: str</span>
<span class="sd"> :param api_version: Version of the API to talk to. eg. &quot;0&quot;</span>
<span class="sd"> :type api_version: str</span>
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
<span class="sd"> :type args: list of str</span>
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
<span class="sd"> :type show_json: bool</span>
<span class="sd"> recipes workspace &lt;recipe&gt; Push the recipe TOML to the temporary workspace storage.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">&quot;/recipes/workspace&quot;</span><span class="p">)</span>
<span class="n">rval</span> <span class="o">=</span> <span class="mi">0</span>
<span class="k">for</span> <span class="n">recipe</span> <span class="ow">in</span> <span class="n">argify</span><span class="p">(</span><span class="n">args</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">recipe</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="s">&quot;Missing recipe file: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">recipe</span><span class="p">)</span>
<span class="k">continue</span>
<span class="n">recipe_toml</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">recipe</span><span class="p">,</span> <span class="s">&quot;r&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">post_url_toml</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">,</span> <span class="n">recipe_toml</span><span class="p">)</span>
<span class="k">if</span> <span class="n">show_json</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="mi">4</span><span class="p">))</span>
<span class="k">elif</span> <span class="n">result</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&quot;error&quot;</span><span class="p">,</span> <span class="bp">False</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">result</span><span class="p">[</span><span class="s">&quot;error&quot;</span><span class="p">][</span><span class="s">&quot;msg&quot;</span><span class="p">])</span>
<span class="c"># Any errors results in returning a 1, but we continue with the rest first</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">result</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&quot;status&quot;</span><span class="p">,</span> <span class="bp">False</span><span class="p">):</span>
<span class="n">rval</span> <span class="o">=</span> <span class="mi">1</span>
<span class="k">return</span> <span class="n">rval</span></div>
</pre></div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../../../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.11 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../cli.html" >composer.cli</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2018, Red Hat, Inc..
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>

View File

@ -0,0 +1,243 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>composer.cli.sources &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</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>
<link rel="top" title="Lorax 19.7.18 documentation" href="../../../index.html" />
<link rel="up" title="composer.cli" href="../cli.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../cli.html" accesskey="U">composer.cli</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<h1>Source code for composer.cli.sources</h1><div class="highlight"><pre>
<span class="c">#</span>
<span class="c"># Copyright (C) 2018 Red Hat, Inc.</span>
<span class="c">#</span>
<span class="c"># This program is free software; you can redistribute it and/or modify</span>
<span class="c"># it under the terms of the GNU General Public License as published by</span>
<span class="c"># the Free Software Foundation; either version 2 of the License, or</span>
<span class="c"># (at your option) any later version.</span>
<span class="c">#</span>
<span class="c"># This program is distributed in the hope that it will be useful,</span>
<span class="c"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<span class="c"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
<span class="c"># GNU General Public License for more details.</span>
<span class="c">#</span>
<span class="c"># You should have received a copy of the GNU General Public License</span>
<span class="c"># along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
<span class="c">#</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="s">&quot;composer-cli&quot;</span><span class="p">)</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">json</span>
<span class="kn">from</span> <span class="nn">composer</span> <span class="kn">import</span> <span class="n">http_client</span> <span class="k">as</span> <span class="n">client</span>
<span class="kn">from</span> <span class="nn">composer.cli.help</span> <span class="kn">import</span> <span class="n">sources_help</span>
<span class="kn">from</span> <span class="nn">composer.cli.utilities</span> <span class="kn">import</span> <span class="n">argify</span><span class="p">,</span> <span class="n">handle_api_result</span>
<div class="viewcode-block" id="sources_cmd"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.sources.sources_cmd">[docs]</a><span class="k">def</span> <span class="nf">sources_cmd</span><span class="p">(</span><span class="n">opts</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Process sources commands</span>
<span class="sd"> :param opts: Cmdline arguments</span>
<span class="sd"> :type opts: argparse.Namespace</span>
<span class="sd"> :returns: Value to return from sys.exit()</span>
<span class="sd"> :rtype: int</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">cmd_map</span> <span class="o">=</span> <span class="p">{</span>
<span class="s">&quot;list&quot;</span><span class="p">:</span> <span class="n">sources_list</span><span class="p">,</span>
<span class="s">&quot;info&quot;</span><span class="p">:</span> <span class="n">sources_info</span><span class="p">,</span>
<span class="s">&quot;add&quot;</span><span class="p">:</span> <span class="n">sources_add</span><span class="p">,</span>
<span class="s">&quot;change&quot;</span><span class="p">:</span> <span class="n">sources_add</span><span class="p">,</span>
<span class="s">&quot;delete&quot;</span><span class="p">:</span> <span class="n">sources_delete</span><span class="p">,</span>
<span class="p">}</span>
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;help&quot;</span> <span class="ow">or</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;--help&quot;</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="n">sources_help</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">0</span>
<span class="k">elif</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">cmd_map</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="s">&quot;Unknown sources command: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="k">return</span> <span class="mi">1</span>
<span class="k">return</span> <span class="n">cmd_map</span><span class="p">[</span><span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]](</span><span class="n">opts</span><span class="o">.</span><span class="n">socket</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">api_version</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">2</span><span class="p">:],</span> <span class="n">opts</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="sources_list"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.sources.sources_list">[docs]</a><span class="k">def</span> <span class="nf">sources_list</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Output the list of available sources</span>
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
<span class="sd"> :type socket_path: str</span>
<span class="sd"> :param api_version: Version of the API to talk to. eg. &quot;0&quot;</span>
<span class="sd"> :type api_version: str</span>
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
<span class="sd"> :type args: list of str</span>
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
<span class="sd"> :type show_json: bool</span>
<span class="sd"> sources list</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">&quot;/projects/source/list&quot;</span><span class="p">)</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">get_url_json</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span>
<span class="k">if</span> <span class="n">show_json</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="mi">4</span><span class="p">))</span>
<span class="k">return</span> <span class="mi">0</span>
<span class="k">print</span><span class="p">(</span><span class="s">&quot;Sources: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="s">&quot;, &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">result</span><span class="p">[</span><span class="s">&quot;sources&quot;</span><span class="p">]))</span>
<span class="k">return</span> <span class="mi">0</span>
</div>
<div class="viewcode-block" id="sources_info"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.sources.sources_info">[docs]</a><span class="k">def</span> <span class="nf">sources_info</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Output info on a list of projects</span>
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
<span class="sd"> :type socket_path: str</span>
<span class="sd"> :param api_version: Version of the API to talk to. eg. &quot;0&quot;</span>
<span class="sd"> :type api_version: str</span>
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
<span class="sd"> :type args: list of str</span>
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
<span class="sd"> :type show_json: bool</span>
<span class="sd"> sources info &lt;source-name&gt;</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</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="s">&quot;sources info is missing the name of the source&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">1</span>
<span class="k">if</span> <span class="n">show_json</span><span class="p">:</span>
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">&quot;/projects/source/info/</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="s">&quot;,&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">args</span><span class="p">))</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">get_url_json</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="mi">4</span><span class="p">))</span>
<span class="k">return</span> <span class="mi">0</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">&quot;/projects/source/info/</span><span class="si">%s</span><span class="s">?format=toml&quot;</span> <span class="o">%</span> <span class="s">&quot;,&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">args</span><span class="p">))</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">get_url_raw</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="n">result</span><span class="p">)</span>
<span class="k">return</span> <span class="mi">0</span>
</div>
<div class="viewcode-block" id="sources_add"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.sources.sources_add">[docs]</a><span class="k">def</span> <span class="nf">sources_add</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Add or change a source</span>
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
<span class="sd"> :type socket_path: str</span>
<span class="sd"> :param api_version: Version of the API to talk to. eg. &quot;0&quot;</span>
<span class="sd"> :type api_version: str</span>
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
<span class="sd"> :type args: list of str</span>
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
<span class="sd"> :type show_json: bool</span>
<span class="sd"> sources add &lt;source.toml&gt;</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">&quot;/projects/source/new&quot;</span><span class="p">)</span>
<span class="n">rval</span> <span class="o">=</span> <span class="mi">0</span>
<span class="k">for</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">argify</span><span class="p">(</span><span class="n">args</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">source</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="s">&quot;Missing source file: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">source</span><span class="p">)</span>
<span class="k">continue</span>
<span class="n">source_toml</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="s">&quot;r&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">post_url_toml</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">,</span> <span class="n">source_toml</span><span class="p">)</span>
<span class="k">if</span> <span class="n">handle_api_result</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">show_json</span><span class="p">):</span>
<span class="n">rval</span> <span class="o">=</span> <span class="mi">1</span>
<span class="k">return</span> <span class="n">rval</span>
</div>
<div class="viewcode-block" id="sources_delete"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.sources.sources_delete">[docs]</a><span class="k">def</span> <span class="nf">sources_delete</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Delete a source</span>
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
<span class="sd"> :type socket_path: str</span>
<span class="sd"> :param api_version: Version of the API to talk to. eg. &quot;0&quot;</span>
<span class="sd"> :type api_version: str</span>
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
<span class="sd"> :type args: list of str</span>
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
<span class="sd"> :type show_json: bool</span>
<span class="sd"> sources delete &lt;source-name&gt;</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">&quot;/projects/source/delete/</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">delete_url_json</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span>
<span class="k">return</span> <span class="n">handle_api_result</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">show_json</span><span class="p">)</span></div>
</pre></div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../../../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../cli.html" >composer.cli</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2018, Red Hat, Inc..
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>composer.cli.utilities &mdash; Lorax 19.7.15 documentation</title>
<title>composer.cli.utilities &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../../index.html" />
<link rel="up" title="composer.cli" href="../cli.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../cli.html" accesskey="U">composer.cli</a> &raquo;</li>
</ul>
@ -167,7 +167,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../cli.html" >composer.cli</a> &raquo;</li>
</ul>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>composer.http_client &mdash; Lorax 19.7.15 documentation</title>
<title>composer.http_client &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../index.html" />
<link rel="up" title="Module code" href="../index.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" accesskey="U">Module code</a> &raquo;</li>
</ul>
</div>
@ -283,7 +283,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
</ul>
</div>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>composer.unix_socket &mdash; Lorax 19.7.15 documentation</title>
<title>composer.unix_socket &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../index.html" />
<link rel="up" title="Module code" href="../index.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" accesskey="U">Module code</a> &raquo;</li>
</ul>
</div>
@ -143,7 +143,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
</ul>
</div>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Overview: module code &mdash; Lorax 19.7.15 documentation</title>
<title>Overview: module code &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../index.html" />
</head>
<body>
<div class="related">
@ -37,7 +37,7 @@
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
@ -52,6 +52,7 @@
<li><a href="composer/cli/compose.html">composer.cli.compose</a></li>
<li><a href="composer/cli/modules.html">composer.cli.modules</a></li>
<li><a href="composer/cli/projects.html">composer.cli.projects</a></li>
<li><a href="composer/cli/sources.html">composer.cli.sources</a></li>
<li><a href="composer/cli/utilities.html">composer.cli.utilities</a></li>
</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>
@ -114,7 +115,7 @@
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../index.html" />
<link rel="up" title="Module code" href="index.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="index.html" accesskey="U">Module code</a> &raquo;</li>
</ul>
</div>
@ -108,6 +108,8 @@
<span class="k">else</span><span class="p">:</span>
<span class="n">vernum</span> <span class="o">=</span> <span class="n">pylorax</span><span class="o">.</span><span class="n">version</span><span class="o">.</span><span class="n">num</span>
<span class="n">DRACUT_DEFAULT</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;--xz&quot;</span><span class="p">,</span> <span class="s">&quot;--install&quot;</span><span class="p">,</span> <span class="s">&quot;/.buildstamp&quot;</span><span class="p">,</span> <span class="s">&quot;--no-early-microcode&quot;</span><span class="p">,</span> <span class="s">&quot;--add&quot;</span><span class="p">,</span> <span class="s">&quot;fips&quot;</span><span class="p">]</span>
<span class="c"># List of drivers to remove on ppc64 arch to keep initrd &lt; 32MiB</span>
<span class="n">REMOVE_PPC64_DRIVERS</span> <span class="o">=</span> <span class="s">&quot;floppy scsi_debug nouveau radeon cirrus mgag200&quot;</span>
<span class="n">REMOVE_PPC64_MODULES</span> <span class="o">=</span> <span class="s">&quot;drm plymouth&quot;</span>
@ -215,7 +217,8 @@
<span class="n">add_template_vars</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
<span class="n">add_arch_templates</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
<span class="n">add_arch_template_vars</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
<span class="n">template_tempdir</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="n">template_tempdir</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
<span class="n">user_dracut_args</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="k">assert</span> <span class="bp">self</span><span class="o">.</span><span class="n">_configured</span>
@ -369,7 +372,13 @@
<span class="n">workdir</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">workdir</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="s">&quot;rebuilding initramfs images&quot;</span><span class="p">)</span>
<span class="n">dracut_args</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;--xz&quot;</span><span class="p">,</span> <span class="s">&quot;--install&quot;</span><span class="p">,</span> <span class="s">&quot;/.buildstamp&quot;</span><span class="p">,</span> <span class="s">&quot;--no-early-microcode&quot;</span><span class="p">,</span> <span class="s">&quot;--add&quot;</span><span class="p">,</span> <span class="s">&quot;fips&quot;</span><span class="p">]</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">user_dracut_args</span><span class="p">:</span>
<span class="n">dracut_args</span> <span class="o">=</span> <span class="n">DRACUT_DEFAULT</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">dracut_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">user_dracut_args</span><span class="p">:</span>
<span class="n">dracut_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="s">&quot; &quot;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="n">anaconda_args</span> <span class="o">=</span> <span class="n">dracut_args</span> <span class="o">+</span> <span class="p">[</span><span class="s">&quot;--add&quot;</span><span class="p">,</span> <span class="s">&quot;anaconda pollcdrom&quot;</span><span class="p">]</span>
<span class="c"># ppc64 cannot boot an initrd &gt; 32MiB so remove some drivers</span>
@ -380,6 +389,8 @@
<span class="c"># upgrade.img</span>
<span class="n">anaconda_args</span><span class="o">.</span><span class="n">extend</span><span class="p">([</span><span class="s">&quot;--omit&quot;</span><span class="p">,</span> <span class="n">REMOVE_PPC64_MODULES</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="s">&quot;dracut args = </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">dracut_args</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="s">&quot;anaconda args = </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">anaconda_args</span><span class="p">)</span>
<span class="n">treebuilder</span><span class="o">.</span><span class="n">rebuild_initrds</span><span class="p">(</span><span class="n">add_args</span><span class="o">=</span><span class="n">anaconda_args</span><span class="p">)</span>
<span class="k">if</span> <span class="n">doupgrade</span><span class="p">:</span>
@ -457,7 +468,7 @@
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="index.html" >Module code</a> &raquo;</li>
</ul>
</div>

View File

@ -1,471 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.__init__ &mdash; Lorax 19.7.11 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '19.7.11',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</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>
<link rel="top" title="Lorax 19.7.11 documentation" href="../../index.html" />
<link rel="up" title="pylorax" href="../pylorax.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.11 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" accesskey="U">pylorax</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<h1>Source code for pylorax.__init__</h1><div class="highlight"><pre>
<span class="c">#</span>
<span class="c"># __init__.py</span>
<span class="c">#</span>
<span class="c"># Copyright (C) 2010 Red Hat, Inc.</span>
<span class="c">#</span>
<span class="c"># This program is free software; you can redistribute it and/or modify</span>
<span class="c"># it under the terms of the GNU General Public License as published by</span>
<span class="c"># the Free Software Foundation; either version 2 of the License, or</span>
<span class="c"># (at your option) any later version.</span>
<span class="c">#</span>
<span class="c"># This program is distributed in the hope that it will be useful,</span>
<span class="c"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<span class="c"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
<span class="c"># GNU General Public License for more details.</span>
<span class="c">#</span>
<span class="c"># You should have received a copy of the GNU General Public License</span>
<span class="c"># along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
<span class="c">#</span>
<span class="c"># Red Hat Author(s): Martin Gracik &lt;mgracik@redhat.com&gt;</span>
<span class="c"># David Cantrell &lt;dcantrell@redhat.com&gt;</span>
<span class="c"># Will Woods &lt;wwoods@redhat.com&gt;</span>
<span class="c"># set up logging</span>
<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="s">&quot;pylorax&quot;</span><span class="p">)</span>
<span class="n">logger</span><span class="o">.</span><span class="n">addHandler</span><span class="p">(</span><span class="n">logging</span><span class="o">.</span><span class="n">NullHandler</span><span class="p">())</span>
<span class="kn">import</span> <span class="nn">sys</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">ConfigParser</span>
<span class="kn">import</span> <span class="nn">tempfile</span>
<span class="kn">import</span> <span class="nn">locale</span>
<span class="kn">from</span> <span class="nn">subprocess</span> <span class="kn">import</span> <span class="n">CalledProcessError</span>
<span class="kn">import</span> <span class="nn">selinux</span>
<span class="kn">from</span> <span class="nn">pylorax.base</span> <span class="kn">import</span> <span class="n">BaseLoraxClass</span><span class="p">,</span> <span class="n">DataHolder</span>
<span class="kn">import</span> <span class="nn">pylorax.output</span> <span class="kn">as</span> <span class="nn">output</span>
<span class="kn">import</span> <span class="nn">yum</span>
<span class="kn">import</span> <span class="nn">pylorax.ltmpl</span> <span class="kn">as</span> <span class="nn">ltmpl</span>
<span class="kn">import</span> <span class="nn">pylorax.imgutils</span> <span class="kn">as</span> <span class="nn">imgutils</span>
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="kn">import</span> <span class="n">joinpaths</span><span class="p">,</span> <span class="n">linktree</span><span class="p">,</span> <span class="n">remove</span>
<span class="kn">from</span> <span class="nn">rpmUtils.arch</span> <span class="kn">import</span> <span class="n">getBaseArch</span>
<span class="kn">from</span> <span class="nn">pylorax.treebuilder</span> <span class="kn">import</span> <span class="n">RuntimeBuilder</span><span class="p">,</span> <span class="n">TreeBuilder</span>
<span class="kn">from</span> <span class="nn">pylorax.buildstamp</span> <span class="kn">import</span> <span class="n">BuildStamp</span>
<span class="kn">from</span> <span class="nn">pylorax.treeinfo</span> <span class="kn">import</span> <span class="n">TreeInfo</span>
<span class="kn">from</span> <span class="nn">pylorax.discinfo</span> <span class="kn">import</span> <span class="n">DiscInfo</span>
<span class="kn">from</span> <span class="nn">pylorax.executils</span> <span class="kn">import</span> <span class="n">runcmd</span><span class="p">,</span> <span class="n">runcmd_output</span>
<span class="c"># get lorax version</span>
<span class="k">try</span><span class="p">:</span>
<span class="kn">import</span> <span class="nn">pylorax.version</span>
<span class="k">except</span> <span class="ne">ImportError</span><span class="p">:</span>
<span class="n">vernum</span> <span class="o">=</span> <span class="s">&quot;devel&quot;</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">vernum</span> <span class="o">=</span> <span class="n">pylorax</span><span class="o">.</span><span class="n">version</span><span class="o">.</span><span class="n">num</span>
<span class="c"># List of drivers to remove on ppc64 arch to keep initrd &lt; 32MiB</span>
<span class="n">REMOVE_PPC64_DRIVERS</span> <span class="o">=</span> <span class="s">&quot;floppy scsi_debug nouveau radeon cirrus mgag200&quot;</span>
<span class="n">REMOVE_PPC64_MODULES</span> <span class="o">=</span> <span class="s">&quot;drm plymouth&quot;</span>
<div class="viewcode-block" id="ArchData"><a class="viewcode-back" href="../../pylorax.html#pylorax.__init__.ArchData">[docs]</a><span class="k">class</span> <span class="nc">ArchData</span><span class="p">(</span><span class="n">DataHolder</span><span class="p">):</span>
<span class="n">lib64_arches</span> <span class="o">=</span> <span class="p">(</span><span class="s">&quot;x86_64&quot;</span><span class="p">,</span> <span class="s">&quot;ppc64&quot;</span><span class="p">,</span> <span class="s">&quot;ppc64le&quot;</span><span class="p">,</span> <span class="s">&quot;s390x&quot;</span><span class="p">,</span> <span class="s">&quot;ia64&quot;</span><span class="p">,</span> <span class="s">&quot;aarch64&quot;</span><span class="p">)</span>
<span class="n">bcj_arch</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="n">i386</span><span class="o">=</span><span class="s">&quot;x86&quot;</span><span class="p">,</span> <span class="n">x86_64</span><span class="o">=</span><span class="s">&quot;x86&quot;</span><span class="p">,</span>
<span class="n">ppc</span><span class="o">=</span><span class="s">&quot;powerpc&quot;</span><span class="p">,</span> <span class="n">ppc64</span><span class="o">=</span><span class="s">&quot;powerpc&quot;</span><span class="p">,</span> <span class="n">ppc64le</span><span class="o">=</span><span class="s">&quot;powerpc&quot;</span><span class="p">,</span>
<span class="n">arm</span><span class="o">=</span><span class="s">&quot;arm&quot;</span><span class="p">,</span> <span class="n">armhfp</span><span class="o">=</span><span class="s">&quot;arm&quot;</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">buildarch</span><span class="p">):</span>
<span class="n">DataHolder</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">buildarch</span><span class="o">=</span><span class="n">buildarch</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">basearch</span> <span class="o">=</span> <span class="n">getBaseArch</span><span class="p">(</span><span class="n">buildarch</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">libdir</span> <span class="o">=</span> <span class="s">&quot;lib64&quot;</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">basearch</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">lib64_arches</span> <span class="k">else</span> <span class="s">&quot;lib&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">bcj</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">bcj_arch</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">basearch</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="Lorax"><a class="viewcode-back" href="../../pylorax.html#pylorax.__init__.Lorax">[docs]</a><span class="k">class</span> <span class="nc">Lorax</span><span class="p">(</span><span class="n">BaseLoraxClass</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">BaseLoraxClass</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_configured</span> <span class="o">=</span> <span class="bp">False</span>
<span class="bp">self</span><span class="o">.</span><span class="n">conf</span> <span class="o">=</span> <span class="bp">None</span>
<span class="bp">self</span><span class="o">.</span><span class="n">outputdir</span> <span class="o">=</span> <span class="bp">None</span>
<span class="bp">self</span><span class="o">.</span><span class="n">workdir</span> <span class="o">=</span> <span class="bp">None</span>
<span class="bp">self</span><span class="o">.</span><span class="n">inroot</span> <span class="o">=</span> <span class="bp">None</span>
<span class="bp">self</span><span class="o">.</span><span class="n">arch</span> <span class="o">=</span> <span class="bp">None</span>
<span class="bp">self</span><span class="o">.</span><span class="n">product</span> <span class="o">=</span> <span class="bp">None</span>
<span class="bp">self</span><span class="o">.</span><span class="n">debug</span> <span class="o">=</span> <span class="bp">False</span>
<span class="c"># set locale to C</span>
<span class="n">locale</span><span class="o">.</span><span class="n">setlocale</span><span class="p">(</span><span class="n">locale</span><span class="o">.</span><span class="n">LC_ALL</span><span class="p">,</span> <span class="s">&#39;C&#39;</span><span class="p">)</span>
<div class="viewcode-block" id="Lorax.configure"><a class="viewcode-back" href="../../pylorax.html#pylorax.__init__.Lorax.configure">[docs]</a> <span class="k">def</span> <span class="nf">configure</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">conf_file</span><span class="o">=</span><span class="s">&quot;/etc/lorax/lorax.conf&quot;</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">conf</span> <span class="o">=</span> <span class="n">ConfigParser</span><span class="o">.</span><span class="n">SafeConfigParser</span><span class="p">()</span>
<span class="c"># set defaults</span>
<span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">add_section</span><span class="p">(</span><span class="s">&quot;lorax&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&quot;lorax&quot;</span><span class="p">,</span> <span class="s">&quot;debug&quot;</span><span class="p">,</span> <span class="s">&quot;1&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&quot;lorax&quot;</span><span class="p">,</span> <span class="s">&quot;sharedir&quot;</span><span class="p">,</span> <span class="s">&quot;/usr/share/lorax&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">add_section</span><span class="p">(</span><span class="s">&quot;output&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&quot;output&quot;</span><span class="p">,</span> <span class="s">&quot;colors&quot;</span><span class="p">,</span> <span class="s">&quot;1&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&quot;output&quot;</span><span class="p">,</span> <span class="s">&quot;encoding&quot;</span><span class="p">,</span> <span class="s">&quot;utf-8&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&quot;output&quot;</span><span class="p">,</span> <span class="s">&quot;ignorelist&quot;</span><span class="p">,</span> <span class="s">&quot;/usr/share/lorax/ignorelist&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">add_section</span><span class="p">(</span><span class="s">&quot;templates&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&quot;templates&quot;</span><span class="p">,</span> <span class="s">&quot;ramdisk&quot;</span><span class="p">,</span> <span class="s">&quot;ramdisk.ltmpl&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">add_section</span><span class="p">(</span><span class="s">&quot;yum&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&quot;yum&quot;</span><span class="p">,</span> <span class="s">&quot;skipbroken&quot;</span><span class="p">,</span> <span class="s">&quot;0&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">add_section</span><span class="p">(</span><span class="s">&quot;compression&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&quot;compression&quot;</span><span class="p">,</span> <span class="s">&quot;type&quot;</span><span class="p">,</span> <span class="s">&quot;xz&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&quot;compression&quot;</span><span class="p">,</span> <span class="s">&quot;args&quot;</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&quot;compression&quot;</span><span class="p">,</span> <span class="s">&quot;bcj&quot;</span><span class="p">,</span> <span class="s">&quot;on&quot;</span><span class="p">)</span>
<span class="c"># read the config file</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">isfile</span><span class="p">(</span><span class="n">conf_file</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="n">conf_file</span><span class="p">)</span>
<span class="c"># set up the output</span>
<span class="bp">self</span><span class="o">.</span><span class="n">debug</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">getboolean</span><span class="p">(</span><span class="s">&quot;lorax&quot;</span><span class="p">,</span> <span class="s">&quot;debug&quot;</span><span class="p">)</span>
<span class="n">output_level</span> <span class="o">=</span> <span class="n">output</span><span class="o">.</span><span class="n">DEBUG</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">debug</span> <span class="k">else</span> <span class="n">output</span><span class="o">.</span><span class="n">INFO</span>
<span class="n">colors</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">getboolean</span><span class="p">(</span><span class="s">&quot;output&quot;</span><span class="p">,</span> <span class="s">&quot;colors&quot;</span><span class="p">)</span>
<span class="n">encoding</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&quot;output&quot;</span><span class="p">,</span> <span class="s">&quot;encoding&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">output</span><span class="o">.</span><span class="n">basic_config</span><span class="p">(</span><span class="n">output_level</span><span class="o">=</span><span class="n">output_level</span><span class="p">,</span>
<span class="n">colors</span><span class="o">=</span><span class="n">colors</span><span class="p">,</span> <span class="n">encoding</span><span class="o">=</span><span class="n">encoding</span><span class="p">)</span>
<span class="n">ignorelist</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&quot;output&quot;</span><span class="p">,</span> <span class="s">&quot;ignorelist&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">isfile</span><span class="p">(</span><span class="n">ignorelist</span><span class="p">):</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">ignorelist</span><span class="p">,</span> <span class="s">&quot;r&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">fobj</span><span class="p">:</span>
<span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">fobj</span><span class="p">:</span>
<span class="n">line</span> <span class="o">=</span> <span class="n">line</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
<span class="k">if</span> <span class="n">line</span> <span class="ow">and</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="s">&quot;#&quot;</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">output</span><span class="o">.</span><span class="n">ignore</span><span class="p">(</span><span class="n">line</span><span class="p">)</span>
<span class="c"># cron does not have sbin in PATH,</span>
<span class="c"># so we have to add it ourselves</span>
<span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s">&quot;PATH&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;{0}:/sbin:/usr/sbin&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">environ</span><span class="p">[</span><span class="s">&quot;PATH&quot;</span><span class="p">])</span>
<span class="c"># remove some environmental variables that can cause problems with package scripts</span>
<span class="n">env_remove</span> <span class="o">=</span> <span class="p">(</span><span class="s">&#39;DISPLAY&#39;</span><span class="p">,</span> <span class="s">&#39;DBUS_SESSION_BUS_ADDRESS&#39;</span><span class="p">)</span>
<span class="n">_</span> <span class="o">=</span> <span class="p">[</span><span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">k</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">env_remove</span> <span class="k">if</span> <span class="n">k</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="bp">self</span><span class="o">.</span><span class="n">_configured</span> <span class="o">=</span> <span class="bp">True</span>
</div>
<div class="viewcode-block" id="Lorax.init_stream_logging"><a class="viewcode-back" href="../../pylorax.html#pylorax.__init__.Lorax.init_stream_logging">[docs]</a> <span class="k">def</span> <span class="nf">init_stream_logging</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">sh</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">StreamHandler</span><span class="p">()</span>
<span class="n">sh</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">INFO</span><span class="p">)</span>
<span class="n">logger</span><span class="o">.</span><span class="n">addHandler</span><span class="p">(</span><span class="n">sh</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="Lorax.init_file_logging"><a class="viewcode-back" href="../../pylorax.html#pylorax.__init__.Lorax.init_file_logging">[docs]</a> <span class="k">def</span> <span class="nf">init_file_logging</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">logdir</span><span class="p">,</span> <span class="n">logname</span><span class="o">=</span><span class="s">&quot;pylorax.log&quot;</span><span class="p">):</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">joinpaths</span><span class="p">(</span><span class="n">logdir</span><span class="p">,</span> <span class="n">logname</span><span class="p">),</span> <span class="n">mode</span><span class="o">=</span><span class="s">&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">logger</span><span class="o">.</span><span class="n">addHandler</span><span class="p">(</span><span class="n">fh</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="Lorax.run"><a class="viewcode-back" href="../../pylorax.html#pylorax.__init__.Lorax.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">ybo</span><span class="p">,</span> <span class="n">product</span><span class="p">,</span> <span class="n">version</span><span class="p">,</span> <span class="n">release</span><span class="p">,</span> <span class="n">variant</span><span class="o">=</span><span class="s">&quot;&quot;</span><span class="p">,</span> <span class="n">bugurl</span><span class="o">=</span><span class="s">&quot;&quot;</span><span class="p">,</span>
<span class="n">isfinal</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">workdir</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">outputdir</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">buildarch</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">volid</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
<span class="n">domacboot</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">doupgrade</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">remove_temp</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
<span class="n">installpkgs</span><span class="o">=</span><span class="bp">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="n">add_templates</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
<span class="n">add_template_vars</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
<span class="n">add_arch_templates</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
<span class="n">add_arch_template_vars</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
<span class="n">template_tempdir</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="k">assert</span> <span class="bp">self</span><span class="o">.</span><span class="n">_configured</span>
<span class="n">installpkgs</span> <span class="o">=</span> <span class="n">installpkgs</span> <span class="ow">or</span> <span class="p">[]</span>
<span class="k">if</span> <span class="n">domacboot</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">runcmd</span><span class="p">([</span><span class="s">&quot;rpm&quot;</span><span class="p">,</span> <span class="s">&quot;-q&quot;</span><span class="p">,</span> <span class="s">&quot;hfsplus-tools&quot;</span><span class="p">])</span>
<span class="k">except</span> <span class="n">CalledProcessError</span><span class="p">:</span>
<span class="n">logger</span><span class="o">.</span><span class="n">critical</span><span class="p">(</span><span class="s">&quot;you need to install hfsplus-tools to create mac images&quot;</span><span class="p">)</span>
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="c"># set up work directory</span>
<span class="bp">self</span><span class="o">.</span><span class="n">workdir</span> <span class="o">=</span> <span class="n">workdir</span> <span class="ow">or</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="s">&quot;pylorax.work.&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">isdir</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">workdir</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="bp">self</span><span class="o">.</span><span class="n">workdir</span><span class="p">)</span>
<span class="c"># set up log directory</span>
<span class="n">logdir</span> <span class="o">=</span> <span class="s">&#39;/var/log/lorax&#39;</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">logdir</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">logdir</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">init_stream_logging</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">init_file_logging</span><span class="p">(</span><span class="n">logdir</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="s">&quot;version is </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">vernum</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="s">&quot;using work directory </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">workdir</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="s">&quot;using log directory </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">logdir</span><span class="p">)</span>
<span class="c"># set up output directory</span>
<span class="bp">self</span><span class="o">.</span><span class="n">outputdir</span> <span class="o">=</span> <span class="n">outputdir</span> <span class="ow">or</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="s">&quot;pylorax.out.&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">isdir</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">outputdir</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="bp">self</span><span class="o">.</span><span class="n">outputdir</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="s">&quot;using output directory </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">outputdir</span><span class="p">)</span>
<span class="c"># do we have root privileges?</span>
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;checking for root privileges&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">geteuid</span><span class="p">()</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
<span class="n">logger</span><span class="o">.</span><span class="n">critical</span><span class="p">(</span><span class="s">&quot;no root privileges&quot;</span><span class="p">)</span>
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="c"># is selinux disabled?</span>
<span class="c"># With selinux in enforcing mode the rpcbind package required for</span>
<span class="c"># dracut nfs module, which is in turn required by anaconda module,</span>
<span class="c"># will not get installed, because it&#39;s preinstall scriptlet fails,</span>
<span class="c"># resulting in an incomplete initial ramdisk image.</span>
<span class="c"># The reason is that the scriptlet runs tools from the shadow-utils</span>
<span class="c"># package in chroot, particularly groupadd and useradd to add the</span>
<span class="c"># required rpc group and rpc user. This operation fails, because</span>
<span class="c"># the selinux context on files in the chroot, that the shadow-utils</span>
<span class="c"># tools need to access (/etc/group, /etc/passwd, /etc/shadow etc.),</span>
<span class="c"># is wrong and selinux therefore disallows access to these files.</span>
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;checking the selinux mode&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">selinux</span><span class="o">.</span><span class="n">is_selinux_enabled</span><span class="p">()</span> <span class="ow">and</span> <span class="n">selinux</span><span class="o">.</span><span class="n">security_getenforce</span><span class="p">():</span>
<span class="n">logger</span><span class="o">.</span><span class="n">critical</span><span class="p">(</span><span class="s">&quot;selinux must be disabled or in Permissive mode&quot;</span><span class="p">)</span>
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="c"># do we have a proper yum base object?</span>
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;checking yum base object&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ybo</span><span class="p">,</span> <span class="n">yum</span><span class="o">.</span><span class="n">YumBase</span><span class="p">):</span>
<span class="n">logger</span><span class="o">.</span><span class="n">critical</span><span class="p">(</span><span class="s">&quot;no yum base object&quot;</span><span class="p">)</span>
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">inroot</span> <span class="o">=</span> <span class="n">ybo</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">installroot</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&quot;using install root: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">inroot</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">buildarch</span><span class="p">:</span>
<span class="n">buildarch</span> <span class="o">=</span> <span class="n">get_buildarch</span><span class="p">(</span><span class="n">ybo</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="s">&quot;setting up build architecture&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">ArchData</span><span class="p">(</span><span class="n">buildarch</span><span class="p">)</span>
<span class="k">for</span> <span class="n">attr</span> <span class="ow">in</span> <span class="p">(</span><span class="s">&#39;buildarch&#39;</span><span class="p">,</span> <span class="s">&#39;basearch&#39;</span><span class="p">,</span> <span class="s">&#39;libdir&#39;</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="s">&quot;self.arch.</span><span class="si">%s</span><span class="s"> = </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">attr</span><span class="p">,</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">arch</span><span class="p">,</span><span class="n">attr</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="s">&quot;setting up build parameters&quot;</span><span class="p">)</span>
<span class="n">product</span> <span class="o">=</span> <span class="n">DataHolder</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">product</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">release</span><span class="o">=</span><span class="n">release</span><span class="p">,</span>
<span class="n">variant</span><span class="o">=</span><span class="n">variant</span><span class="p">,</span> <span class="n">bugurl</span><span class="o">=</span><span class="n">bugurl</span><span class="p">,</span> <span class="n">isfinal</span><span class="o">=</span><span class="n">isfinal</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">product</span> <span class="o">=</span> <span class="n">product</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&quot;product data: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">product</span><span class="p">)</span>
<span class="c"># NOTE: if you change isolabel, you need to change pungi to match, or</span>
<span class="c"># the pungi images won&#39;t boot.</span>
<span class="n">isolabel</span> <span class="o">=</span> <span class="n">volid</span> <span class="ow">or</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> </span><span class="si">%s</span><span class="s"> </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">product</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">product</span><span class="o">.</span><span class="n">version</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="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">isolabel</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">32</span><span class="p">:</span>
<span class="n">logger</span><span class="o">.</span><span class="n">fatal</span><span class="p">(</span><span class="s">&quot;the volume id cannot be longer than 32 characters&quot;</span><span class="p">)</span>
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="n">templatedir</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&quot;lorax&quot;</span><span class="p">,</span> <span class="s">&quot;sharedir&quot;</span><span class="p">)</span>
<span class="c"># NOTE: rb.root = ybo.conf.installroot (== self.inroot)</span>
<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="o">=</span><span class="bp">self</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="bp">self</span><span class="o">.</span><span class="n">arch</span><span class="p">,</span>
<span class="n">yum</span><span class="o">=</span><span class="n">ybo</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">installpkgs</span><span class="o">=</span><span class="n">installpkgs</span><span class="p">,</span>
<span class="n">add_templates</span><span class="o">=</span><span class="n">add_templates</span><span class="p">,</span>
<span class="n">add_template_vars</span><span class="o">=</span><span class="n">add_template_vars</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="s">&quot;installing runtime packages&quot;</span><span class="p">)</span>
<span class="n">rb</span><span class="o">.</span><span class="n">yum</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">skip_broken</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">getboolean</span><span class="p">(</span><span class="s">&quot;yum&quot;</span><span class="p">,</span> <span class="s">&quot;skipbroken&quot;</span><span class="p">)</span>
<span class="n">rb</span><span class="o">.</span><span class="n">install</span><span class="p">()</span>
<span class="c"># write .buildstamp</span>
<span class="n">buildstamp</span> <span class="o">=</span> <span class="n">BuildStamp</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">product</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">product</span><span class="o">.</span><span class="n">version</span><span class="p">,</span>
<span class="bp">self</span><span class="o">.</span><span class="n">product</span><span class="o">.</span><span class="n">bugurl</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">product</span><span class="o">.</span><span class="n">isfinal</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">buildarch</span><span class="p">)</span>
<span class="n">buildstamp</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">inroot</span><span class="p">,</span> <span class="s">&quot;.buildstamp&quot;</span><span class="p">))</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">debug</span><span class="p">:</span>
<span class="n">rb</span><span class="o">.</span><span class="n">writepkglists</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">logdir</span><span class="p">,</span> <span class="s">&quot;pkglists&quot;</span><span class="p">))</span>
<span class="n">rb</span><span class="o">.</span><span class="n">writepkgsizes</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">logdir</span><span class="p">,</span> <span class="s">&quot;original-pkgsizes.txt&quot;</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="s">&quot;doing post-install configuration&quot;</span><span class="p">)</span>
<span class="n">rb</span><span class="o">.</span><span class="n">postinstall</span><span class="p">()</span>
<span class="c"># write .discinfo</span>
<span class="n">discinfo</span> <span class="o">=</span> <span class="n">DiscInfo</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">product</span><span class="o">.</span><span class="n">release</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">discinfo</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">outputdir</span><span class="p">,</span> <span class="s">&quot;.discinfo&quot;</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="s">&quot;backing up installroot&quot;</span><span class="p">)</span>
<span class="n">installroot</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">workdir</span><span class="p">,</span> <span class="s">&quot;installroot&quot;</span><span class="p">)</span>
<span class="n">linktree</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">inroot</span><span class="p">,</span> <span class="n">installroot</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="s">&quot;generating kernel module metadata&quot;</span><span class="p">)</span>
<span class="n">rb</span><span class="o">.</span><span class="n">generate_module_data</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="s">&quot;cleaning unneeded files&quot;</span><span class="p">)</span>
<span class="n">rb</span><span class="o">.</span><span class="n">cleanup</span><span class="p">()</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">debug</span><span class="p">:</span>
<span class="n">rb</span><span class="o">.</span><span class="n">writepkgsizes</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">logdir</span><span class="p">,</span> <span class="s">&quot;final-pkgsizes.txt&quot;</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="s">&quot;creating the runtime image&quot;</span><span class="p">)</span>
<span class="n">runtime</span> <span class="o">=</span> <span class="s">&quot;images/install.img&quot;</span>
<span class="n">compression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&quot;compression&quot;</span><span class="p">,</span> <span class="s">&quot;type&quot;</span><span class="p">)</span>
<span class="n">compressargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&quot;compression&quot;</span><span class="p">,</span> <span class="s">&quot;args&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">conf</span><span class="o">.</span><span class="n">getboolean</span><span class="p">(</span><span class="s">&quot;compression&quot;</span><span class="p">,</span> <span class="s">&quot;bcj&quot;</span><span class="p">):</span>
<span class="k">if</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="n">compressargs</span> <span class="o">+=</span> <span class="p">[</span><span class="s">&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="s">&quot;no BCJ filter for arch </span><span class="si">%s</span><span class="s">&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">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;preparing to build output tree and boot images&quot;</span><span class="p">)</span>
<span class="n">treebuilder</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="bp">self</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="bp">self</span><span class="o">.</span><span class="n">arch</span><span class="p">,</span>
<span class="n">inroot</span><span class="o">=</span><span class="n">installroot</span><span class="p">,</span> <span class="n">outroot</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">outputdir</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">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">templatedir</span><span class="o">=</span><span class="n">templatedir</span><span class="p">,</span>
<span class="n">add_templates</span><span class="o">=</span><span class="n">add_arch_templates</span><span class="p">,</span>
<span class="n">add_template_vars</span><span class="o">=</span><span class="n">add_arch_template_vars</span><span class="p">,</span>
<span class="n">workdir</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">workdir</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="s">&quot;rebuilding initramfs images&quot;</span><span class="p">)</span>
<span class="n">dracut_args</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;--xz&quot;</span><span class="p">,</span> <span class="s">&quot;--install&quot;</span><span class="p">,</span> <span class="s">&quot;/.buildstamp&quot;</span><span class="p">,</span> <span class="s">&quot;--no-early-microcode&quot;</span><span class="p">,</span> <span class="s">&quot;--add&quot;</span><span class="p">,</span> <span class="s">&quot;fips&quot;</span><span class="p">]</span>
<span class="n">anaconda_args</span> <span class="o">=</span> <span class="n">dracut_args</span> <span class="o">+</span> <span class="p">[</span><span class="s">&quot;--add&quot;</span><span class="p">,</span> <span class="s">&quot;anaconda pollcdrom&quot;</span><span class="p">]</span>
<span class="c"># ppc64 cannot boot an initrd &gt; 32MiB so remove some drivers</span>
<span class="k">if</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="ow">in</span> <span class="p">(</span><span class="s">&quot;ppc64&quot;</span><span class="p">,</span> <span class="s">&quot;ppc64le&quot;</span><span class="p">):</span>
<span class="n">dracut_args</span><span class="o">.</span><span class="n">extend</span><span class="p">([</span><span class="s">&quot;--omit-drivers&quot;</span><span class="p">,</span> <span class="n">REMOVE_PPC64_DRIVERS</span><span class="p">])</span>
<span class="c"># Only omit dracut modules from the initrd so that they&#39;re kept for</span>
<span class="c"># upgrade.img</span>
<span class="n">anaconda_args</span><span class="o">.</span><span class="n">extend</span><span class="p">([</span><span class="s">&quot;--omit&quot;</span><span class="p">,</span> <span class="n">REMOVE_PPC64_MODULES</span><span class="p">])</span>
<span class="n">treebuilder</span><span class="o">.</span><span class="n">rebuild_initrds</span><span class="p">(</span><span class="n">add_args</span><span class="o">=</span><span class="n">anaconda_args</span><span class="p">)</span>
<span class="k">if</span> <span class="n">doupgrade</span><span class="p">:</span>
<span class="c"># Build upgrade.img. It&#39;d be nice if these could coexist in the same</span>
<span class="c"># image, but that would increase the size of the anaconda initramfs,</span>
<span class="c"># which worries some people (esp. PPC tftpboot). So they&#39;re separate.</span>
<span class="k">try</span><span class="p">:</span>
<span class="c"># If possible, use the &#39;redhat-upgrade-tool&#39; plymouth theme</span>
<span class="n">themes</span> <span class="o">=</span> <span class="n">runcmd_output</span><span class="p">([</span><span class="s">&#39;plymouth-set-default-theme&#39;</span><span class="p">,</span> <span class="s">&#39;--list&#39;</span><span class="p">],</span>
<span class="n">root</span><span class="o">=</span><span class="n">installroot</span><span class="p">)</span>
<span class="k">if</span> <span class="s">&#39;redhat-upgrade-tool&#39;</span> <span class="ow">in</span> <span class="n">themes</span><span class="o">.</span><span class="n">splitlines</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="s">&#39;PLYMOUTH_THEME_NAME&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;redhat-upgrade-tool&#39;</span>
<span class="k">except</span> <span class="ne">RuntimeError</span><span class="p">:</span>
<span class="k">pass</span>
<span class="n">upgrade_args</span> <span class="o">=</span> <span class="n">dracut_args</span> <span class="o">+</span> <span class="p">[</span><span class="s">&quot;--add&quot;</span><span class="p">,</span> <span class="s">&quot;system-upgrade convertfs&quot;</span><span class="p">]</span>
<span class="n">treebuilder</span><span class="o">.</span><span class="n">rebuild_initrds</span><span class="p">(</span><span class="n">add_args</span><span class="o">=</span><span class="n">upgrade_args</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s">&quot;upgrade&quot;</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="s">&quot;populating output tree and building boot images&quot;</span><span class="p">)</span>
<span class="n">treebuilder</span><span class="o">.</span><span class="n">build</span><span class="p">()</span>
<span class="c"># write .treeinfo file and we&#39;re done</span>
<span class="n">treeinfo</span> <span class="o">=</span> <span class="n">TreeInfo</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">product</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">product</span><span class="o">.</span><span class="n">version</span><span class="p">,</span>
<span class="bp">self</span><span class="o">.</span><span class="n">product</span><span class="o">.</span><span class="n">variant</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="k">for</span> <span class="n">section</span><span class="p">,</span> <span class="n">data</span> <span class="ow">in</span> <span class="n">treebuilder</span><span class="o">.</span><span class="n">treeinfo_data</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="n">treeinfo</span><span class="o">.</span><span class="n">add_section</span><span class="p">(</span><span class="n">section</span><span class="p">,</span> <span class="n">data</span><span class="p">)</span>
<span class="n">treeinfo</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">outputdir</span><span class="p">,</span> <span class="s">&quot;.treeinfo&quot;</span><span class="p">))</span>
<span class="c"># cleanup</span>
<span class="k">if</span> <span class="n">remove_temp</span><span class="p">:</span>
<span class="n">remove</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">workdir</span><span class="p">)</span>
</div></div>
<div class="viewcode-block" id="get_buildarch"><a class="viewcode-back" href="../../pylorax.html#pylorax.__init__.get_buildarch">[docs]</a><span class="k">def</span> <span class="nf">get_buildarch</span><span class="p">(</span><span class="n">ybo</span><span class="p">):</span>
<span class="c"># get architecture of the available anaconda package</span>
<span class="n">buildarch</span> <span class="o">=</span> <span class="bp">None</span>
<span class="k">for</span> <span class="n">anaconda</span> <span class="ow">in</span> <span class="n">ybo</span><span class="o">.</span><span class="n">doPackageLists</span><span class="p">(</span><span class="n">patterns</span><span class="o">=</span><span class="p">[</span><span class="s">&quot;anaconda&quot;</span><span class="p">])</span><span class="o">.</span><span class="n">available</span><span class="p">:</span>
<span class="k">if</span> <span class="n">anaconda</span><span class="o">.</span><span class="n">arch</span> <span class="o">!=</span> <span class="s">&quot;src&quot;</span><span class="p">:</span>
<span class="n">buildarch</span> <span class="o">=</span> <span class="n">anaconda</span><span class="o">.</span><span class="n">arch</span>
<span class="k">break</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">buildarch</span><span class="p">:</span>
<span class="n">logger</span><span class="o">.</span><span class="n">critical</span><span class="p">(</span><span class="s">&quot;no anaconda package in the repository&quot;</span><span class="p">)</span>
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="k">return</span> <span class="n">buildarch</span></div>
</pre></div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.11 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" >pylorax</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2018, Red Hat, Inc..
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.api &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.api &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../index.html" />
<link rel="up" title="pylorax" href="../pylorax.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" accesskey="U">pylorax</a> &raquo;</li>
</ul>
@ -103,7 +103,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" >pylorax</a> &raquo;</li>
</ul>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.api.compose &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.api.compose &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../../index.html" />
<link rel="up" title="pylorax.api" href="../api.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../pylorax.html" >pylorax</a> &raquo;</li>
<li><a href="../api.html" accesskey="U">pylorax.api</a> &raquo;</li>
@ -283,10 +283,9 @@
<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="c"># Combine modules and packages and depsolve the list</span>
<span class="c"># TODO include the version/glob in the depsolving</span>
<span class="n">module_names</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</span><span class="k">lambda</span> <span class="n">m</span><span class="p">:</span> <span class="n">m</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">],</span> <span class="n">recipe</span><span class="p">[</span><span class="s">&quot;modules&quot;</span><span class="p">]</span> <span class="ow">or</span> <span class="p">[])</span>
<span class="n">package_names</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</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="s">&quot;name&quot;</span><span class="p">],</span> <span class="n">recipe</span><span class="p">[</span><span class="s">&quot;packages&quot;</span><span class="p">]</span> <span class="ow">or</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_names</span><span class="o">+</span><span class="n">package_names</span><span class="p">),</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span><span class="o">.</span><span class="n">lower</span><span class="p">())</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">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="k">try</span><span class="p">:</span>
<span class="k">with</span> <span class="n">yumlock</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
@ -303,9 +302,10 @@
<span class="n">ks_version</span> <span class="o">=</span> <span class="n">makeVersion</span><span class="p">(</span><span class="n">RHEL7</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="bp">False</span><span class="p">,</span> <span class="n">missingIncludeIsFatal</span><span class="o">=</span><span class="bp">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">ks_template</span><span class="o">+</span><span class="s">&quot;</span><span class="se">\n</span><span class="si">%e</span><span class="s">nd</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">)</span>
<span class="n">pkgs</span> <span class="o">=</span> <span class="p">[(</span><span class="n">name</span><span class="p">,</span> <span class="s">&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="k">try</span><span class="p">:</span>
<span class="k">with</span> <span class="n">yumlock</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
<span class="p">(</span><span class="n">template_size</span><span class="p">,</span> <span class="n">_</span><span class="p">)</span> <span class="o">=</span> <span class="n">projects_depsolve_with_size</span><span class="p">(</span><span class="n">yumlock</span><span class="o">.</span><span class="n">yb</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">packages</span><span class="o">.</span><span class="n">packageList</span><span class="p">,</span>
<span class="p">(</span><span class="n">template_size</span><span class="p">,</span> <span class="n">_</span><span class="p">)</span> <span class="o">=</span> <span class="n">projects_depsolve_with_size</span><span class="p">(</span><span class="n">yumlock</span><span class="o">.</span><span class="n">yb</span><span class="p">,</span> <span class="n">pkgs</span><span class="p">,</span>
<span class="n">with_core</span><span class="o">=</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">packages</span><span class="o">.</span><span class="n">nocore</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">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&quot;start_build depsolve: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
@ -587,7 +587,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../pylorax.html" >pylorax</a> &raquo;</li>
<li><a href="../api.html" >pylorax.api</a> &raquo;</li>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.api.config &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.api.config &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../../index.html" />
<link rel="up" title="pylorax.api" href="../api.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../pylorax.html" >pylorax</a> &raquo;</li>
<li><a href="../api.html" accesskey="U">pylorax.api</a> &raquo;</li>
@ -97,9 +97,9 @@
<span class="n">conf</span><span class="o">.</span><span class="n">add_section</span><span class="p">(</span><span class="s">&quot;composer&quot;</span><span class="p">)</span>
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&quot;composer&quot;</span><span class="p">,</span> <span class="s">&quot;share_dir&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">realpath</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">root_dir</span><span class="p">,</span> <span class="s">&quot;/usr/share/lorax/&quot;</span><span class="p">)))</span>
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&quot;composer&quot;</span><span class="p">,</span> <span class="s">&quot;lib_dir&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">realpath</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">root_dir</span><span class="p">,</span> <span class="s">&quot;/var/lib/lorax/composer/&quot;</span><span class="p">)))</span>
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&quot;composer&quot;</span><span class="p">,</span> <span class="s">&quot;repo_dir&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">realpath</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">root_dir</span><span class="p">,</span> <span class="s">&quot;/var/lib/lorax/composer/repos.d/&quot;</span><span class="p">)))</span>
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&quot;composer&quot;</span><span class="p">,</span> <span class="s">&quot;yum_conf&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">realpath</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">root_dir</span><span class="p">,</span> <span class="s">&quot;/var/tmp/composer/yum.conf&quot;</span><span class="p">)))</span>
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&quot;composer&quot;</span><span class="p">,</span> <span class="s">&quot;yum_root&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">realpath</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">root_dir</span><span class="p">,</span> <span class="s">&quot;/var/tmp/composer/yum/root/&quot;</span><span class="p">)))</span>
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&quot;composer&quot;</span><span class="p">,</span> <span class="s">&quot;repo_dir&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">realpath</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">root_dir</span><span class="p">,</span> <span class="s">&quot;/var/tmp/composer/repos.d/&quot;</span><span class="p">)))</span>
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&quot;composer&quot;</span><span class="p">,</span> <span class="s">&quot;cache_dir&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">realpath</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">root_dir</span><span class="p">,</span> <span class="s">&quot;/var/tmp/composer/cache/&quot;</span><span class="p">)))</span>
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&quot;composer&quot;</span><span class="p">,</span> <span class="s">&quot;tmp&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">realpath</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">root_dir</span><span class="p">,</span> <span class="s">&quot;/var/tmp/&quot;</span><span class="p">)))</span>
@ -128,8 +128,11 @@
<span class="sd"> :returns: None</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&quot;yum_conf&quot;</span><span class="p">,</span> <span class="s">&quot;repo_dir&quot;</span><span class="p">,</span> <span class="s">&quot;cache_dir&quot;</span><span class="p">,</span> <span class="s">&quot;yum_root&quot;</span><span class="p">]:</span>
<span class="n">p_dir</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">conf</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&quot;composer&quot;</span><span class="p">,</span> <span class="n">p</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">p_dir</span><span class="p">):</span>
<span class="n">p_dir</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">conf</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&quot;composer&quot;</span><span class="p">,</span> <span class="n">p</span><span class="p">))</span>
<span class="k">if</span> <span class="n">p</span> <span class="o">==</span> <span class="s">&quot;yum_conf&quot;</span><span class="p">:</span>
<span class="n">p_dir</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">p_dir</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">p_dir</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">p_dir</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="make_queue_dirs"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.config.make_queue_dirs">[docs]</a><span class="k">def</span> <span class="nf">make_queue_dirs</span><span class="p">(</span><span class="n">conf</span><span class="p">,</span> <span class="n">gid</span><span class="p">):</span>
@ -194,7 +197,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../pylorax.html" >pylorax</a> &raquo;</li>
<li><a href="../api.html" >pylorax.api</a> &raquo;</li>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.api.crossdomain &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.api.crossdomain &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../../index.html" />
<link rel="up" title="pylorax.api" href="../api.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../pylorax.html" >pylorax</a> &raquo;</li>
<li><a href="../api.html" accesskey="U">pylorax.api</a> &raquo;</li>
@ -148,7 +148,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../pylorax.html" >pylorax</a> &raquo;</li>
<li><a href="../api.html" >pylorax.api</a> &raquo;</li>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.api.projects &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.api.projects &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../../index.html" />
<link rel="up" title="pylorax.api" href="../api.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../pylorax.html" >pylorax</a> &raquo;</li>
<li><a href="../api.html" accesskey="U">pylorax.api</a> &raquo;</li>
@ -70,6 +70,9 @@
<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="s">&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="kn">import</span> <span class="n">ConfigParser</span>
<span class="kn">from</span> <span class="nn">glob</span> <span class="kn">import</span> <span class="n">glob</span>
<span class="kn">import</span> <span class="nn">time</span>
<span class="kn">from</span> <span class="nn">yum.Errors</span> <span class="kn">import</span> <span class="n">YumBaseError</span>
@ -239,28 +242,31 @@
<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">yaps_to_project_info</span><span class="p">,</span> <span class="n">ybl</span><span class="o">.</span><span class="n">available</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="s">&quot;name&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
</div>
<div class="viewcode-block" id="projects_depsolve"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.projects_depsolve">[docs]</a><span class="k">def</span> <span class="nf">projects_depsolve</span><span class="p">(</span><span class="n">yb</span><span class="p">,</span> <span class="n">project_names</span><span class="p">):</span>
<div class="viewcode-block" id="projects_depsolve"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.projects_depsolve">[docs]</a><span class="k">def</span> <span class="nf">projects_depsolve</span><span class="p">(</span><span class="n">yb</span><span class="p">,</span> <span class="n">projects</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return the dependencies for a list of projects</span>
<span class="sd"> :param yb: yum base object</span>
<span class="sd"> :type yb: YumBase</span>
<span class="sd"> :param project_names: The projects to find the dependencies for</span>
<span class="sd"> :type project_names: List of Strings</span>
<span class="sd"> :param projects: The projects and version globs to find the dependencies for</span>
<span class="sd"> :type projects: List of tuples</span>
<span class="sd"> :returns: NEVRA&#39;s of the project and its dependencies</span>
<span class="sd"> :rtype: list of dicts</span>
<span class="sd"> :raises: ProjectsError if there was a problem installing something</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">try</span><span class="p">:</span>
<span class="c"># This resets the transaction</span>
<span class="n">yb</span><span class="o">.</span><span class="n">closeRpmDB</span><span class="p">()</span>
<span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">project_names</span><span class="p">:</span>
<span class="n">yb</span><span class="o">.</span><span class="n">install</span><span class="p">(</span><span class="n">pattern</span><span class="o">=</span><span class="n">p</span><span class="p">)</span>
<span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">version</span> <span class="ow">in</span> <span class="n">projects</span><span class="p">:</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">version</span><span class="p">:</span>
<span class="n">version</span> <span class="o">=</span> <span class="s">&quot;*&quot;</span>
<span class="n">yb</span><span class="o">.</span><span class="n">install</span><span class="p">(</span><span class="n">pattern</span><span class="o">=</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">-</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">version</span><span class="p">))</span>
<span class="p">(</span><span class="n">rc</span><span class="p">,</span> <span class="n">msg</span><span class="p">)</span> <span class="o">=</span> <span class="n">yb</span><span class="o">.</span><span class="n">buildTransaction</span><span class="p">()</span>
<span class="k">if</span> <span class="n">rc</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">]:</span>
<span class="k">raise</span> <span class="n">ProjectsError</span><span class="p">(</span><span class="s">&quot;There was a problem depsolving </span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">project_names</span><span class="p">,</span> <span class="n">msg</span><span class="p">))</span>
<span class="k">raise</span> <span class="n">ProjectsError</span><span class="p">(</span><span class="s">&quot;There was a problem depsolving </span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">projects</span><span class="p">,</span> <span class="n">msg</span><span class="p">))</span>
<span class="n">yb</span><span class="o">.</span><span class="n">tsInfo</span><span class="o">.</span><span class="n">makelists</span><span class="p">()</span>
<span class="n">deps</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="n">tm_to_dep</span><span class="p">,</span> <span class="n">yb</span><span class="o">.</span><span class="n">tsInfo</span><span class="o">.</span><span class="n">installed</span> <span class="o">+</span> <span class="n">yb</span><span class="o">.</span><span class="n">tsInfo</span><span class="o">.</span><span class="n">depinstalled</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="s">&quot;name&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
<span class="k">except</span> <span class="n">YumBaseError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">ProjectsError</span><span class="p">(</span><span class="s">&quot;There was a problem depsolving </span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">project_names</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="n">ProjectsError</span><span class="p">(</span><span class="s">&quot;There was a problem depsolving </span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">projects</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">finally</span><span class="p">:</span>
<span class="n">yb</span><span class="o">.</span><span class="n">closeRpmDB</span><span class="p">()</span>
<span class="k">return</span> <span class="n">deps</span>
@ -285,31 +291,34 @@
<span class="n">installed_size</span> <span class="o">+=</span> <span class="n">p</span><span class="o">.</span><span class="n">po</span><span class="o">.</span><span class="n">installedsize</span>
<span class="k">return</span> <span class="n">installed_size</span>
</div>
<div class="viewcode-block" id="projects_depsolve_with_size"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.projects_depsolve_with_size">[docs]</a><span class="k">def</span> <span class="nf">projects_depsolve_with_size</span><span class="p">(</span><span class="n">yb</span><span class="p">,</span> <span class="n">project_names</span><span class="p">,</span> <span class="n">with_core</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span>
<div class="viewcode-block" id="projects_depsolve_with_size"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.projects_depsolve_with_size">[docs]</a><span class="k">def</span> <span class="nf">projects_depsolve_with_size</span><span class="p">(</span><span class="n">yb</span><span class="p">,</span> <span class="n">projects</span><span class="p">,</span> <span class="n">with_core</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return the dependencies and installed size for a list of projects</span>
<span class="sd"> :param yb: yum base object</span>
<span class="sd"> :type yb: YumBase</span>
<span class="sd"> :param project_names: The projects to find the dependencies for</span>
<span class="sd"> :type project_names: List of Strings</span>
<span class="sd"> :param projects: The projects and version globs to find the dependencies for</span>
<span class="sd"> :type projects: List of tuples</span>
<span class="sd"> :returns: installed size and a list of NEVRA&#39;s of the project and its dependencies</span>
<span class="sd"> :rtype: tuple of (int, list of dicts)</span>
<span class="sd"> :raises: ProjectsError if there was a problem installing something</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">try</span><span class="p">:</span>
<span class="c"># This resets the transaction</span>
<span class="n">yb</span><span class="o">.</span><span class="n">closeRpmDB</span><span class="p">()</span>
<span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">project_names</span><span class="p">:</span>
<span class="n">yb</span><span class="o">.</span><span class="n">install</span><span class="p">(</span><span class="n">pattern</span><span class="o">=</span><span class="n">p</span><span class="p">)</span>
<span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">version</span> <span class="ow">in</span> <span class="n">projects</span><span class="p">:</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">version</span><span class="p">:</span>
<span class="n">version</span> <span class="o">=</span> <span class="s">&quot;*&quot;</span>
<span class="n">yb</span><span class="o">.</span><span class="n">install</span><span class="p">(</span><span class="n">pattern</span><span class="o">=</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">-</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">version</span><span class="p">))</span>
<span class="k">if</span> <span class="n">with_core</span><span class="p">:</span>
<span class="n">yb</span><span class="o">.</span><span class="n">selectGroup</span><span class="p">(</span><span class="s">&quot;core&quot;</span><span class="p">,</span> <span class="n">group_package_types</span><span class="o">=</span><span class="p">[</span><span class="s">&#39;mandatory&#39;</span><span class="p">,</span> <span class="s">&#39;default&#39;</span><span class="p">,</span> <span class="s">&#39;optional&#39;</span><span class="p">])</span>
<span class="p">(</span><span class="n">rc</span><span class="p">,</span> <span class="n">msg</span><span class="p">)</span> <span class="o">=</span> <span class="n">yb</span><span class="o">.</span><span class="n">buildTransaction</span><span class="p">()</span>
<span class="k">if</span> <span class="n">rc</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">]:</span>
<span class="k">raise</span> <span class="n">ProjectsError</span><span class="p">(</span><span class="s">&quot;There was a problem depsolving </span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">project_names</span><span class="p">,</span> <span class="n">msg</span><span class="p">))</span>
<span class="k">raise</span> <span class="n">ProjectsError</span><span class="p">(</span><span class="s">&quot;There was a problem depsolving </span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">projects</span><span class="p">,</span> <span class="n">msg</span><span class="p">))</span>
<span class="n">yb</span><span class="o">.</span><span class="n">tsInfo</span><span class="o">.</span><span class="n">makelists</span><span class="p">()</span>
<span class="n">installed_size</span> <span class="o">=</span> <span class="n">estimate_size</span><span class="p">(</span><span class="n">yb</span><span class="o">.</span><span class="n">tsInfo</span><span class="o">.</span><span class="n">installed</span> <span class="o">+</span> <span class="n">yb</span><span class="o">.</span><span class="n">tsInfo</span><span class="o">.</span><span class="n">depinstalled</span><span class="p">)</span>
<span class="n">deps</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="n">tm_to_dep</span><span class="p">,</span> <span class="n">yb</span><span class="o">.</span><span class="n">tsInfo</span><span class="o">.</span><span class="n">installed</span> <span class="o">+</span> <span class="n">yb</span><span class="o">.</span><span class="n">tsInfo</span><span class="o">.</span><span class="n">depinstalled</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="s">&quot;name&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
<span class="k">except</span> <span class="n">YumBaseError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">ProjectsError</span><span class="p">(</span><span class="s">&quot;There was a problem depsolving </span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">project_names</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="n">ProjectsError</span><span class="p">(</span><span class="s">&quot;There was a problem depsolving </span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">projects</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">finally</span><span class="p">:</span>
<span class="n">yb</span><span class="o">.</span><span class="n">closeRpmDB</span><span class="p">()</span>
<span class="k">return</span> <span class="p">(</span><span class="n">installed_size</span><span class="p">,</span> <span class="n">deps</span><span class="p">)</span>
@ -359,9 +368,223 @@
<span class="n">modules</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="n">yaps_to_project</span><span class="p">,</span> <span class="n">ybl</span><span class="o">.</span><span class="n">available</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="s">&quot;name&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
<span class="c"># Add the dependency info to each one</span>
<span class="k">for</span> <span class="n">module</span> <span class="ow">in</span> <span class="n">modules</span><span class="p">:</span>
<span class="n">module</span><span class="p">[</span><span class="s">&quot;dependencies&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">projects_depsolve</span><span class="p">(</span><span class="n">yb</span><span class="p">,</span> <span class="p">[</span><span class="n">module</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">]])</span>
<span class="n">module</span><span class="p">[</span><span class="s">&quot;dependencies&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">projects_depsolve</span><span class="p">(</span><span class="n">yb</span><span class="p">,</span> <span class="p">[(</span><span class="n">module</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">],</span> <span class="s">&quot;*&quot;</span><span class="p">)])</span>
<span class="k">return</span> <span class="n">modules</span></div>
<span class="k">return</span> <span class="n">modules</span>
</div>
<div class="viewcode-block" id="yum_repo_to_file_repo"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.yum_repo_to_file_repo">[docs]</a><span class="k">def</span> <span class="nf">yum_repo_to_file_repo</span><span class="p">(</span><span class="n">repo</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return a string representation of a repo dict suitable for writing to a .repo file</span>
<span class="sd"> :param repo: Yum Repository represented as a dict</span>
<span class="sd"> :type repo: dict</span>
<span class="sd"> :returns: A string</span>
<span class="sd"> :rtype: str</span>
<span class="sd"> The YumRepo.dump() function does not produce a string that can be used as a</span>
<span class="sd"> yum .repo file. So do this manually with only the attributes we care about.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">repo_str</span> <span class="o">=</span> <span class="s">&quot;[</span><span class="si">%s</span><span class="s">]</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">repo</span><span class="p">[</span><span class="s">&quot;id&quot;</span><span class="p">]</span>
<span class="k">if</span> <span class="n">repo</span><span class="p">[</span><span class="s">&quot;metalink&quot;</span><span class="p">]:</span>
<span class="n">repo_str</span> <span class="o">+=</span> <span class="s">&quot;metalink = </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">repo</span><span class="p">[</span><span class="s">&quot;metalink&quot;</span><span class="p">]</span>
<span class="k">elif</span> <span class="n">repo</span><span class="p">[</span><span class="s">&quot;mirrorlist&quot;</span><span class="p">]:</span>
<span class="n">repo_str</span> <span class="o">+=</span> <span class="s">&quot;mirrorlist = </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">repo</span><span class="p">[</span><span class="s">&quot;mirrorlist&quot;</span><span class="p">]</span>
<span class="k">elif</span> <span class="n">repo</span><span class="p">[</span><span class="s">&quot;baseurl&quot;</span><span class="p">]:</span>
<span class="n">repo_str</span> <span class="o">+=</span> <span class="s">&quot;baseurl = </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">repo</span><span class="p">[</span><span class="s">&quot;baseurl&quot;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s">&quot;Repo has no baseurl, metalink, or mirrorlist&quot;</span><span class="p">)</span>
<span class="c"># proxy is optional</span>
<span class="k">if</span> <span class="s">&quot;proxy&quot;</span> <span class="ow">in</span> <span class="n">repo</span><span class="p">:</span>
<span class="n">repo_str</span> <span class="o">+=</span> <span class="s">&quot;proxy = </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">repo</span><span class="p">[</span><span class="s">&quot;proxy&quot;</span><span class="p">]</span>
<span class="n">repo_str</span> <span class="o">+=</span> <span class="s">&quot;sslverify = </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">repo</span><span class="p">[</span><span class="s">&quot;sslverify&quot;</span><span class="p">]</span>
<span class="n">repo_str</span> <span class="o">+=</span> <span class="s">&quot;gpgcheck = </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">repo</span><span class="p">[</span><span class="s">&quot;gpgcheck&quot;</span><span class="p">]</span>
<span class="k">if</span> <span class="s">&quot;gpgkey&quot;</span> <span class="ow">in</span> <span class="n">repo</span><span class="p">:</span>
<span class="n">repo_str</span> <span class="o">+=</span> <span class="s">&quot;gpgkey = </span><span class="si">%s</span><span class="se">\n</span><span class="s">&quot;</span> <span class="o">%</span> <span class="s">&quot;,&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">repo</span><span class="p">[</span><span class="s">&quot;gpgkey&quot;</span><span class="p">])</span>
<span class="k">return</span> <span class="n">repo_str</span>
</div>
<div class="viewcode-block" id="repo_to_source"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.repo_to_source">[docs]</a><span class="k">def</span> <span class="nf">repo_to_source</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="n">system_source</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return a Weldr Source dict created from the YumRepository</span>
<span class="sd"> :param repo: Yum Repository</span>
<span class="sd"> :type repo: yum.yumRepo.YumRepository</span>
<span class="sd"> :param system_source: True if this source is an immutable system source</span>
<span class="sd"> :type system_source: bool</span>
<span class="sd"> :returns: A dict with Weldr Source fields filled in</span>
<span class="sd"> :rtype: dict</span>
<span class="sd"> Example::</span>
<span class="sd"> {</span>
<span class="sd"> &quot;check_gpg&quot;: true,</span>
<span class="sd"> &quot;check_ssl&quot;: true,</span>
<span class="sd"> &quot;gpgkey_url&quot;: [</span>
<span class="sd"> &quot;file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-28-x86_64&quot;</span>
<span class="sd"> ],</span>
<span class="sd"> &quot;name&quot;: &quot;fedora&quot;,</span>
<span class="sd"> &quot;proxy&quot;: &quot;http://proxy.brianlane.com:8123&quot;,</span>
<span class="sd"> &quot;system&quot;: true</span>
<span class="sd"> &quot;type&quot;: &quot;yum-metalink&quot;,</span>
<span class="sd"> &quot;url&quot;: &quot;https://mirrors.fedoraproject.org/metalink?repo=fedora-28&amp;arch=x86_64&quot;</span>
<span class="sd"> }</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">source</span> <span class="o">=</span> <span class="p">{</span><span class="s">&quot;name&quot;</span><span class="p">:</span> <span class="n">repo</span><span class="o">.</span><span class="n">id</span><span class="p">,</span> <span class="s">&quot;system&quot;</span><span class="p">:</span> <span class="n">system_source</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="n">source</span><span class="p">[</span><span class="s">&quot;url&quot;</span><span class="p">]</span> <span class="o">=</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">source</span><span class="p">[</span><span class="s">&quot;type&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;yum-baseurl&quot;</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="n">source</span><span class="p">[</span><span class="s">&quot;url&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">repo</span><span class="o">.</span><span class="n">metalink</span>
<span class="n">source</span><span class="p">[</span><span class="s">&quot;type&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;yum-metalink&quot;</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="n">source</span><span class="p">[</span><span class="s">&quot;url&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">repo</span><span class="o">.</span><span class="n">mirrorlist</span>
<span class="n">source</span><span class="p">[</span><span class="s">&quot;type&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;yum-mirrorlist&quot;</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s">&quot;Repo has no baseurl, metalink, or mirrorlist&quot;</span><span class="p">)</span>
<span class="c"># proxy is optional</span>
<span class="k">if</span> <span class="n">repo</span><span class="o">.</span><span class="n">proxy</span><span class="p">:</span>
<span class="n">source</span><span class="p">[</span><span class="s">&quot;proxy&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">repo</span><span class="o">.</span><span class="n">proxy</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">repo</span><span class="o">.</span><span class="n">sslverify</span><span class="p">:</span>
<span class="n">source</span><span class="p">[</span><span class="s">&quot;check_ssl&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">False</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">source</span><span class="p">[</span><span class="s">&quot;check_ssl&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">repo</span><span class="o">.</span><span class="n">gpgcheck</span><span class="p">:</span>
<span class="n">source</span><span class="p">[</span><span class="s">&quot;check_gpg&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">False</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">source</span><span class="p">[</span><span class="s">&quot;check_gpg&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>
<span class="k">if</span> <span class="n">repo</span><span class="o">.</span><span class="n">gpgkey</span><span class="p">:</span>
<span class="n">source</span><span class="p">[</span><span class="s">&quot;gpgkey_urls&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">repo</span><span class="o">.</span><span class="n">gpgkey</span>
<span class="k">return</span> <span class="n">source</span>
</div>
<div class="viewcode-block" id="source_to_repo"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.source_to_repo">[docs]</a><span class="k">def</span> <span class="nf">source_to_repo</span><span class="p">(</span><span class="n">source</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return an add_enable_repo kwargs dict created from a source dict</span>
<span class="sd"> :param source: A Weldr source dict</span>
<span class="sd"> :type source: dict</span>
<span class="sd"> :returns: A yum YumRepository object</span>
<span class="sd"> :rtype: yum.yumRepo.YumRepository</span>
<span class="sd"> The dict it suitable for passing to yum&#39;s add_enable_repo function</span>
<span class="sd"> after popping off baseurl and mirrorlist.</span>
<span class="sd"> Example::</span>
<span class="sd"> {</span>
<span class="sd"> &quot;gpgcheck&quot;: True,</span>
<span class="sd"> &quot;sslverify&quot;: True,</span>
<span class="sd"> &quot;gpgkey&quot;: [&quot;file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-28-x86_64&quot;],</span>
<span class="sd"> &quot;id&quot;: &quot;fedora&quot;,</span>
<span class="sd"> &quot;proxy&quot;: &quot;http://proxy.brianlane.com:8123&quot;,</span>
<span class="sd"> &quot;baseurl&quot;: &quot;https://mirrors.fedoraproject.org/metalink?repo=fedora-28&amp;arch=x86_64&quot;,</span>
<span class="sd"> &quot;metalink&quot;: None,</span>
<span class="sd"> &quot;mirrorlist&quot;: None</span>
<span class="sd"> }</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">repo</span> <span class="o">=</span> <span class="p">{</span><span class="s">&quot;id&quot;</span><span class="p">:</span> <span class="n">source</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">]}</span>
<span class="c"># This will allow errors to be raised so we can catch them</span>
<span class="c"># without this they are logged, but the repo is silently disabled</span>
<span class="n">repo</span><span class="p">[</span><span class="s">&quot;skip_if_unavailable&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">False</span>
<span class="k">if</span> <span class="n">source</span><span class="p">[</span><span class="s">&quot;type&quot;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;yum-baseurl&quot;</span><span class="p">:</span>
<span class="n">repo</span><span class="p">[</span><span class="s">&quot;baseurl&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="n">source</span><span class="p">[</span><span class="s">&quot;url&quot;</span><span class="p">]]</span>
<span class="n">repo</span><span class="p">[</span><span class="s">&quot;metalink&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">None</span>
<span class="n">repo</span><span class="p">[</span><span class="s">&quot;mirrorlist&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">None</span>
<span class="k">elif</span> <span class="n">source</span><span class="p">[</span><span class="s">&quot;type&quot;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;yum-metalink&quot;</span><span class="p">:</span>
<span class="n">repo</span><span class="p">[</span><span class="s">&quot;metalink&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">source</span><span class="p">[</span><span class="s">&quot;url&quot;</span><span class="p">]</span>
<span class="n">repo</span><span class="p">[</span><span class="s">&quot;baseurl&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">repo</span><span class="p">[</span><span class="s">&quot;mirrorlist&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">None</span>
<span class="k">elif</span> <span class="n">source</span><span class="p">[</span><span class="s">&quot;type&quot;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;yum-mirrorlist&quot;</span><span class="p">:</span>
<span class="n">repo</span><span class="p">[</span><span class="s">&quot;mirrorlist&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">source</span><span class="p">[</span><span class="s">&quot;url&quot;</span><span class="p">]</span>
<span class="n">repo</span><span class="p">[</span><span class="s">&quot;baseurl&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">repo</span><span class="p">[</span><span class="s">&quot;metalink&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">None</span>
<span class="k">if</span> <span class="s">&quot;proxy&quot;</span> <span class="ow">in</span> <span class="n">source</span><span class="p">:</span>
<span class="n">repo</span><span class="p">[</span><span class="s">&quot;proxy&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">source</span><span class="p">[</span><span class="s">&quot;proxy&quot;</span><span class="p">]</span>
<span class="k">if</span> <span class="n">source</span><span class="p">[</span><span class="s">&quot;check_ssl&quot;</span><span class="p">]:</span>
<span class="n">repo</span><span class="p">[</span><span class="s">&quot;sslverify&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">repo</span><span class="p">[</span><span class="s">&quot;sslverify&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">False</span>
<span class="k">if</span> <span class="n">source</span><span class="p">[</span><span class="s">&quot;check_gpg&quot;</span><span class="p">]:</span>
<span class="n">repo</span><span class="p">[</span><span class="s">&quot;gpgcheck&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">repo</span><span class="p">[</span><span class="s">&quot;gpgcheck&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">False</span>
<span class="k">if</span> <span class="s">&quot;gpgkey_urls&quot;</span> <span class="ow">in</span> <span class="n">source</span><span class="p">:</span>
<span class="n">repo</span><span class="p">[</span><span class="s">&quot;gpgkey&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">source</span><span class="p">[</span><span class="s">&quot;gpgkey_urls&quot;</span><span class="p">]</span>
<span class="k">return</span> <span class="n">repo</span>
</div>
<div class="viewcode-block" id="get_source_ids"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.get_source_ids">[docs]</a><span class="k">def</span> <span class="nf">get_source_ids</span><span class="p">(</span><span class="n">source_path</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return a list of the source ids in a file</span>
<span class="sd"> :param source_path: Full path and filename of the source (yum repo) file</span>
<span class="sd"> :type source_path: str</span>
<span class="sd"> :returns: A list of source id strings</span>
<span class="sd"> :rtype: list of str</span>
<span class="sd"> &quot;&quot;&quot;</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">source_path</span><span class="p">):</span>
<span class="k">return</span> <span class="p">[]</span>
<span class="n">cfg</span> <span class="o">=</span> <span class="n">ConfigParser</span><span class="p">()</span>
<span class="n">cfg</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="n">source_path</span><span class="p">)</span>
<span class="k">return</span> <span class="n">cfg</span><span class="o">.</span><span class="n">sections</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="get_repo_sources"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.get_repo_sources">[docs]</a><span class="k">def</span> <span class="nf">get_repo_sources</span><span class="p">(</span><span class="n">source_glob</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return a list of sources from a directory of yum repositories</span>
<span class="sd"> :param source_glob: A glob to use to match the source files, including full path</span>
<span class="sd"> :type source_glob: str</span>
<span class="sd"> :returns: A list of the source ids in all of the matching files</span>
<span class="sd"> :rtype: list of str</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">sources</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="n">glob</span><span class="p">(</span><span class="n">source_glob</span><span class="p">):</span>
<span class="n">sources</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">get_source_ids</span><span class="p">(</span><span class="n">f</span><span class="p">))</span>
<span class="k">return</span> <span class="n">sources</span>
</div>
<div class="viewcode-block" id="delete_repo_source"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.projects.delete_repo_source">[docs]</a><span class="k">def</span> <span class="nf">delete_repo_source</span><span class="p">(</span><span class="n">source_glob</span><span class="p">,</span> <span class="n">source_name</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Delete a source from a repo file</span>
<span class="sd"> :param source_glob: A glob of the repo sources to search</span>
<span class="sd"> :type source_glob: str</span>
<span class="sd"> :returns: None</span>
<span class="sd"> :raises: ProjectsError if there was a problem</span>
<span class="sd"> A repo file may have multiple sources in it, delete only the selected source.</span>
<span class="sd"> If it is the last one in the file, delete the file.</span>
<span class="sd"> WARNING: This will delete ANY source, the caller needs to ensure that a system</span>
<span class="sd"> source_name isn&#39;t passed to it.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">found</span> <span class="o">=</span> <span class="bp">False</span>
<span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="n">glob</span><span class="p">(</span><span class="n">source_glob</span><span class="p">):</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">cfg</span> <span class="o">=</span> <span class="n">ConfigParser</span><span class="p">()</span>
<span class="n">cfg</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="n">f</span><span class="p">)</span>
<span class="k">if</span> <span class="n">source_name</span> <span class="ow">in</span> <span class="n">cfg</span><span class="o">.</span><span class="n">sections</span><span class="p">():</span>
<span class="n">found</span> <span class="o">=</span> <span class="bp">True</span>
<span class="n">cfg</span><span class="o">.</span><span class="n">remove_section</span><span class="p">(</span><span class="n">source_name</span><span class="p">)</span>
<span class="c"># If there are other sections, rewrite the file without the deleted one</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">sections</span><span class="p">())</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="s">&quot;w&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">cfg_file</span><span class="p">:</span>
<span class="n">cfg</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">cfg_file</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="c"># No sections left, just delete the file</span>
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">f</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="k">raise</span> <span class="n">ProjectsError</span><span class="p">(</span><span class="s">&quot;Problem deleting repo source </span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">source_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="k">if</span> <span class="ow">not</span> <span class="n">found</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">ProjectsError</span><span class="p">(</span><span class="s">&quot;source </span><span class="si">%s</span><span class="s"> not found&quot;</span> <span class="o">%</span> <span class="n">source_name</span><span class="p">)</span></div>
</pre></div>
</div>
@ -395,7 +618,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../pylorax.html" >pylorax</a> &raquo;</li>
<li><a href="../api.html" >pylorax.api</a> &raquo;</li>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.api.queue &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.api.queue &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../../index.html" />
<link rel="up" title="pylorax.api" href="../api.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../pylorax.html" >pylorax</a> &raquo;</li>
<li><a href="../api.html" accesskey="U">pylorax.api</a> &raquo;</li>
@ -142,7 +142,7 @@
<span class="c"># Pick the oldest and move it into ./run/</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">uuids</span><span class="p">:</span>
<span class="c"># No composes left to process, sleep for a bit</span>
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">30</span><span class="p">)</span>
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="k">else</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="s">&quot;queue/new&quot;</span><span class="p">,</span> <span class="n">uuids</span><span class="p">[</span><span class="mi">0</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="s">&quot;queue/run&quot;</span><span class="p">,</span> <span class="n">uuids</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
@ -245,7 +245,7 @@
<span class="n">test_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="s">&quot;TEST&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">test_path</span><span class="p">):</span>
<span class="c"># Pretend to run the compose</span>
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">test_mode</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="nb">open</span><span class="p">(</span><span class="n">test_path</span><span class="p">,</span> <span class="s">&quot;r&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">())</span>
<span class="k">except</span> <span class="ne">Exception</span><span class="p">:</span>
@ -696,7 +696,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../pylorax.html" >pylorax</a> &raquo;</li>
<li><a href="../api.html" >pylorax.api</a> &raquo;</li>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.api.recipes &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.api.recipes &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../../index.html" />
<link rel="up" title="pylorax.api" href="../api.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../pylorax.html" >pylorax</a> &raquo;</li>
<li><a href="../api.html" accesskey="U">pylorax.api</a> &raquo;</li>
@ -127,11 +127,21 @@
<span class="k">return</span> <span class="nb">map</span><span class="p">(</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="s">&quot;name&quot;</span><span class="p">],</span> <span class="bp">self</span><span class="p">[</span><span class="s">&quot;packages&quot;</span><span class="p">]</span> <span class="ow">or</span> <span class="p">[])</span>
</div>
<span class="nd">@property</span>
<div class="viewcode-block" id="Recipe.package_nver"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.recipes.Recipe.package_nver">[docs]</a> <span class="k">def</span> <span class="nf">package_nver</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return the names and versions of the packages&quot;&quot;&quot;</span>
<span class="k">return</span> <span class="p">[(</span><span class="n">p</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">],</span> <span class="n">p</span><span class="p">[</span><span class="s">&quot;version&quot;</span><span class="p">])</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="bp">self</span><span class="p">[</span><span class="s">&quot;packages&quot;</span><span class="p">]</span> <span class="ow">or</span> <span class="p">[]]</span>
</div>
<span class="nd">@property</span>
<div class="viewcode-block" id="Recipe.module_names"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.recipes.Recipe.module_names">[docs]</a> <span class="k">def</span> <span class="nf">module_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 modules&quot;&quot;&quot;</span>
<span class="k">return</span> <span class="nb">map</span><span class="p">(</span><span class="k">lambda</span> <span class="n">m</span><span class="p">:</span> <span class="n">m</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">],</span> <span class="bp">self</span><span class="p">[</span><span class="s">&quot;modules&quot;</span><span class="p">]</span> <span class="ow">or</span> <span class="p">[])</span>
</div>
<span class="nd">@property</span>
<div class="viewcode-block" id="Recipe.module_nver"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.recipes.Recipe.module_nver">[docs]</a> <span class="k">def</span> <span class="nf">module_nver</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return the names and versions of the modules&quot;&quot;&quot;</span>
<span class="k">return</span> <span class="p">[(</span><span class="n">m</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">],</span> <span class="n">m</span><span class="p">[</span><span class="s">&quot;version&quot;</span><span class="p">])</span> <span class="k">for</span> <span class="n">m</span> <span class="ow">in</span> <span class="bp">self</span><span class="p">[</span><span class="s">&quot;modules&quot;</span><span class="p">]</span> <span class="ow">or</span> <span class="p">[]]</span>
</div>
<span class="nd">@property</span>
<div class="viewcode-block" id="Recipe.filename"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.recipes.Recipe.filename">[docs]</a> <span class="k">def</span> <span class="nf">filename</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return the Recipe&#39;s filename</span>
@ -777,7 +787,6 @@
<span class="sd"> :raises: Can raise errors from Ggit</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">revwalk</span> <span class="o">=</span> <span class="n">Git</span><span class="o">.</span><span class="n">RevisionWalker</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">repo</span><span class="p">)</span>
<span class="n">revwalk</span><span class="o">.</span><span class="n">set_sort_mode</span><span class="p">(</span><span class="n">Git</span><span class="o">.</span><span class="n">SortMode</span><span class="o">.</span><span class="n">TIME</span><span class="p">)</span>
<span class="n">branch_ref</span> <span class="o">=</span> <span class="s">&quot;refs/heads/</span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">branch</span>
<span class="n">revwalk</span><span class="o">.</span><span class="n">push_ref</span><span class="p">(</span><span class="n">branch_ref</span><span class="p">)</span>
@ -976,7 +985,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../pylorax.html" >pylorax</a> &raquo;</li>
<li><a href="../api.html" >pylorax.api</a> &raquo;</li>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.api.server &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.api.server &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../../index.html" />
<link rel="up" title="pylorax.api" href="../api.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../pylorax.html" >pylorax</a> &raquo;</li>
<li><a href="../api.html" accesskey="U">pylorax.api</a> &raquo;</li>
@ -161,7 +161,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../pylorax.html" >pylorax</a> &raquo;</li>
<li><a href="../api.html" >pylorax.api</a> &raquo;</li>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.api.v0 &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.api.v0 &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../../index.html" />
<link rel="up" title="pylorax.api" href="../api.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../pylorax.html" >pylorax</a> &raquo;</li>
<li><a href="../api.html" accesskey="U">pylorax.api</a> &raquo;</li>
@ -554,6 +554,94 @@
<span class="sd"> ]</span>
<span class="sd"> }</span>
<span class="sd">`/api/v0/projects/source/list`</span>
<span class="sd">^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</span>
<span class="sd"> Return the list of repositories used for depsolving and installing packages.</span>
<span class="sd"> Example::</span>
<span class="sd"> {</span>
<span class="sd"> &quot;sources&quot;: [</span>
<span class="sd"> &quot;fedora&quot;,</span>
<span class="sd"> &quot;fedora-cisco-openh264&quot;,</span>
<span class="sd"> &quot;fedora-updates-testing&quot;,</span>
<span class="sd"> &quot;fedora-updates&quot;</span>
<span class="sd"> ]</span>
<span class="sd"> }</span>
<span class="sd">`/api/v0/projects/source/info/&lt;source-names&gt;`</span>
<span class="sd">^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</span>
<span class="sd"> Return information about the comma-separated list of source names. Or all of the</span>
<span class="sd"> sources if &#39;*&#39; is passed. Note that general globbing is not supported, only &#39;*&#39;.</span>
<span class="sd"> immutable system sources will have the &quot;system&quot; field set to true. User added sources</span>
<span class="sd"> will have it set to false. System sources cannot be changed or deleted.</span>
<span class="sd"> Example::</span>
<span class="sd"> {</span>
<span class="sd"> &quot;errors&quot;: [],</span>
<span class="sd"> &quot;sources&quot;: {</span>
<span class="sd"> &quot;fedora&quot;: {</span>
<span class="sd"> &quot;check_gpg&quot;: true,</span>
<span class="sd"> &quot;check_ssl&quot;: true,</span>
<span class="sd"> &quot;gpgkey_urls&quot;: [</span>
<span class="sd"> &quot;file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-28-x86_64&quot;</span>
<span class="sd"> ],</span>
<span class="sd"> &quot;name&quot;: &quot;fedora&quot;,</span>
<span class="sd"> &quot;proxy&quot;: &quot;http://proxy.brianlane.com:8123&quot;,</span>
<span class="sd"> &quot;system&quot;: true,</span>
<span class="sd"> &quot;type&quot;: &quot;yum-metalink&quot;,</span>
<span class="sd"> &quot;url&quot;: &quot;https://mirrors.fedoraproject.org/metalink?repo=fedora-28&amp;arch=x86_64&quot;</span>
<span class="sd"> }</span>
<span class="sd"> }</span>
<span class="sd"> }</span>
<span class="sd">POST `/api/v0/projects/source/new`</span>
<span class="sd">^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</span>
<span class="sd"> Add (or change) a source for use when depsolving blueprints and composing images.</span>
<span class="sd"> The ``proxy`` and ``gpgkey_urls`` entries are optional. All of the others are required. The supported</span>
<span class="sd"> types for the urls are:</span>
<span class="sd"> * ``yum-baseurl`` is a URL to a yum repository.</span>
<span class="sd"> * ``yum-mirrorlist`` is a URL for a mirrorlist.</span>
<span class="sd"> * ``yum-metalink`` is a URL for a metalink.</span>
<span class="sd"> If ``check_ssl`` is true the https certificates must be valid. If they are self-signed you can either set</span>
<span class="sd"> this to false, or add your Certificate Authority to the host system.</span>
<span class="sd"> If ``check_gpg`` is true the GPG key must either be installed on the host system, or ``gpgkey_urls``</span>
<span class="sd"> should point to it.</span>
<span class="sd"> You can edit an existing source (other than system sources), by doing a POST</span>
<span class="sd"> of the new version of the source. It will overwrite the previous one.</span>
<span class="sd"> Example::</span>
<span class="sd"> {</span>
<span class="sd"> &quot;name&quot;: &quot;custom-source-1&quot;,</span>
<span class="sd"> &quot;url&quot;: &quot;https://url/path/to/repository/&quot;,</span>
<span class="sd"> &quot;type&quot;: &quot;yum-baseurl&quot;,</span>
<span class="sd"> &quot;check_ssl&quot;: true,</span>
<span class="sd"> &quot;check_gpg&quot;: true,</span>
<span class="sd"> &quot;gpgkey_urls&quot;: [</span>
<span class="sd"> &quot;https://url/path/to/gpg-key&quot;</span>
<span class="sd"> ]</span>
<span class="sd"> }</span>
<span class="sd">DELETE `/api/v0/projects/source/delete/&lt;source-name&gt;`</span>
<span class="sd">^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</span>
<span class="sd"> Delete a user added source. This will fail if a system source is passed to</span>
<span class="sd"> it.</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>
<span class="sd">`/api/v0/modules/list[?offset=0&amp;limit=20]`</span>
<span class="sd">^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</span>
@ -931,17 +1019,21 @@
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">from</span> <span class="nn">flask</span> <span class="kn">import</span> <span class="n">jsonify</span><span class="p">,</span> <span class="n">request</span><span class="p">,</span> <span class="n">Response</span><span class="p">,</span> <span class="n">send_file</span>
<span class="kn">import</span> <span class="nn">pytoml</span> <span class="kn">as</span> <span class="nn">toml</span>
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="kn">import</span> <span class="n">joinpaths</span>
<span class="kn">from</span> <span class="nn">pylorax.api.compose</span> <span class="kn">import</span> <span class="n">start_build</span><span class="p">,</span> <span class="n">compose_types</span>
<span class="kn">from</span> <span class="nn">pylorax.api.crossdomain</span> <span class="kn">import</span> <span class="n">crossdomain</span>
<span class="kn">from</span> <span class="nn">pylorax.api.projects</span> <span class="kn">import</span> <span class="n">projects_list</span><span class="p">,</span> <span class="n">projects_info</span><span class="p">,</span> <span class="n">projects_depsolve</span>
<span class="kn">from</span> <span class="nn">pylorax.api.projects</span> <span class="kn">import</span> <span class="n">modules_list</span><span class="p">,</span> <span class="n">modules_info</span><span class="p">,</span> <span class="n">ProjectsError</span>
<span class="kn">from</span> <span class="nn">pylorax.api.projects</span> <span class="kn">import</span> <span class="n">modules_list</span><span class="p">,</span> <span class="n">modules_info</span><span class="p">,</span> <span class="n">ProjectsError</span><span class="p">,</span> <span class="n">repo_to_source</span>
<span class="kn">from</span> <span class="nn">pylorax.api.projects</span> <span class="kn">import</span> <span class="n">get_repo_sources</span><span class="p">,</span> <span class="n">delete_repo_source</span><span class="p">,</span> <span class="n">source_to_repo</span><span class="p">,</span> <span class="n">yum_repo_to_file_repo</span>
<span class="kn">from</span> <span class="nn">pylorax.api.queue</span> <span class="kn">import</span> <span class="n">queue_status</span><span class="p">,</span> <span class="n">build_status</span><span class="p">,</span> <span class="n">uuid_delete</span><span class="p">,</span> <span class="n">uuid_status</span><span class="p">,</span> <span class="n">uuid_info</span>
<span class="kn">from</span> <span class="nn">pylorax.api.queue</span> <span class="kn">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="kn">import</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="kn">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="kn">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.workspace</span> <span class="kn">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>
<span class="kn">from</span> <span class="nn">pylorax.api.yumbase</span> <span class="kn">import</span> <span class="n">update_metadata</span>
<span class="c"># The API functions don&#39;t actually get called by any code here</span>
<span class="c"># pylint: disable=unused-variable</span>
@ -1234,9 +1326,9 @@
<span class="c"># Combine modules and packages and depsolve the list</span>
<span class="c"># TODO include the version/glob in the depsolving</span>
<span class="n">module_names</span> <span class="o">=</span> <span class="n">blueprint</span><span class="o">.</span><span class="n">module_names</span>
<span class="n">package_names</span> <span class="o">=</span> <span class="n">blueprint</span><span class="o">.</span><span class="n">package_names</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_names</span><span class="o">+</span><span class="n">package_names</span><span class="p">),</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
<span class="n">module_nver</span> <span class="o">=</span> <span class="n">blueprint</span><span class="o">.</span><span class="n">module_nver</span>
<span class="n">package_nver</span> <span class="o">=</span> <span class="n">blueprint</span><span class="o">.</span><span class="n">package_nver</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="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="s">&quot;YUMLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
@ -1285,10 +1377,9 @@
<span class="k">continue</span>
<span class="c"># Combine modules and packages and depsolve the list</span>
<span class="c"># TODO include the version/glob in the depsolving</span>
<span class="n">module_names</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</span><span class="k">lambda</span> <span class="n">m</span><span class="p">:</span> <span class="n">m</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">],</span> <span class="n">blueprint</span><span class="p">[</span><span class="s">&quot;modules&quot;</span><span class="p">]</span> <span class="ow">or</span> <span class="p">[])</span>
<span class="n">package_names</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</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="s">&quot;name&quot;</span><span class="p">],</span> <span class="n">blueprint</span><span class="p">[</span><span class="s">&quot;packages&quot;</span><span class="p">]</span> <span class="ow">or</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_names</span><span class="o">+</span><span class="n">package_names</span><span class="p">),</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
<span class="n">module_nver</span> <span class="o">=</span> <span class="n">blueprint</span><span class="o">.</span><span class="n">module_nver</span>
<span class="n">package_nver</span> <span class="o">=</span> <span class="n">blueprint</span><span class="o">.</span><span class="n">package_nver</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="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="s">&quot;YUMLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
@ -1347,13 +1438,146 @@
<span class="sd">&quot;&quot;&quot;Return detailed information about the listed projects&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="s">&quot;YUMLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
<span class="n">deps</span> <span class="o">=</span> <span class="n">projects_depsolve</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="s">&quot;YUMLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">yb</span><span class="p">,</span> <span class="n">project_names</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;,&quot;</span><span class="p">))</span>
<span class="n">deps</span> <span class="o">=</span> <span class="n">projects_depsolve</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="s">&quot;YUMLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">yb</span><span class="p">,</span> <span class="p">[(</span><span class="n">n</span><span class="p">,</span> <span class="s">&quot;*&quot;</span><span class="p">)</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">project_names</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;,&quot;</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">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&quot;(v0_projects_depsolve) </span><span class="si">%s</span><span class="s">&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="bp">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</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">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">projects</span><span class="o">=</span><span class="n">deps</span><span class="p">)</span>
<span class="nd">@api.route</span><span class="p">(</span><span class="s">&quot;/api/v0/projects/source/list&quot;</span><span class="p">)</span>
<span class="nd">@crossdomain</span><span class="p">(</span><span class="n">origin</span><span class="o">=</span><span class="s">&quot;*&quot;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">v0_projects_source_list</span><span class="p">():</span>
<span class="sd">&quot;&quot;&quot;Return the list of source names&quot;&quot;&quot;</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="s">&quot;YUMLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
<span class="n">repos</span> <span class="o">=</span> <span class="nb">list</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="s">&quot;YUMLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">yb</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">listEnabled</span><span class="p">())</span>
<span class="n">sources</span> <span class="o">=</span> <span class="nb">sorted</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">repos</span><span class="p">])</span>
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">sources</span><span class="o">=</span><span class="n">sources</span><span class="p">)</span>
<span class="nd">@api.route</span><span class="p">(</span><span class="s">&quot;/api/v0/projects/source/info/&lt;source_names&gt;&quot;</span><span class="p">)</span>
<span class="nd">@crossdomain</span><span class="p">(</span><span class="n">origin</span><span class="o">=</span><span class="s">&quot;*&quot;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">v0_projects_source_info</span><span class="p">(</span><span class="n">source_names</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return detailed info about the list of sources&quot;&quot;&quot;</span>
<span class="n">out_fmt</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&quot;format&quot;</span><span class="p">,</span> <span class="s">&quot;json&quot;</span><span class="p">)</span>
<span class="c"># Return info on all of the sources</span>
<span class="k">if</span> <span class="n">source_names</span> <span class="o">==</span> <span class="s">&quot;*&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="s">&quot;YUMLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
<span class="n">source_names</span> <span class="o">=</span> <span class="s">&quot;,&quot;</span><span class="o">.</span><span class="n">join</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">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&quot;YUMLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">yb</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">listEnabled</span><span class="p">())</span>
<span class="n">sources</span> <span class="o">=</span> <span class="p">{}</span>
<span class="n">errors</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">system_sources</span> <span class="o">=</span> <span class="n">get_repo_sources</span><span class="p">(</span><span class="s">&quot;/etc/yum.repos.d/*.repo&quot;</span><span class="p">)</span>
<span class="k">for</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">source_names</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;,&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="s">&quot;YUMLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
<span class="n">repo</span> <span class="o">=</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&quot;YUMLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">yb</span><span class="o">.</span><span class="n">repos</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</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">repo</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="s">&quot;</span><span class="si">%s</span><span class="s"> is not a valid source&quot;</span> <span class="o">%</span> <span class="n">source</span><span class="p">)</span>
<span class="k">continue</span>
<span class="n">sources</span><span class="p">[</span><span class="n">repo</span><span class="o">.</span><span class="n">id</span><span class="p">]</span> <span class="o">=</span> <span class="n">repo_to_source</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span> <span class="n">repo</span><span class="o">.</span><span class="n">id</span> <span class="ow">in</span> <span class="n">system_sources</span><span class="p">)</span>
<span class="k">if</span> <span class="n">out_fmt</span> <span class="o">==</span> <span class="s">&quot;toml&quot;</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">errors</span><span class="p">:</span>
<span class="c"># With TOML output we just want to dump the raw sources, skipping the errors</span>
<span class="k">return</span> <span class="n">toml</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">sources</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">out_fmt</span> <span class="o">==</span> <span class="s">&quot;toml&quot;</span> <span class="ow">and</span> <span class="n">errors</span><span class="p">:</span>
<span class="c"># TOML requested, but there was an error</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="bp">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>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">sources</span><span class="o">=</span><span class="n">sources</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="nd">@api.route</span><span class="p">(</span><span class="s">&quot;/api/v0/projects/source/new&quot;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&quot;POST&quot;</span><span class="p">])</span>
<span class="nd">@crossdomain</span><span class="p">(</span><span class="n">origin</span><span class="o">=</span><span class="s">&quot;*&quot;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">v0_projects_source_new</span><span class="p">():</span>
<span class="sd">&quot;&quot;&quot;Add a new package source. Or change an existing one&quot;&quot;&quot;</span>
<span class="k">if</span> <span class="n">request</span><span class="o">.</span><span class="n">headers</span><span class="p">[</span><span class="s">&#39;Content-Type&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;text/x-toml&quot;</span><span class="p">:</span>
<span class="n">source</span> <span class="o">=</span> <span class="n">toml</span><span class="o">.</span><span class="n">loads</span><span class="p">(</span><span class="n">request</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">source</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">get_json</span><span class="p">(</span><span class="n">cache</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
<span class="n">system_sources</span> <span class="o">=</span> <span class="n">get_repo_sources</span><span class="p">(</span><span class="s">&quot;/etc/yum.repos.d/*.repo&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">source</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">]</span> <span class="ow">in</span> <span class="n">system_sources</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="bp">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="s">&quot;</span><span class="si">%s</span><span class="s"> is a system source, it cannot be deleted.&quot;</span> <span class="o">%</span> <span class="n">source</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">]]),</span> <span class="mi">400</span>
<span class="k">try</span><span class="p">:</span>
<span class="c"># Delete it from yum (if it exists) and replace it with the new one</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="s">&quot;YUMLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
<span class="n">yb</span> <span class="o">=</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&quot;YUMLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">yb</span>
<span class="c"># If this repo already exists, delete it and replace it with the new one</span>
<span class="n">repos</span> <span class="o">=</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">yb</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">listEnabled</span><span class="p">())</span>
<span class="k">if</span> <span class="n">source</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">]</span> <span class="ow">in</span> <span class="n">repos</span><span class="p">:</span>
<span class="n">yb</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">delete</span><span class="p">(</span><span class="n">source</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">])</span>
<span class="n">repo_dict</span> <span class="o">=</span> <span class="n">source_to_repo</span><span class="p">(</span><span class="n">source</span><span class="p">)</span>
<span class="n">repoid</span> <span class="o">=</span> <span class="n">repo_dict</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s">&quot;id&quot;</span><span class="p">)</span>
<span class="n">baseurl</span> <span class="o">=</span> <span class="n">repo_dict</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s">&quot;baseurl&quot;</span><span class="p">)</span>
<span class="n">mirrorlist</span> <span class="o">=</span> <span class="n">repo_dict</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s">&quot;mirrorlist&quot;</span><span class="p">)</span>
<span class="n">yb</span><span class="o">.</span><span class="n">add_enable_repo</span><span class="p">(</span><span class="n">repoid</span><span class="p">,</span> <span class="n">baseurl</span><span class="p">,</span> <span class="n">mirrorlist</span><span class="p">,</span> <span class="o">**</span><span class="n">repo_dict</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="s">&quot;Updating repository metadata after adding </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">source</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">])</span>
<span class="n">update_metadata</span><span class="p">(</span><span class="n">yb</span><span class="p">)</span>
<span class="c"># Write the new repo to disk, replacing any existing ones</span>
<span class="n">repo_dir</span> <span class="o">=</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&quot;COMPOSER_CFG&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&quot;composer&quot;</span><span class="p">,</span> <span class="s">&quot;repo_dir&quot;</span><span class="p">)</span>
<span class="c"># Remove any previous sources with this name, ignore it if it isn&#39;t found</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">delete_repo_source</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">repo_dir</span><span class="p">,</span> <span class="s">&quot;*.repo&quot;</span><span class="p">),</span> <span class="n">source</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">])</span>
<span class="k">except</span> <span class="n">ProjectsError</span><span class="p">:</span>
<span class="k">pass</span>
<span class="c"># Make sure the source name can&#39;t contain a path traversal by taking the basename</span>
<span class="n">source_path</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">repo_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">basename</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">.repo&quot;</span> <span class="o">%</span> <span class="n">source</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">]))</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">source_path</span><span class="p">,</span> <span class="s">&quot;w&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</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">yum_repo_to_file_repo</span><span class="p">(</span><span class="n">source_to_repo</span><span class="p">(</span><span class="n">source</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="s">&quot;(v0_projects_source_add) adding </span><span class="si">%s</span><span class="s"> failed: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">source</span><span class="p">[</span><span class="s">&quot;name&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="c"># Cleanup the mess, if loading it failed we don&#39;t want to leave it in memory</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="s">&quot;YUMLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
<span class="n">yb</span> <span class="o">=</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&quot;YUMLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">yb</span>
<span class="n">repos</span> <span class="o">=</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">yb</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">listEnabled</span><span class="p">())</span>
<span class="k">if</span> <span class="n">source</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">]</span> <span class="ow">in</span> <span class="n">repos</span><span class="p">:</span>
<span class="n">yb</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">delete</span><span class="p">(</span><span class="n">source</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">])</span>
<span class="c"># delete doesn&#39;t remove it from the cache used by listEnabled so we have to force it</span>
<span class="n">yb</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">_cache_enabled_repos</span> <span class="o">=</span> <span class="bp">None</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;Updating repository metadata after adding </span><span class="si">%s</span><span class="s"> failed&quot;</span><span class="p">,</span> <span class="n">source</span><span class="p">[</span><span class="s">&quot;name&quot;</span><span class="p">])</span>
<span class="n">update_metadata</span><span class="p">(</span><span class="n">yb</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="bp">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</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">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="nd">@api.route</span><span class="p">(</span><span class="s">&quot;/api/v0/projects/source/delete/&lt;source_name&gt;&quot;</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s">&quot;DELETE&quot;</span><span class="p">])</span>
<span class="nd">@crossdomain</span><span class="p">(</span><span class="n">origin</span><span class="o">=</span><span class="s">&quot;*&quot;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">v0_projects_source_delete</span><span class="p">(</span><span class="n">source_name</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Delete the named source and return a status response&quot;&quot;&quot;</span>
<span class="n">system_sources</span> <span class="o">=</span> <span class="n">get_repo_sources</span><span class="p">(</span><span class="s">&quot;/etc/yum.repos.d/*.repo&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">source_name</span> <span class="ow">in</span> <span class="n">system_sources</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="bp">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="s">&quot;</span><span class="si">%s</span><span class="s"> is a system source, it cannot be deleted.&quot;</span> <span class="o">%</span> <span class="n">source_name</span><span class="p">]),</span> <span class="mi">400</span>
<span class="n">share_dir</span> <span class="o">=</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&quot;COMPOSER_CFG&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&quot;composer&quot;</span><span class="p">,</span> <span class="s">&quot;repo_dir&quot;</span><span class="p">)</span>
<span class="k">try</span><span class="p">:</span>
<span class="c"># Remove the file entry for the source</span>
<span class="n">delete_repo_source</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">share_dir</span><span class="p">,</span> <span class="s">&quot;*.repo&quot;</span><span class="p">),</span> <span class="n">source_name</span><span class="p">)</span>
<span class="c"># Delete the repo</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="s">&quot;YUMLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
<span class="n">yb</span> <span class="o">=</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s">&quot;YUMLOCK&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">yb</span>
<span class="n">repos</span> <span class="o">=</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">yb</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">listEnabled</span><span class="p">())</span>
<span class="k">if</span> <span class="n">source_name</span> <span class="ow">in</span> <span class="n">repos</span><span class="p">:</span>
<span class="n">yb</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">delete</span><span class="p">(</span><span class="n">source_name</span><span class="p">)</span>
<span class="c"># delete doesn&#39;t remove it from the cache used by listEnabled so we have to force it</span>
<span class="n">yb</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">_cache_enabled_repos</span> <span class="o">=</span> <span class="bp">None</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;Updating repository metadata after removing </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">source_name</span><span class="p">)</span>
<span class="n">update_metadata</span><span class="p">(</span><span class="n">yb</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">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&quot;(v0_projects_source_delete) </span><span class="si">%s</span><span class="s">&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="bp">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</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">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="nd">@api.route</span><span class="p">(</span><span class="s">&quot;/api/v0/modules/list&quot;</span><span class="p">)</span>
<span class="nd">@api.route</span><span class="p">(</span><span class="s">&quot;/api/v0/modules/list/&lt;module_names&gt;&quot;</span><span class="p">)</span>
<span class="nd">@crossdomain</span><span class="p">(</span><span class="n">origin</span><span class="o">=</span><span class="s">&quot;*&quot;</span><span class="p">)</span>
@ -1647,7 +1871,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../pylorax.html" >pylorax</a> &raquo;</li>
<li><a href="../api.html" >pylorax.api</a> &raquo;</li>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.api.workspace &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.api.workspace &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../../index.html" />
<link rel="up" title="pylorax.api" href="../api.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../pylorax.html" >pylorax</a> &raquo;</li>
<li><a href="../api.html" accesskey="U">pylorax.api</a> &raquo;</li>
@ -183,7 +183,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../pylorax.html" >pylorax</a> &raquo;</li>
<li><a href="../api.html" >pylorax.api</a> &raquo;</li>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.api.yumbase &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.api.yumbase &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../../index.html" />
<link rel="up" title="pylorax.api" href="../api.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../pylorax.html" >pylorax</a> &raquo;</li>
<li><a href="../api.html" accesskey="U">pylorax.api</a> &raquo;</li>
@ -156,14 +156,24 @@
<span class="c"># 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="s">&quot;Updating yum repository metadata&quot;</span><span class="p">)</span>
<span class="n">update_metadata</span><span class="p">(</span><span class="n">yb</span><span class="p">)</span>
<span class="k">return</span> <span class="n">yb</span>
</div>
<div class="viewcode-block" id="update_metadata"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.yumbase.update_metadata">[docs]</a><span class="k">def</span> <span class="nf">update_metadata</span><span class="p">(</span><span class="n">yb</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Update the metadata for all the enabled repos</span>
<span class="sd"> :param yb: The Yum base object</span>
<span class="sd"> :type yb: yum.YumBase</span>
<span class="sd"> :returns: None</span>
<span class="sd"> :rtype: None</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">yb</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">sort</span><span class="p">():</span>
<span class="n">r</span><span class="o">.</span><span class="n">metadata_expire</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">r</span><span class="o">.</span><span class="n">mdpolicy</span> <span class="o">=</span> <span class="s">&quot;group:all&quot;</span>
<span class="n">yb</span><span class="o">.</span><span class="n">doRepoSetup</span><span class="p">()</span>
<span class="n">yb</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">doSetup</span><span class="p">()</span>
<span class="n">yb</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">populateSack</span><span class="p">(</span><span class="n">mdtype</span><span class="o">=</span><span class="s">&#39;all&#39;</span><span class="p">,</span> <span class="n">cacheonly</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="k">return</span> <span class="n">yb</span></div>
<span class="n">yb</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">populateSack</span><span class="p">(</span><span class="n">mdtype</span><span class="o">=</span><span class="s">&#39;all&#39;</span><span class="p">,</span> <span class="n">cacheonly</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span></div>
</pre></div>
</div>
@ -197,7 +207,7 @@
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Module code</a> &raquo;</li>
<li><a href="../../pylorax.html" >pylorax</a> &raquo;</li>
<li><a href="../api.html" >pylorax.api</a> &raquo;</li>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.base &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.base &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../index.html" />
<link rel="up" title="pylorax" href="../pylorax.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" accesskey="U">pylorax</a> &raquo;</li>
</ul>
@ -150,7 +150,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" >pylorax</a> &raquo;</li>
</ul>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.buildstamp &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.buildstamp &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../index.html" />
<link rel="up" title="pylorax" href="../pylorax.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" accesskey="U">pylorax</a> &raquo;</li>
</ul>
@ -141,7 +141,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" >pylorax</a> &raquo;</li>
</ul>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.creator &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.creator &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../index.html" />
<link rel="up" title="pylorax" href="../pylorax.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" accesskey="U">pylorax</a> &raquo;</li>
</ul>
@ -697,7 +697,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" >pylorax</a> &raquo;</li>
</ul>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.decorators &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.decorators &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../index.html" />
<link rel="up" title="pylorax" href="../pylorax.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" accesskey="U">pylorax</a> &raquo;</li>
</ul>
@ -113,7 +113,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" >pylorax</a> &raquo;</li>
</ul>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.discinfo &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.discinfo &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../index.html" />
<link rel="up" title="pylorax" href="../pylorax.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" accesskey="U">pylorax</a> &raquo;</li>
</ul>
@ -122,7 +122,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" >pylorax</a> &raquo;</li>
</ul>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.executils &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.executils &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../index.html" />
<link rel="up" title="pylorax" href="../pylorax.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" accesskey="U">pylorax</a> &raquo;</li>
</ul>
@ -508,7 +508,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" >pylorax</a> &raquo;</li>
</ul>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.imgutils &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.imgutils &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../index.html" />
<link rel="up" title="pylorax" href="../pylorax.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" accesskey="U">pylorax</a> &raquo;</li>
</ul>
@ -221,13 +221,34 @@
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s">&quot;Unable to setup </span><span class="si">%s</span><span class="s"> on </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">loop_dev</span><span class="p">,</span> <span class="n">outfile</span><span class="p">))</span>
</div>
<div class="viewcode-block" id="loop_attach"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.loop_attach">[docs]</a><span class="k">def</span> <span class="nf">loop_attach</span><span class="p">(</span><span class="n">outfile</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;Attach a loop device to the given file. Return the loop device name.</span>
<span class="sd"> Raises CalledProcessError if losetup fails.&#39;&#39;&#39;</span>
<span class="n">dev</span> <span class="o">=</span> <span class="n">runcmd_output</span><span class="p">([</span><span class="s">&quot;losetup&quot;</span><span class="p">,</span> <span class="s">&quot;--find&quot;</span><span class="p">,</span> <span class="s">&quot;--show&quot;</span><span class="p">,</span> <span class="n">outfile</span><span class="p">])</span>
<span class="sd">&quot;&quot;&quot;Attach a loop device to the given file. Return the loop device name.</span>
<span class="c"># Sometimes the loop device isn&#39;t ready yet, make extra sure before returning</span>
<span class="n">loop_waitfor</span><span class="p">(</span><span class="n">dev</span><span class="o">.</span><span class="n">strip</span><span class="p">(),</span> <span class="n">outfile</span><span class="p">)</span>
<span class="k">return</span> <span class="n">dev</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
<span class="sd"> On rare occasions it appears that the device never shows up, some experiments</span>
<span class="sd"> seem to indicate that it may be a race with another process using /dev/loop* devices.</span>
<span class="sd"> So we now try 3 times before actually failing.</span>
<span class="sd"> Raises CalledProcessError if losetup fails.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">retries</span> <span class="o">=</span> <span class="mi">0</span>
<span class="k">while</span> <span class="bp">True</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">retries</span> <span class="o">+=</span> <span class="mi">1</span>
<span class="n">dev</span> <span class="o">=</span> <span class="n">runcmd_output</span><span class="p">([</span><span class="s">&quot;losetup&quot;</span><span class="p">,</span> <span class="s">&quot;--find&quot;</span><span class="p">,</span> <span class="s">&quot;--show&quot;</span><span class="p">,</span> <span class="n">outfile</span><span class="p">])</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
<span class="c"># Sometimes the loop device isn&#39;t ready yet, make extra sure before returning</span>
<span class="n">loop_waitfor</span><span class="p">(</span><span class="n">dev</span><span class="p">,</span> <span class="n">outfile</span><span class="p">)</span>
<span class="k">except</span> <span class="n">CalledProcessError</span><span class="p">:</span>
<span class="c"># Problems running losetup are always errors, raise immediately</span>
<span class="k">raise</span>
<span class="k">except</span> <span class="ne">RuntimeError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="c"># Try to setup the loop device 3 times</span>
<span class="k">if</span> <span class="n">retries</span> <span class="o">==</span> <span class="mi">3</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="s">&quot;loop_attach failed, retries exhausted.&quot;</span><span class="p">)</span>
<span class="k">raise</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&quot;Try </span><span class="si">%d</span><span class="s"> failed, </span><span class="si">%s</span><span class="s"> did not appear.&quot;</span><span class="p">,</span> <span class="n">retries</span><span class="p">,</span> <span class="n">dev</span><span class="p">)</span>
<span class="k">break</span>
<span class="k">return</span> <span class="n">dev</span>
</div>
<div class="viewcode-block" id="loop_detach"><a class="viewcode-back" href="../../pylorax.html#pylorax.imgutils.loop_detach">[docs]</a><span class="k">def</span> <span class="nf">loop_detach</span><span class="p">(</span><span class="n">loopdev</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;Detach the given loop device. Return False on failure.&#39;&#39;&#39;</span>
@ -548,7 +569,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" >pylorax</a> &raquo;</li>
</ul>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.installer &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.installer &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../index.html" />
<link rel="up" title="pylorax" href="../pylorax.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" accesskey="U">pylorax</a> &raquo;</li>
</ul>
@ -122,7 +122,8 @@
<span class="bp">self</span><span class="o">.</span><span class="n">mount_dir</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">initrd_path</span>
<span class="n">kernel_list</span> <span class="o">=</span> <span class="p">[(</span><span class="s">&quot;/isolinux/vmlinuz&quot;</span><span class="p">,</span> <span class="s">&quot;/isolinux/initrd.img&quot;</span><span class="p">),</span>
<span class="p">(</span><span class="s">&quot;/ppc/ppc64/vmlinuz&quot;</span><span class="p">,</span> <span class="s">&quot;/ppc/ppc64/initrd.img&quot;</span><span class="p">)]</span>
<span class="p">(</span><span class="s">&quot;/ppc/ppc64/vmlinuz&quot;</span><span class="p">,</span> <span class="s">&quot;/ppc/ppc64/initrd.img&quot;</span><span class="p">),</span>
<span class="p">(</span><span class="s">&quot;/images/pxeboot/vmlinuz&quot;</span><span class="p">,</span> <span class="s">&quot;/images/pxeboot/initrd.img&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">isdir</span><span class="p">(</span> <span class="bp">self</span><span class="o">.</span><span class="n">mount_dir</span><span class="o">+</span><span class="s">&quot;/repodata&quot;</span> <span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">repo</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">mount_dir</span>
<span class="k">else</span><span class="p">:</span>
@ -168,20 +169,27 @@
<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">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">2</span><span class="p">,</span>
<span class="n">kernel_args</span><span class="o">=</span><span class="bp">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">vnc</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">arch</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
<span class="n">log_check</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">virtio_host</span><span class="o">=</span><span class="s">&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">qcow2</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
<span class="n">qcow2</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">boot_uefi</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">ovmf_path</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Start the installation</span>
<span class="sd"> iso is an instance of IsoMountpoint</span>
<span class="sd"> ks_paths is a list of paths to a kickstart files. All are injected, the</span>
<span class="sd"> first one is the one executed.</span>
<span class="sd"> disk_img is the path to a disk image (doesn&#39;t need to exist)</span>
<span class="sd"> img_size is the size, in GiB, of the image if it doesn&#39;t exist</span>
<span class="sd"> kernel_args are extra arguments to pass on the kernel cmdline</span>
<span class="sd"> memory is the amount of ram to assign to the virt</span>
<span class="sd"> vnc is passed to the --graphics command verbatim</span>
<span class="sd"> arch is the optional architecture to use in the virt</span>
<span class="sd"> log_check is a method that returns True of the log indicates an error</span>
<span class="sd"> virtio_host and virtio_port are used to communicate with the log monitor</span>
<span class="sd"> :param iso: Information about the iso to use for the installation</span>
<span class="sd"> :type iso: IsoMountpoint</span>
<span class="sd"> :param list ks_paths: Paths to kickstart files. All are injected, the</span>
<span class="sd"> first one is the one executed.</span>
<span class="sd"> :param str disk_img: Path to a disk image, created it it doesn&#39;t exist</span>
<span class="sd"> :param int img_size: The image size, in MiB, to create if it doesn&#39;t exist</span>
<span class="sd"> :param str kernel_args: Extra kernel arguments to pass on the kernel cmdline</span>
<span class="sd"> :param int memory: Amount of RAM to assign to the virt, in MiB</span>
<span class="sd"> :param str vnc: Arguments to pass to virt-install --graphics</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 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 bool qcow2: Set to True if disk_img is a qcow2</span>
<span class="sd"> :param bool boot_uefi: Use OVMF to boot the VM in UEFI mode</span>
<span class="sd"> :param str ovmf_path: Path to the OVMF firmware</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">virt_name</span> <span class="o">=</span> <span class="s">&quot;LiveOS-&quot;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">uuid</span><span class="o">.</span><span class="n">uuid4</span><span class="p">())</span>
<span class="c"># add --graphics none later</span>
@ -239,9 +247,15 @@
<span class="n">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s">&quot;--arch&quot;</span><span class="p">)</span>
<span class="n">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">arch</span><span class="p">)</span>
<span class="n">rc</span> <span class="o">=</span> <span class="n">execWithRedirect</span><span class="p">(</span><span class="s">&quot;virt-install&quot;</span><span class="p">,</span> <span class="n">args</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="ne">Exception</span><span class="p">(</span><span class="s">&quot;Problem starting virtual install&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">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s">&quot;--boot&quot;</span><span class="p">)</span>
<span class="n">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s">&quot;loader=</span><span class="si">%s</span><span class="s">/OVMF_CODE.fd,loader_ro=yes,loader_type=pflash,nvram_template=</span><span class="si">%s</span><span class="s">/OVMF_VARS.fd,loader_secure=no&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">ovmf_path</span><span class="p">,</span> <span class="n">ovmf_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="s">&quot;Running virt-install.&quot;</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="s">&quot;virt-install&quot;</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">raise_err</span><span class="o">=</span><span class="bp">True</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="k">raise</span> <span class="n">InstallError</span><span class="p">(</span><span class="s">&quot;Problem starting virtual install: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">e</span><span class="p">)</span>
<span class="n">conn</span> <span class="o">=</span> <span class="n">libvirt</span><span class="o">.</span><span class="n">openReadOnly</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
<span class="n">dom</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">lookupByName</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">virt_name</span><span class="p">)</span>
@ -268,8 +282,9 @@
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span> <span class="s">&quot;Shutting down </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">virt_name</span><span class="p">)</span>
<span class="n">subprocess</span><span class="o">.</span><span class="n">call</span><span class="p">([</span><span class="s">&quot;virsh&quot;</span><span class="p">,</span> <span class="s">&quot;destroy&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">virt_name</span><span class="p">])</span>
<span class="n">subprocess</span><span class="o">.</span><span class="n">call</span><span class="p">([</span><span class="s">&quot;virsh&quot;</span><span class="p">,</span> <span class="s">&quot;undefine&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">virt_name</span><span class="p">])</span>
<span class="c"># Undefine the virt, UEFI installs need to have --nvram passed</span>
<span class="n">subprocess</span><span class="o">.</span><span class="n">call</span><span class="p">([</span><span class="s">&quot;virsh&quot;</span><span class="p">,</span> <span class="s">&quot;undefine&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">virt_name</span><span class="p">,</span> <span class="s">&quot;--nvram&quot;</span><span class="p">])</span>
</div></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> <span class="n">repo_url</span><span class="p">,</span> <span class="n">callback_func</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
@ -409,16 +424,23 @@
<span class="k">else</span><span class="p">:</span>
<span class="n">diskimg_path</span> <span class="o">=</span> <span class="n">disk_img</span>
<span class="n">virt</span> <span class="o">=</span> <span class="n">VirtualInstall</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">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">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">qcow2</span><span class="o">=</span><span class="n">opts</span><span class="o">.</span><span class="n">qcow2</span><span class="p">)</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">virt</span> <span class="o">=</span> <span class="n">VirtualInstall</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">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">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">qcow2</span><span class="o">=</span><span class="n">opts</span><span class="o">.</span><span class="n">qcow2</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>
<span class="n">ovmf_path</span><span class="o">=</span><span class="n">opts</span><span class="o">.</span><span class="n">ovmf_path</span><span class="p">)</span>
<span class="n">virt</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
<span class="n">log_monitor</span><span class="o">.</span><span class="n">shutdown</span><span class="p">()</span>
<span class="n">iso_mount</span><span class="o">.</span><span class="n">umount</span><span class="p">()</span>
<span class="n">virt</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
<span class="n">log_monitor</span><span class="o">.</span><span class="n">shutdown</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="s">&quot;VirtualInstall failed: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">e</span><span class="p">)</span>
<span class="k">raise</span>
<span class="k">finally</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="s">&quot;unmounting the iso&quot;</span><span class="p">)</span>
<span class="n">iso_mount</span><span class="o">.</span><span class="n">umount</span><span class="p">()</span>
<span class="k">if</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">raise</span> <span class="n">InstallError</span><span class="p">(</span><span class="s">&quot;virt_install failed&quot;</span><span class="p">)</span>
@ -471,7 +493,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" >pylorax</a> &raquo;</li>
</ul>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.logmonitor &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.logmonitor &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../index.html" />
<link rel="up" title="pylorax" href="../pylorax.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" accesskey="U">pylorax</a> &raquo;</li>
</ul>
@ -206,7 +206,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" >pylorax</a> &raquo;</li>
</ul>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.ltmpl &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.ltmpl &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../index.html" />
<link rel="up" title="pylorax" href="../pylorax.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" accesskey="U">pylorax</a> &raquo;</li>
</ul>
@ -748,7 +748,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" >pylorax</a> &raquo;</li>
</ul>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.sysutils &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.sysutils &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../index.html" />
<link rel="up" title="pylorax" href="../pylorax.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" accesskey="U">pylorax</a> &raquo;</li>
</ul>
@ -191,7 +191,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" >pylorax</a> &raquo;</li>
</ul>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.treebuilder &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.treebuilder &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../index.html" />
<link rel="up" title="pylorax" href="../pylorax.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" accesskey="U">pylorax</a> &raquo;</li>
</ul>
@ -403,7 +403,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" >pylorax</a> &raquo;</li>
</ul>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.treeinfo &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.treeinfo &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../index.html" />
<link rel="up" title="pylorax" href="../pylorax.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" accesskey="U">pylorax</a> &raquo;</li>
</ul>
@ -140,7 +140,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" >pylorax</a> &raquo;</li>
</ul>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax.yumhelper &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax.yumhelper &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="../../index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="../../index.html" />
<link rel="up" title="pylorax" href="../pylorax.html" />
</head>
<body>
@ -38,7 +38,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" accesskey="U">pylorax</a> &raquo;</li>
</ul>
@ -208,7 +208,7 @@
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../../index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="../../index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="../index.html" >Module code</a> &raquo;</li>
<li><a href="../pylorax.html" >pylorax</a> &raquo;</li>
</ul>

View File

@ -0,0 +1,62 @@
composer-cli
============
:Authors:
Brian C. Lane <bcl@redhat.com>
``composer-cli`` is used to interact with the ``lorax-composer`` API server, managing blueprints, exploring available packages, and building new images.
It requires `lorax-composer <lorax-composer.html>`_ to be installed on the
local system, and the user running it needs to be a member of the ``weldr``
group. They do not need to be root, but all of the `security precautions
<lorax-composer.html#security>`_ apply.
composer-cli cmdline arguments
------------------------------
.. argparse::
:ref: composer.cli.cmdline.composer_cli_parser
:prog: composer-cli
Edit a Blueprint
----------------
Start out by listing the available blueprints using ``composer-cli blueprints
list``, pick one and save it to the local directory by running ``composer-cli
blueprints save http-server``. If there are no blueprints available you can
copy one of the examples `from the test suite
<https://github.com/weldr/lorax/tree/master/tests/pylorax/blueprints/>`_.
Edit the file (it will be saved with a .toml extension) and change the
description, add a package or module to it. Send it back to the server by
running ``composer-cli blueprints push http-server.toml``. You can verify that it was
saved by viewing the changelog - ``composer-cli blueprints changes http-server``.
Build an image
----------------
Build a ``qcow2`` disk image from this blueprint by running ``composer-cli
compose start http-server qcow2``. It will print a UUID that you can use to
keep track of the build. You can also cancel the build if needed.
The available types of images is displayed by ``composer-cli compose types``.
Currently this consists of: ext4-filesystem, live-iso, partitioned-disk, qcow2,
tar
Monitor the build status
------------------------
Monitor it using ``composer-cli compose status``, which will show the status of
all the builds on the system. You can view the end of the anaconda build logs
once it is in the ``RUNNING`` state using ``composer-cli compose log UUID``
where UUID is the UUID returned by the start command.
Once the build is in the ``FINISHED`` state you can download the image.
Download the image
------------------
Downloading the final image is done with ``composer-cli compose image UUID`` and it will
save the qcow2 image as ``UUID-disk.qcow2`` which you can then use to boot a VM like this::
qemu-kvm --name test-image -m 1024 -hda ./UUID-disk.qcow2

View File

@ -1,54 +0,0 @@
composer\.cli package
=====================
Submodules
----------
composer\.cli\.blueprints module
--------------------------------
.. automodule:: composer.cli.blueprints
:members:
:undoc-members:
:show-inheritance:
composer\.cli\.compose module
-----------------------------
.. automodule:: composer.cli.compose
:members:
:undoc-members:
:show-inheritance:
composer\.cli\.modules module
-----------------------------
.. automodule:: composer.cli.modules
:members:
:undoc-members:
:show-inheritance:
composer\.cli\.projects module
------------------------------
.. automodule:: composer.cli.projects
:members:
:undoc-members:
:show-inheritance:
composer\.cli\.utilities module
-------------------------------
.. automodule:: composer.cli.utilities
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: composer.cli
:members:
:undoc-members:
:show-inheritance:

View File

@ -25,6 +25,14 @@ cli Package
:undoc-members:
:show-inheritance:
:mod:`help` Module
------------------
.. automodule:: composer.cli.help
:members:
:undoc-members:
:show-inheritance:
:mod:`modules` Module
---------------------
@ -41,6 +49,14 @@ cli Package
:undoc-members:
:show-inheritance:
:mod:`sources` Module
---------------------
.. automodule:: composer.cli.sources
:members:
:undoc-members:
:show-inheritance:
:mod:`utilities` Module
-----------------------

View File

@ -1,37 +0,0 @@
composer package
================
Subpackages
-----------
.. toctree::
composer.cli
Submodules
----------
composer\.http\_client module
-----------------------------
.. automodule:: composer.http_client
:members:
:undoc-members:
:show-inheritance:
composer\.unix\_socket module
-----------------------------
.. automodule:: composer.unix_socket
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: composer
:members:
:undoc-members:
:show-inheritance:

View File

@ -1,28 +0,0 @@
.. Lorax documentation master file, created by
sphinx-quickstart on Wed Apr 8 13:46:00 2015.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Lorax's documentation!
=================================
Contents:
.. toctree::
:maxdepth: 1
intro
lorax
livemedia-creator
lorax-composer
product-images
modules
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@ -15,6 +15,7 @@ Contents:
lorax
livemedia-creator
lorax-composer
composer-cli
product-images
modules

View File

@ -1,67 +0,0 @@
Introduction to Lorax
=====================
I am the Lorax. I speak for the trees [and images].
Lorax is used to build the Anaconda Installer boot.iso, it consists of a
library, pylorax, a set of templates, and the lorax script. Its operation
is driven by a customized set of Mako templates that lists the packages
to be installed, steps to execute to remove unneeded files, and creation
of the iso for all of the supported architectures.
Before Lorax
============
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.
EXISTING WORKFLOW:
pungi and other tools call scripts/buildinstall, which in turn call other
scripts to do the image building and data generation. Here's how it
currently looks:
-> buildinstall
* process command line options
* write temporary yum.conf to point to correct repo
* find anaconda release RPM
* unpack RPM, pull in those versions of upd-instroot, mk-images,
maketreeinfo.py, makestamp.py, and buildinstall
-> call upd-instroot
-> call maketreeinfo.py
-> call mk-images (which figures out which mk-images.ARCH to call)
-> call makestamp.py
* clean up
PROBLEMS:
The existing workflow presents some problems with maintaining the scripts.
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
it's not completely clear from reading the scripts.
NEW IDEAS:
Create a new central driver with all information living in Python modules.
Configuration files will provide the knowledge previously contained in the
upd-instroot and mk-images* scripts.

View File

@ -1,391 +0,0 @@
livemedia-creator
=================
:Authors:
Brian C. Lane <bcl@redhat.com>
livemedia-creator uses `Anaconda <https://github.com/rhinstaller/anaconda>`_,
`kickstart <https://github.com/rhinstaller/pykickstart>`_ and `Lorax
<https://github.com/rhinstaller/lorax>`_ to create bootable media that use the
same install path as a normal system installation. It can be used to make live
isos, bootable (partitioned) disk images, tarfiles, and filesystem images for
use with virtualization and container solutions like libvirt, docker, and
OpenStack.
The general idea is to use virt-install with kickstart and an Anaconda boot.iso to
install into a disk image and then use the disk image to create the bootable
media.
livemedia-creator --help will describe all of the options available. At the
minimum you need:
``--make-iso`` to create a final bootable .iso or one of the other ``--make-*`` options.
``--iso`` to specify the Anaconda install media to use with virt-install.
``--ks`` to select the kickstart file describing what to install.
To use livemedia-creator with virtualization you will need to have virt-install installed.
If you are going to be using Anaconda directly, with ``--no-virt`` mode, make sure
you have the anaconda-tui package installed.
Conventions used in this document:
``lmc`` is an abbreviation for livemedia-creator.
``builder`` is the system where livemedia-creator is being run
``image`` is the disk image being created by running livemedia-creator
livemedia-creator cmdline arguments
-----------------------------------
See the output from ``livemedia-creator --help`` for the commandline arguments.
Quickstart
----------
Run this to create a bootable live iso::
sudo livemedia-creator --make-iso \
--iso=/extra/iso/boot.iso --ks=./docs/rhel7-livemedia.ks
You can run it directly from the lorax git repo like this::
sudo PATH=./src/sbin/:$PATH PYTHONPATH=./src/ ./src/sbin/livemedia-creator \
--make-iso --iso=/extra/iso/boot.iso \
--ks=./docs/rhel7-livemedia.ks --lorax-templates=./share/
You can observe the installation using vnc. The logs will show what port was
chosen, or you can use a specific port by passing it. eg. ``--vnc vnc:127.0.0.1:5``
This is usually a good idea when testing changes to the kickstart. lmc tries
to monitor the logs for fatal errors, but may not catch everything.
How ISO creation works
----------------------
There are 2 stages, the install stage which produces a disk or filesystem image
as its output, and the boot media creation which uses the image as its input.
Normally you would run both stages, but it is possible to stop after the
install stage, by using ``--image-only``, or to skip the install stage and use
a previously created disk image by passing ``--disk-image`` or ``--fs-image``
When creating an iso virt-install boots using the passed Anaconda installer iso
and installs the system based on the kickstart. The ``%post`` section of the
kickstart is used to customize the installed system in the same way that
current spin-kickstarts do.
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
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.
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.
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.
The final image is created by lorax, using the templates in /usr/share/lorax/live/
or the live directory below the directory specified by ``--lorax-templates``. The
templates are written using the Mako template system with some extra commands
added by lorax.
Kickstarts
----------
The docs/ directory includes several example kickstarts, one to create a live
desktop iso using GNOME, and another to create a minimal disk image. When
creating your own kickstarts you should start with the minimal example, it
includes several needed packages that are not always included by dependencies.
Or you can use existing spin kickstarts to create live media with a few
changes. Here are the steps I used to convert the Fedora XFCE spin.
1. Flatten the xfce kickstart using ksflatten
2. Add zerombr so you don't get the disk init dialog
3. Add clearpart --all
4. Add swap partition
5. bootloader target
6. Add shutdown to the kickstart
7. 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:
``livemedia-creator --kernel-args="sshd"``
8. Add a root password::
rootpw rootme
network --bootproto=dhcp --activate
zerombr
clearpart --all
bootloader --location=mbr
part swap --size=512
shutdown
9. In the livesys script section of the %post remove the root password. This
really depends on how the spin wants to work. You could add the live user
that you create to the %wheel group so that sudo works if you wanted to.
``passwd -d root > /dev/null``
10. Remove /etc/fstab in %post, dracut handles mounting the rootfs
``cat /dev/null > /dev/fstab``
Do this only for live iso's, the filesystem will be mounted read only if
there is no /etc/fstab
11. Don't delete initramfs files from /boot in %post
12. 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
grub-efi
memtest86+
syslinux
One drawback to using virt-install is that it pulls the packages from the repo
each time you run it. To speed things up you either need a local mirror of the
packages, or you can use a caching proxy. When using a proxy you pass it to
livemedia-creator like this:
``--proxy=http://proxy.yourdomain.com:3128``
You also need to use a specific mirror instead of mirrormanager so that the
packages will get cached, so your kickstart url would look like:
``url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/x86_64/os/"``
You can also add an update repo, but don't name it updates. Add --proxy to it
as well.
Anaconda image install (no-virt)
--------------------------------
You can create images without using virt-install by passing ``--no-virt`` on
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:
1. 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.
2. Make sure selinux is set to permissive or disabled. It won't install
correctly with selinux set to enforcing yet.
3. 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.
The logs from anaconda will be placed in an ./anaconda/ directory in either
the current directory or in the directory used for --logfile
Example cmdline:
``sudo livemedia-creator --make-iso --no-virt --ks=./rhel7-livemedia.ks``
.. note::
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.
AMI Images
----------
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.
Example cmdline:
``sudo livemedia-creator --make-ami --iso=/path/to/boot.iso --ks=./docs/rhel7-livemedia-ec2.ks``
This will produce an ami-root.img file in the working directory.
At this time I have not tested the image with EC2. Feedback would be welcome.
Appliance Creation
------------------
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.
The XML is generated using the Mako template from
/usr/share/lorax/appliance/libvirt.xml You can use a different template by
passing ``--app-template <template path>``
Documentation on the Mako template system can be found at the `Mako site
<http://docs.makotemplates.org/en/latest/index.html>`_
The name of the final output XML is appliance.xml, this can be changed with
``--app-file <file path>``
The following variables are passed to the template:
``disks``
A list of disk_info about each disk.
Each entry has the following attributes:
``name``
base name of the disk image file
``format``
"raw"
``checksum_type``
"sha256"
``checksum``
sha256 checksum of the disk image
``name``
Name of appliance, from --app-name argument
``arch``
Architecture
``memory``
Memory in KB (from ``--ram``)
``vcpus``
from ``--vcpus``
``networks``
list of networks from the kickstart or []
``title``
from ``--title``
``project``
from ``--project``
``releasever``
from ``--releasever``
The created image can be imported into libvirt using:
``virt-image appliance.xml``
You can also create qcow2 appliance images using ``--image-type=qcow2``, for example::
sudo livemedia-creator --make-appliance --iso=/path/to/boot.iso --ks=./docs/rhel7-minimal.ks \
--image-type=qcow2 --app-file=minimal-test.xml --image-name=minimal-test.img
Filesystem Image Creation
-------------------------
livemedia-creator can be used to create un-partitined filesystem images using
the ``--make-fsimage`` option. As of version 21.8 this works with both virt and
no-virt modes of operation. Previously it was only available with no-virt.
Kickstarts should have a single / partition with no extra mountpoints.
``livemedia-creator --make-fsimage --iso=/path/to/boot.iso --ks=./docs/rhel7-minimal.ks``
You can name the output image with ``--image-name`` and set a label on the filesystem with ``--fs-label``
TAR File Creation
-----------------
The ``--make-tar`` command can be used to create a tar of the root filesystem. By
default it is compressed using xz, but this can be changed using the
``--compression`` and ``--compress-arg`` options. This option works with both virt and
no-virt install methods.
As with ``--make-fsimage`` the kickstart should be limited to a single / partition.
For example::
livemedia-creator --make-tar --iso=/path/to/boot.iso --ks=./docs/rhel7-minimal.ks \
--image-name=rhel7-root.tar.xz
Live Image for PXE Boot
-----------------------
The ``--make-pxe-live`` command will produce squashfs image containing live root
filesystem that can be used for pxe boot. Directory with results will contain
the live image, kernel image, initrd image and template of pxe configuration
for the images.
Atomic Live Image for PXE Boot
------------------------------
The ``--make-ostree-live`` command will produce the same result as ``--make-pxe-live``
for installations of Atomic Host. Example kickstart for such an installation
using Atomic installer iso with local repo included in the image can be found
in docs/rhel-atomic-pxe-live.ks.
The PXE images can also be created with ``--no-virt`` by using the example
kickstart in docs/rhel-atomic-pxe-live-novirt.ks. This also works inside the
mock environment.
Debugging problems
------------------
Sometimes an installation will get stuck. When using virt-install the logs will
be written to ./virt-install.log and most of the time any problems that happen
will be near the end of the file. lmc tries to detect common errors and will
cancel the installation when they happen. But not everything can be caught.
When creating a new kickstart it is helpful to use vnc so that you can monitor
the installation as it happens, and if it gets stuck without lmc detecting the
problem you can switch to tty1 and examine the system directly.
If it does get stuck the best way to cancel is to use kill -9 on the virt-install pid,
lmc will detect that the process died and cleanup.
If lmc didn't handle the cleanup for some reason you can do this:
1. ``sudo umount /tmp/lmc-XXXX`` to unmount the iso from its mountpoint.
2. ``sudo rm -rf /tmp/lmc-XXXX``
3. ``sudo rm /var/tmp/lmc-disk-XXXXX`` to remove the disk image.
Note that lmc uses the lmc- prefix for all of its temporary files and
directories to make it easier to find and clean up leftovers.
The logs from the virt-install run are stored in virt-install.log, logs from
livemedia-creator are in livemedia.log and program.log
You can add ``--image-only`` to skip the .iso creation and examine the resulting
disk image. Or you can pass ``--keep-image`` to keep it around after the iso has
been created.
Cleaning up aborted ``--no-virt`` installs can sometimes be accomplished by
running the ``anaconda-cleanup`` script. As of Fedora 18 anaconda is
multi-threaded and it can sometimes become stuck and refuse to exit. When this
happens you can usually clean up by first killing the anaconda process then
running ``anaconda-cleanup``.
Hacking
-------
Development on this will take place as part of the lorax project, and on the
anaconda-devel-list mailing list, and `on github <https://github.com/rhinstaller/lorax>`_
Feedback, enhancements and bugs are welcome. You can use `bugzilla
<https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora&component=lorax>`_ to
report bugs against the lorax component.

View File

@ -1,104 +0,0 @@
lorax-composer
==============
:Authors:
Brian C. Lane <bcl@redhat.com>
lorax-composer is an API server that is compatible with the Weldr project's
bdcs-api REST protocol. More information on Weldr can be found `on the Weldr
blog <http://www.weldr.io>`_.
The server runs as root, and communication with it is via a unix domain socket
(``/run/weldr/api.socket`` by default). The directory and socket are owned by
root:weldr so that any user in the weldr group can use the API to control
lorax-composer.
When starting the server it will check for the correct permissions and
ownership of a pre-existing directory, or it will create a new one if it
doesn't exist. The socket path and group owner's name can be changed from the
cmdline by passing it the ``--socket`` and ``--group`` arguments.
As of version 19.7.7 it will drop root privileges for the API thread. The queue
and compose thread still runs as root because it needs to be able to
mount/umount files and run Anaconda.
Logs
----
Logs are stored under ``/var/log/lorax-composer/`` and include all console
messages as well as extra debugging info and API requests.
Quickstart
----------
1. Create a ``weldr`` user and group by running ``useradd weldr``
2. Remove any pre-existing socket directory with ``rm -rf /run/weldr/``
A new directory with correct permissions will be created the first time the server runs.
3. Either start it via systemd with ``systemctl start lorax-composer`` or
run it directly with ``lorax-composer /path/to/blueprints/``
The ``/path/to/blueprints/`` is where the blueprint's git repo will be created, and
all the blueprints created with the ``/api/v0/blueprints/new`` route will be stored.
If there are blueprint ``.toml`` files in the top level of the directory they will
be imported into the blueprint git storage.
Composing Images
----------------
As of version 19.7.7 lorax-composer can create ``tar`` output images. You can use curl to start
a compose like this::
curl --unix-socket /run/weldr/api.socket -X POST -H "Content-Type: application/json" -d '{"blueprint_name": "http-server", "compose_type": "tar", "branch": "master"}' http:///api/v0/compose
And then monitor it by passing the returned build UUID to ``/compose/status/<uuid>``.
Version 19.7.10 adds support for ``live-iso`` and ``partitioned-disk``
Adding Output Types
-------------------
livemedia-creator supports a large number of output types, and only some of
these are currently available via lorax-composer. To add a new output type to
lorax-composer a kickstart file needs to be added to ``./share/composer/``. The
name of the kickstart is what will be used by the ``/compose/types`` route, and the
``compose_type`` field of the POST to start a compose. It also needs to have
code added to the :py:func:`pylorax.api.compose.compose_args` function. The
``_MAP`` entry in this function defines what lorax-composer will pass to
:py:func:`pylorax.installer.novirt_install` when it runs the compose. When the
compose is finished the output files need to be copied out of the build
directory (``/var/lib/lorax/composer/results/<UUID>/compose/``),
:py:func:`pylorax.api.compose.move_compose_results` handles this for each type.
You should move them instead of copying to save space.
If the new output type does not have support in livemedia-creator it should be
added there first. This will make the output available to the widest number of
users.
Example: Add partitioned disk support
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Partitioned disk support is something that livemedia-creator already supports
via the ``--make-disk`` cmdline argument. To add this to lorax-composer it
needs 3 things:
* A ``partitioned-disk.ks`` file in ``./share/composer/``
* A new entry in the _MAP in :py:func:`pylorax.api.compose.compose_args`
* Add a bit of code to :py:func:`pylorax.api.compose.move_compose_results` to move the disk image from
the compose directory to the results directory.
The ``partitioned-disk.ks`` is pretty similar to the example minimal kickstart
in ``./docs/rhel7-minimal.ks``. You should remove the ``url`` and ``repo``
commands, they will be added by the compose process. Make sure the bootloader
packages are included in the ``%packages`` section at the end of the kickstart,
and you will want to leave off the ``%end`` so that the compose can append the
list of packages from the blueprint.
The new ``_MAP`` entry should be a copy of one of the existing entries, but with ``make_disk`` set
to ``True``. Make sure that none of the other ``make_*`` options are ``True``. The ``image_name`` is
what the name of the final image will be.
``move_compose_results()`` can be as simple as moving the output file into
the results directory, or it could do some post-processing on it. The end of
the function should always clean up the ``./compose/`` directory, removing any
unneeded extra files. This is especially true for the ``live-iso`` since it produces
the contents of the iso as well as the boot.iso itself.

View File

@ -4,29 +4,37 @@ lorax-composer
:Authors:
Brian C. Lane <bcl@redhat.com>
lorax-composer is an API server that is compatible with the Weldr project's
bdcs-api REST protocol. More information on Weldr can be found `on the Weldr
blog <http://www.weldr.io>`_.
``lorax-composer`` is an API server that allows you to build disk images using
`Blueprints`_ to describe the package versions to be installed into the image.
It is compatible with the Weldr project's bdcs-api REST protocol. More
information on Weldr can be found `on the Weldr blog <http://www.weldr.io>`_.
The server runs as root, and communication with it is via a unix domain socket
(``/run/weldr/api.socket`` by default). The directory and socket are owned by
root:weldr so that any user in the weldr group can use the API to control
lorax-composer.
Behind the scenes it uses `livemedia-creator <livemedia-creator.html>`_ and
`Anaconda <https://anaconda-installer.readthedocs.io/en/latest/>`_ to handle the
installation and configuration of the images.
When starting the server it will check for the correct permissions and
ownership of a pre-existing directory, or it will create a new one if it
doesn't exist. The socket path and group owner's name can be changed from the
cmdline by passing it the ``--socket`` and ``--group`` arguments.
Important Things To Note
------------------------
As of version 19.7.7 it will drop root privileges for the API thread. The queue
and compose thread still runs as root because it needs to be able to
mount/umount files and run Anaconda.
* SELinux must be in Permissive mode. Anaconda requires SELinux be in permissive mode
for image creation to work correctly. You can either edit the setting in the
``/etc/sysconfig/selinux`` file, or run ``setenforce 0`` before starting lorax-composer.
Logs
----
* Some output types require packages from the RHEL 7 Optional repository. See the
`Red Hat Enterprise Linux 7 documentation <https://access.redhat.com/solutions/392003>`_
for information on how to enable it. Otherwise you will see image creation fail to
depsolve even if the blueprint itself is correct.
Logs are stored under ``/var/log/lorax-composer/`` and include all console
messages as well as extra debugging info and API requests.
Installation
------------
The best way to install ``lorax-composer`` is to use ``sudo dnf install
lorax-composer composer-cli``, this will setup the weldr user and install the
systemd socket activation service. You will then need to enable it with ``sudo
systemctl enable lorax-composer.socket && sudo systemctl start
lorax-composer.socket``. This will leave the server off until the first request
is made. Systemd will then launch the server and it will remain running until
the system is rebooted.
Quickstart
----------
@ -34,31 +42,162 @@ Quickstart
1. Create a ``weldr`` user and group by running ``useradd weldr``
2. Remove any pre-existing socket directory with ``rm -rf /run/weldr/``
A new directory with correct permissions will be created the first time the server runs.
3. Either start it via systemd with ``systemctl start lorax-composer`` or
run it directly with ``lorax-composer /path/to/blueprints/``
3. Enable the socket activation with ``systemctl enable lorax-composer.socket
&& sudo systemctl start lorax-composer.socket`` or run it directly with
``lorax-composer /path/to/blueprints/``
The ``/path/to/blueprints/`` is where the blueprint's git repo will be created, and
all the blueprints created with the ``/api/v0/blueprints/new`` route will be stored.
If there are blueprint ``.toml`` files in the top level of the directory they will
be imported into the blueprint git storage.
The ``/path/to/blueprints/`` directory is where the blueprints' git repo will
be created, and all the blueprints created with the ``/api/v0/blueprints/new``
route will be stored. If there are blueprint ``.toml`` files in the top level
of the directory they will be imported into the blueprint git storage when
``lorax-composer`` starts.
Logs
----
Logs are stored under ``/var/log/lorax-composer/`` and include all console
messages as well as extra debugging info and API requests.
Security
--------
Some security related issues that you should be aware of before running ``lorax-composer``:
* One of the API server threads needs to retain root privileges in order to run Anaconda.
* SELinux must be set to Permissive or disabled to allow ``livemedia-creator`` to run Anaconda.
* Only allow authorized users access to the ``weldr`` group and socket.
Since Anaconda kickstarts are used there is the possibility that a user could
inject commands into a blueprint that would result in the kickstart executing
arbitrary code on the host. Only authorized users should be allowed to build
images using ``lorax-composer``.
How it Works
------------
The server runs as root, and as ``weldr``. Communication with it is via a unix
domain socket (``/run/weldr/api.socket`` by default). The directory and socket
are owned by ``root:weldr`` so that any user in the ``weldr`` group can use the API
to control ``lorax-composer``.
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
doesn't exist. The socket path and group owner's name can be changed from the
cmdline by passing it the ``--socket`` and ``--group`` arguments.
It will then drop root privileges for the API thread and run as the ``weldr``
user. The queue and compose thread still runs as root because it needs to be
able to mount/umount files and run Anaconda.
Composing Images
----------------
As of version 19.7.7 lorax-composer can create ``tar`` output images. You can use curl to start
a compose like this::
The `welder-web <https://github.com/weldr/welder-web/>`_ GUI project can be used to construct
blueprints and create composes using a web browser.
curl --unix-socket /run/weldr/api.socket -X POST -H "Content-Type: application/json" -d '{"blueprint_name": "http-server", "compose_type": "tar", "branch": "master"}' http:///api/v0/compose
Or use the command line with `composer-cli <composer-cli.html>`_.
And then monitor it by passing the returned build UUID to ``/compose/status/<uuid>``.
Blueprints
----------
Blueprints are simple text files in `TOML <https://github.com/toml-lang/toml>`_ format that describe
which packages, and what versions, to install into the image. They can also define a limited set
of customizations to make to the final image.
Example blueprints can be found in the ``lorax-composer`` `test suite
<https://github.com/weldr/lorax/tree/master/tests/pylorax/blueprints/>`_, with a simple one
looking like this::
name = "base"
description = "A base system with bash"
version = "0.0.1"
[[packages]]
name = "bash"
version = "4.4.*"
The ``name`` field is the name of the blueprint. It can contain spaces, but they will be converted to ``-``
when it is written to disk. It should be short and descriptive.
``description`` can be a longer description of the blueprint, it is only used for display purposes.
``version`` is a `semver compatible <https://semver.org/>`_ version number. If
a new blueprint is uploaded with the same ``version`` the server will
automatically bump the PATCH level of the ``version``. If the ``version``
doesn't match it will be used as is. eg. Uploading a blueprint with ``version``
set to ``0.1.0`` when the existing blueprint ``version`` is ``0.0.1`` will
result in the new blueprint being stored as ``version 0.1.0``.
[[packages]] and [[modules]]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
These entries describe the package names and matching version glob to be installed into the image.
The names must match the names exactly, and the versions can be an exact match
or a filesystem-like glob of the version using ``*`` wildcards and ``?``
character matching.
NOTE: As of lorax-composer-29.2-1 the versions are not used for depsolving,
that is planned for a future release. And currently there are no differences
between ``packages`` and ``modules`` in ``lorax-composer``.
Customizations
~~~~~~~~~~~~~~
The ``[[customizations]]`` section can be used to configure the hostname of the final image. eg.::
[[customizations]]
hostname = "baseimage"
[[customizations.sshkey]]
*************************
Set an existing user's ssh key in the final image::
[[customizations.sshkey]]
user = "root"
key = "PUBLIC SSH KEY"
The key will be added to the user's authorized_keys file.
[[customizations.user]]
***********************
Add a user to the image, and/or set their ssh key.
All fields for this section are optional except for the ``name``, here is a complete example::
[[customizations.user]]
name = "admin"
description = "Administrator account"
password = "$6$CHO2$3rN8eviE2t50lmVyBYihTgVRHcaecmeCk31L..."
key = "PUBLIC SSH KEY"
home = "/srv/widget/"
shell = "/usr/bin/bash"
groups = ["widget", "users", "wheel"]
uid = 1200
gid = 1200
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.
[[customizations.group]]
************************
Add a group to the image. ``name`` is required and ``gid`` is optional::
[[customizations.group]]
name = "widget"
gid = 1130
Version 19.7.10 adds support for ``live-iso`` and ``partitioned-disk``
Adding Output Types
-------------------
livemedia-creator supports a large number of output types, and only some of
these are currently available via lorax-composer. To add a new output type to
``livemedia-creator`` supports a large number of output types, and only some of
these are currently available via ``lorax-composer``. To add a new output type to
lorax-composer a kickstart file needs to be added to ``./share/composer/``. The
name of the kickstart is what will be used by the ``/compose/types`` route, and the
``compose_type`` field of the POST to start a compose. It also needs to have
@ -102,3 +241,55 @@ the results directory, or it could do some post-processing on it. The end of
the function should always clean up the ``./compose/`` directory, removing any
unneeded extra files. This is especially true for the ``live-iso`` since it produces
the contents of the iso as well as the boot.iso itself.
Package Sources
---------------
By default lorax-composer uses the host's configured repositories. It copies
the ``*.repo`` files from ``/etc/yum.repos.d/`` into
``/var/lib/lorax/composer/repos.d/`` at startup, these are immutable system
repositories and cannot be deleted or changed. If you want to add additional
repos you can put them into ``/var/lib/lorax/composer/repos.d/`` or use the
``/api/v0/projects/source/*`` API routes to create them.
The new source can be added by doing a POST to the ``/api/v0/projects/source/new``
route using JSON (with `Content-Type` header set to `application/json`) or TOML
(with it set to `text/x-toml`). The format of the source looks like this (in
TOML)::
name = "custom-source-1"
url = "https://url/path/to/repository/"
type = "yum-baseurl"
proxy = "https://proxy-url/"
check_ssl = true
check_gpg = true
gpgkey_urls = ["https://url/path/to/gpg-key"]
The ``proxy`` and ``gpgkey_urls`` entries are optional. All of the others are required. The supported
types for the urls are:
* ``yum-baseurl`` is a URL to a yum repository.
* ``yum-mirrorlist`` is a URL for a mirrorlist.
* ``yum-metalink`` is a URL for a metalink.
If ``check_ssl`` is true the https certificates must be valid. If they are self-signed you can either set
this to false, or add your Certificate Authority to the host system.
If ``check_gpg`` is true the GPG key must either be installed on the host system, or ``gpgkey_urls``
should point to it.
You can edit an existing source (other than system sources), by doing a POST to the ``new`` route
with the new version of the source. It will overwrite the previous one.
A list of existing sources is available from ``/api/v0/projects/source/list``, and detailed info
on a source can be retrieved with the ``/api/v0/projects/source/info/<source-name>`` route. By default
it returns JSON but it can also return TOML if ``?format=toml`` is added to the request.
Non-system sources can be deleted by doing a ``DELETE`` request to the
``/api/v0/projects/source/delete/<source-name>`` route.
The documentation for the source API routes can be `found here <pylorax.api.html#api-v0-projects-source-list>`_
The configured sources are used for all blueprint depsolve operations, and for composing images.
When adding additional sources you must make sure that the packages in the source do not
conflict with any other package sources, otherwise depsolving will fail.

View File

@ -1,148 +0,0 @@
Lorax
=====
:Authors:
Brian C. Lane <bcl@redhat.com>
"I am the Lorax. I speak for the trees [and images]."
The `lorax <https://github.com/rhinstaller/lorax>`_ tool is used to create the
`Anaconda <https://github.com/rhinstaller/anaconda>`_ installer boot.iso as
well as the basic release tree, and .treeinfo metadata file. Its dependencies
are fairly light-weight because it needs to be able to run in a mock chroot
environment. It is best to run lorax from the same release as is being targeted
because the templates may have release specific logic in them. eg. Use the
rawhide version to build the boot.iso for rawhide, along with the rawhide
repositories.
lorax cmdline arguments
-----------------------
See the output from ``lorax --help`` for the commandline arguments.
Quickstart
----------
Run this as root to create a boot.iso in ``./results/``::
yum install lorax
setenforce 0
lorax -p RHEL -v 7 -r 7 \
-s http://mirror.centos.org/centos-7/7/os/x86_64/ \
-s http://mirror.centos.org/centos-7/7/updates/x86_64/ \
./results/
setenforce 1
You can add your own repos with ``-s`` and packages with higher NVRs will
override the ones in the distribution repositories.
Under ``./results/`` will be the release tree files: .discinfo, .treeinfo, everything that
goes onto the boot.iso, the pxeboot directory, and the boot.iso under ``./images/``.
Running inside of mock
----------------------
If you are using lorax with mock v1.3.4 or later you will need to pass
``--old-chroot`` to mock. Mock now defaults to using systemd-nspawn which cannot
create the needed loop device nodes. Passing ``--old-chroot`` will use the old
system where ``/dev/loop*`` is setup for you.
How it works
------------
Lorax uses `yum <https://github.com/rpm-software-management/yum>`_ to install
packages into a temporary directory, sets up configuration files, it then
removes unneeded files to save space, and creates a squashfs filesystem of the
files. The iso is then built using a generic initramfs and the kernel from the
selected repositories.
To drive these processes Lorax uses a custom template system, based on `Mako
templates <http://www.makotemplates.org/>`_ with the addition of custom
commands (documented in :class:`pylorax.ltmpl.LoraxTemplateRunner`). Mako
supports ``%if/%endif`` blocks as well as free-form python code inside ``<%
%>`` tags and variable substitution with ``${}``. The default templates are
shipped with lorax in ``/usr/share/lorax/`` and use the
``.tmpl`` extension.
runtime-install.tmpl
~~~~~~~~~~~~~~~~~~~~
The ``runtime-install.tmpl`` template lists packages to be installed using the
``installpkg`` command. This template is fairly simple, installing common packages and
architecture specific packages. It must end with the ``run_pkg_transaction``
command which tells dnf to download and install the packages.
runtime-postinstall.tmpl
~~~~~~~~~~~~~~~~~~~~~~~~
The ``runtime-postinstall.tmpl`` template is where the system configuration
happens. The installer environment is similar to a normal running system, but
needs some special handling. Configuration files are setup, systemd is told to
start the anaconda.target instead of a default system target, and a number of
unneeded services are disabled, some of which can interfere with the
installation. A number of template commands are used here:
* :func:`append <pylorax.ltmpl.LoraxTemplateRunner.append>` to add text to a file.
* :func:`chmod <pylorax.ltmpl.LoraxTemplateRunner.chmod>` changes the file's mode.
* :func:`gconfset <pylorax.ltmpl.LoraxTemplateRunner.gconfset>` runs gconfset.
* :func:`install <pylorax.ltmpl.LoraxTemplateRunner.install>` to install a file into the installroot.
* :func:`mkdir <pylorax.ltmpl.LoraxTemplateRunner.mkdir>` makes a new directory.
* :func:`move <pylorax.ltmpl.LoraxTemplateRunner.move>` to move a file into the installroot
* :func:`replace <pylorax.ltmpl.LoraxTemplateRunner.replace>` does text substitution in a file
* :func:`remove <pylorax.ltmpl.LoraxTemplateRunner.remove>` deletes a file
* :func:`runcmd <pylorax.ltmpl.LoraxTemplateRunner.runcmd>` run arbitrary commands.
* :func:`symlink <pylorax.ltmpl.LoraxTemplateRunner.symlink>` creates a symlink
* :func:`systemctl <pylorax.ltmpl.LoraxTemplateRunner.systemctl>` runs systemctl in the installroot
runtime-cleanup.tmpl
~~~~~~~~~~~~~~~~~~~~
The ``runtime-cleanup.tmpl`` template is used to remove files that aren't strictly needed
by the installation environment. In addition to the ``remove`` template command it uses:
* :func:`removepkg <pylorax.ltmpl.LoraxTemplateRunner.removepkg>`
remove all of a specific package's contents. A package may be pulled in as a dependency, but
not really used. eg. sound support.
* :func:`removefrom <pylorax.ltmpl.LoraxTemplateRunner.removefrom>`
Removes some files from a package. A file glob can be used, or the --allbut option to
remove everything except a select few.
* :func:`removekmod <pylorax.ltmpl.LoraxTemplateRunner.removekmod>`
Removes kernel modules
The squashfs filesystem
~~~~~~~~~~~~~~~~~~~~~~~
After ``runtime-*.tmpl`` 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.iso's installer environment
and is what is in the LiveOS/squashfs.img file on the iso.
iso creation
~~~~~~~~~~~~
The iso creation is handled by another set of templates. The one used depends
on the architecture that the iso is being created for. They are also stored in
``/usr/share/lorax/`` and are named after the arch, like
``x86.tmpl`` and ``aarch64.tmpl``. They handle creation of the tree, copying
configuration template files, configuration variable substitution, treeinfo
metadata (via the :func:`treeinfo <pylorax.ltmpl.LoraxTemplateRunner.treeinfo>`
template command). Kernel and initrd are copied from the installroot to their
final locations and then mkisofs is run to create the boot.iso
Custom Templates
----------------
The default set of templates and configuration files are shipped in the
``/usr/share/lorax/`` directory. You can make a copy of them and place them
into another directory and then select the new template directory by passing
``--sharedir`` to lorax.

View File

@ -1,8 +0,0 @@
src
===
.. toctree::
:maxdepth: 4
composer
pylorax

View File

@ -1,27 +0,0 @@
Product and Updates Images
==========================
Lorax now supports creation of product.img and updates.img as part of the build
process. This is implemented using the installimg template command which will
take the contents of a directory and create a compressed archive from it. The
directory must be created by one of the packages installed by
runtime-install.tmpl or by passing ``--installpkgs <pkgname>`` to lorax at
runtime. The x86, ppc, ppc64le and aarch64 templates all look for
/usr/share/lorax/product/ and /usr/share/lorax/updates/ directories in the
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
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.
Anaconda has several places that it looks for updates, the one for product.img
is in /run/install/product. So for example, to add an installclass to Anaconda
you would put your custom class here:
``/usr/share/lorax/product/run/install/product/pyanaconda/installclasses/custom.py``
If the packages containing the product/updates files are not included as part
of normal dependencies you can add specific packages with the ``--installpkgs``
command or the installpkgs paramater of :class:`pylorax.treebuilder.RuntimeBuilder`

View File

@ -1,94 +0,0 @@
pylorax\.api package
====================
Submodules
----------
pylorax\.api\.compose module
----------------------------
.. automodule:: pylorax.api.compose
:members:
:undoc-members:
:show-inheritance:
pylorax\.api\.config module
---------------------------
.. automodule:: pylorax.api.config
:members:
:undoc-members:
:show-inheritance:
pylorax\.api\.crossdomain module
--------------------------------
.. automodule:: pylorax.api.crossdomain
:members:
:undoc-members:
:show-inheritance:
pylorax\.api\.projects module
-----------------------------
.. automodule:: pylorax.api.projects
:members:
:undoc-members:
:show-inheritance:
pylorax\.api\.queue module
--------------------------
.. automodule:: pylorax.api.queue
:members:
:undoc-members:
:show-inheritance:
pylorax\.api\.recipes module
----------------------------
.. automodule:: pylorax.api.recipes
:members:
:undoc-members:
:show-inheritance:
pylorax\.api\.server module
---------------------------
.. automodule:: pylorax.api.server
:members:
:undoc-members:
:show-inheritance:
pylorax\.api\.v0 module
-----------------------
.. automodule:: pylorax.api.v0
:members:
:undoc-members:
:show-inheritance:
pylorax\.api\.workspace module
------------------------------
.. automodule:: pylorax.api.workspace
:members:
:undoc-members:
:show-inheritance:
pylorax\.api\.yumbase module
----------------------------
.. automodule:: pylorax.api.yumbase
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: pylorax.api
:members:
:undoc-members:
:show-inheritance:

View File

@ -1,141 +0,0 @@
pylorax package
===============
Subpackages
-----------
.. toctree::
pylorax.api
Submodules
----------
pylorax\.base module
--------------------
.. automodule:: pylorax.base
:members:
:undoc-members:
:show-inheritance:
pylorax\.buildstamp module
--------------------------
.. automodule:: pylorax.buildstamp
:members:
:undoc-members:
:show-inheritance:
pylorax\.creator module
-----------------------
.. automodule:: pylorax.creator
:members:
:undoc-members:
:show-inheritance:
pylorax\.decorators module
--------------------------
.. automodule:: pylorax.decorators
:members:
:undoc-members:
:show-inheritance:
pylorax\.discinfo module
------------------------
.. automodule:: pylorax.discinfo
:members:
:undoc-members:
:show-inheritance:
pylorax\.executils module
-------------------------
.. automodule:: pylorax.executils
:members:
:undoc-members:
:show-inheritance:
pylorax\.imgutils module
------------------------
.. automodule:: pylorax.imgutils
:members:
:undoc-members:
:show-inheritance:
pylorax\.installer module
-------------------------
.. automodule:: pylorax.installer
:members:
:undoc-members:
:show-inheritance:
pylorax\.logmonitor module
--------------------------
.. automodule:: pylorax.logmonitor
:members:
:undoc-members:
:show-inheritance:
pylorax\.ltmpl module
---------------------
.. automodule:: pylorax.ltmpl
:members:
:undoc-members:
:show-inheritance:
pylorax\.output module
----------------------
.. automodule:: pylorax.output
:members:
:undoc-members:
:show-inheritance:
pylorax\.sysutils module
------------------------
.. automodule:: pylorax.sysutils
:members:
:undoc-members:
:show-inheritance:
pylorax\.treebuilder module
---------------------------
.. automodule:: pylorax.treebuilder
:members:
:undoc-members:
:show-inheritance:
pylorax\.treeinfo module
------------------------
.. automodule:: pylorax.treeinfo
:members:
:undoc-members:
:show-inheritance:
pylorax\.yumhelper module
-------------------------
.. automodule:: pylorax.yumhelper
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: pylorax
:members:
:undoc-members:
:show-inheritance:

View File

@ -1,261 +0,0 @@
/*
* classic.css_t
* ~~~~~~~~~~~~~
*
* Sphinx stylesheet -- classic theme.
*
* :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@import url("basic.css");
/* -- page layout ----------------------------------------------------------- */
body {
font-family: sans-serif;
font-size: 100%;
background-color: #11303d;
color: #000;
margin: 0;
padding: 0;
}
div.document {
background-color: #1c4e63;
}
div.documentwrapper {
float: left;
width: 100%;
}
div.bodywrapper {
margin: 0 0 0 230px;
}
div.body {
background-color: #ffffff;
color: #000000;
padding: 0 20px 30px 20px;
}
div.footer {
color: #ffffff;
width: 100%;
padding: 9px 0 9px 0;
text-align: center;
font-size: 75%;
}
div.footer a {
color: #ffffff;
text-decoration: underline;
}
div.related {
background-color: #133f52;
line-height: 30px;
color: #ffffff;
}
div.related a {
color: #ffffff;
}
div.sphinxsidebar {
}
div.sphinxsidebar h3 {
font-family: 'Trebuchet MS', sans-serif;
color: #ffffff;
font-size: 1.4em;
font-weight: normal;
margin: 0;
padding: 0;
}
div.sphinxsidebar h3 a {
color: #ffffff;
}
div.sphinxsidebar h4 {
font-family: 'Trebuchet MS', sans-serif;
color: #ffffff;
font-size: 1.3em;
font-weight: normal;
margin: 5px 0 0 0;
padding: 0;
}
div.sphinxsidebar p {
color: #ffffff;
}
div.sphinxsidebar p.topless {
margin: 5px 10px 10px 10px;
}
div.sphinxsidebar ul {
margin: 10px;
padding: 0;
color: #ffffff;
}
div.sphinxsidebar a {
color: #98dbcc;
}
div.sphinxsidebar input {
border: 1px solid #98dbcc;
font-family: sans-serif;
font-size: 1em;
}
/* -- hyperlink styles ------------------------------------------------------ */
a {
color: #355f7c;
text-decoration: none;
}
a:visited {
color: #355f7c;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
/* -- body styles ----------------------------------------------------------- */
div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6 {
font-family: 'Trebuchet MS', sans-serif;
background-color: #f2f2f2;
font-weight: normal;
color: #20435c;
border-bottom: 1px solid #ccc;
margin: 20px -20px 10px -20px;
padding: 3px 0 3px 10px;
}
div.body h1 { margin-top: 0; font-size: 200%; }
div.body h2 { font-size: 160%; }
div.body h3 { font-size: 140%; }
div.body h4 { font-size: 120%; }
div.body h5 { font-size: 110%; }
div.body h6 { font-size: 100%; }
a.headerlink {
color: #c60f0f;
font-size: 0.8em;
padding: 0 4px 0 4px;
text-decoration: none;
}
a.headerlink:hover {
background-color: #c60f0f;
color: white;
}
div.body p, div.body dd, div.body li, div.body blockquote {
text-align: justify;
line-height: 130%;
}
div.admonition p.admonition-title + p {
display: inline;
}
div.admonition p {
margin-bottom: 5px;
}
div.admonition pre {
margin-bottom: 5px;
}
div.admonition ul, div.admonition ol {
margin-bottom: 5px;
}
div.note {
background-color: #eee;
border: 1px solid #ccc;
}
div.seealso {
background-color: #ffc;
border: 1px solid #ff6;
}
div.topic {
background-color: #eee;
}
div.warning {
background-color: #ffe4e4;
border: 1px solid #f66;
}
p.admonition-title {
display: inline;
}
p.admonition-title:after {
content: ":";
}
pre {
padding: 5px;
background-color: #eeffcc;
color: #333333;
line-height: 120%;
border: 1px solid #ac9;
border-left: none;
border-right: none;
}
code {
background-color: #ecf0f3;
padding: 0 1px 0 1px;
font-size: 0.95em;
}
th {
background-color: #ede;
}
.warning code {
background: #efc2c2;
}
.note code {
background: #d6d6d6;
}
.viewcode-back {
font-family: sans-serif;
}
div.viewcode-block:target {
background-color: #f4debf;
border-top: 1px solid #ac9;
border-bottom: 1px solid #ac9;
}
div.code-block-caption {
color: #efefef;
background-color: #1c4e63;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,999 +0,0 @@
// Underscore.js 1.3.1
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
// Underscore is freely distributable under the MIT license.
// Portions of Underscore are inspired or borrowed from Prototype,
// Oliver Steele's Functional, and John Resig's Micro-Templating.
// For all details and documentation:
// http://documentcloud.github.com/underscore
(function() {
// Baseline setup
// --------------
// Establish the root object, `window` in the browser, or `global` on the server.
var root = this;
// Save the previous value of the `_` variable.
var previousUnderscore = root._;
// Establish the object that gets returned to break out of a loop iteration.
var breaker = {};
// Save bytes in the minified (but not gzipped) version:
var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
// Create quick reference variables for speed access to core prototypes.
var slice = ArrayProto.slice,
unshift = ArrayProto.unshift,
toString = ObjProto.toString,
hasOwnProperty = ObjProto.hasOwnProperty;
// All **ECMAScript 5** native function implementations that we hope to use
// are declared here.
var
nativeForEach = ArrayProto.forEach,
nativeMap = ArrayProto.map,
nativeReduce = ArrayProto.reduce,
nativeReduceRight = ArrayProto.reduceRight,
nativeFilter = ArrayProto.filter,
nativeEvery = ArrayProto.every,
nativeSome = ArrayProto.some,
nativeIndexOf = ArrayProto.indexOf,
nativeLastIndexOf = ArrayProto.lastIndexOf,
nativeIsArray = Array.isArray,
nativeKeys = Object.keys,
nativeBind = FuncProto.bind;
// Create a safe reference to the Underscore object for use below.
var _ = function(obj) { return new wrapper(obj); };
// Export the Underscore object for **Node.js**, with
// backwards-compatibility for the old `require()` API. If we're in
// the browser, add `_` as a global object via a string identifier,
// for Closure Compiler "advanced" mode.
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = _;
}
exports._ = _;
} else {
root['_'] = _;
}
// Current version.
_.VERSION = '1.3.1';
// Collection Functions
// --------------------
// The cornerstone, an `each` implementation, aka `forEach`.
// Handles objects with the built-in `forEach`, arrays, and raw objects.
// Delegates to **ECMAScript 5**'s native `forEach` if available.
var each = _.each = _.forEach = function(obj, iterator, context) {
if (obj == null) return;
if (nativeForEach && obj.forEach === nativeForEach) {
obj.forEach(iterator, context);
} else if (obj.length === +obj.length) {
for (var i = 0, l = obj.length; i < l; i++) {
if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) return;
}
} else {
for (var key in obj) {
if (_.has(obj, key)) {
if (iterator.call(context, obj[key], key, obj) === breaker) return;
}
}
}
};
// Return the results of applying the iterator to each element.
// Delegates to **ECMAScript 5**'s native `map` if available.
_.map = _.collect = function(obj, iterator, context) {
var results = [];
if (obj == null) return results;
if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
each(obj, function(value, index, list) {
results[results.length] = iterator.call(context, value, index, list);
});
if (obj.length === +obj.length) results.length = obj.length;
return results;
};
// **Reduce** builds up a single result from a list of values, aka `inject`,
// or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
_.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
var initial = arguments.length > 2;
if (obj == null) obj = [];
if (nativeReduce && obj.reduce === nativeReduce) {
if (context) iterator = _.bind(iterator, context);
return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);
}
each(obj, function(value, index, list) {
if (!initial) {
memo = value;
initial = true;
} else {
memo = iterator.call(context, memo, value, index, list);
}
});
if (!initial) throw new TypeError('Reduce of empty array with no initial value');
return memo;
};
// The right-associative version of reduce, also known as `foldr`.
// Delegates to **ECMAScript 5**'s native `reduceRight` if available.
_.reduceRight = _.foldr = function(obj, iterator, memo, context) {
var initial = arguments.length > 2;
if (obj == null) obj = [];
if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
if (context) iterator = _.bind(iterator, context);
return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
}
var reversed = _.toArray(obj).reverse();
if (context && !initial) iterator = _.bind(iterator, context);
return initial ? _.reduce(reversed, iterator, memo, context) : _.reduce(reversed, iterator);
};
// Return the first value which passes a truth test. Aliased as `detect`.
_.find = _.detect = function(obj, iterator, context) {
var result;
any(obj, function(value, index, list) {
if (iterator.call(context, value, index, list)) {
result = value;
return true;
}
});
return result;
};
// Return all the elements that pass a truth test.
// Delegates to **ECMAScript 5**'s native `filter` if available.
// Aliased as `select`.
_.filter = _.select = function(obj, iterator, context) {
var results = [];
if (obj == null) return results;
if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context);
each(obj, function(value, index, list) {
if (iterator.call(context, value, index, list)) results[results.length] = value;
});
return results;
};
// Return all the elements for which a truth test fails.
_.reject = function(obj, iterator, context) {
var results = [];
if (obj == null) return results;
each(obj, function(value, index, list) {
if (!iterator.call(context, value, index, list)) results[results.length] = value;
});
return results;
};
// Determine whether all of the elements match a truth test.
// Delegates to **ECMAScript 5**'s native `every` if available.
// Aliased as `all`.
_.every = _.all = function(obj, iterator, context) {
var result = true;
if (obj == null) return result;
if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context);
each(obj, function(value, index, list) {
if (!(result = result && iterator.call(context, value, index, list))) return breaker;
});
return result;
};
// Determine if at least one element in the object matches a truth test.
// Delegates to **ECMAScript 5**'s native `some` if available.
// Aliased as `any`.
var any = _.some = _.any = function(obj, iterator, context) {
iterator || (iterator = _.identity);
var result = false;
if (obj == null) return result;
if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context);
each(obj, function(value, index, list) {
if (result || (result = iterator.call(context, value, index, list))) return breaker;
});
return !!result;
};
// Determine if a given value is included in the array or object using `===`.
// Aliased as `contains`.
_.include = _.contains = function(obj, target) {
var found = false;
if (obj == null) return found;
if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
found = any(obj, function(value) {
return value === target;
});
return found;
};
// Invoke a method (with arguments) on every item in a collection.
_.invoke = function(obj, method) {
var args = slice.call(arguments, 2);
return _.map(obj, function(value) {
return (_.isFunction(method) ? method || value : value[method]).apply(value, args);
});
};
// Convenience version of a common use case of `map`: fetching a property.
_.pluck = function(obj, key) {
return _.map(obj, function(value){ return value[key]; });
};
// Return the maximum element or (element-based computation).
_.max = function(obj, iterator, context) {
if (!iterator && _.isArray(obj)) return Math.max.apply(Math, obj);
if (!iterator && _.isEmpty(obj)) return -Infinity;
var result = {computed : -Infinity};
each(obj, function(value, index, list) {
var computed = iterator ? iterator.call(context, value, index, list) : value;
computed >= result.computed && (result = {value : value, computed : computed});
});
return result.value;
};
// Return the minimum element (or element-based computation).
_.min = function(obj, iterator, context) {
if (!iterator && _.isArray(obj)) return Math.min.apply(Math, obj);
if (!iterator && _.isEmpty(obj)) return Infinity;
var result = {computed : Infinity};
each(obj, function(value, index, list) {
var computed = iterator ? iterator.call(context, value, index, list) : value;
computed < result.computed && (result = {value : value, computed : computed});
});
return result.value;
};
// Shuffle an array.
_.shuffle = function(obj) {
var shuffled = [], rand;
each(obj, function(value, index, list) {
if (index == 0) {
shuffled[0] = value;
} else {
rand = Math.floor(Math.random() * (index + 1));
shuffled[index] = shuffled[rand];
shuffled[rand] = value;
}
});
return shuffled;
};
// Sort the object's values by a criterion produced by an iterator.
_.sortBy = function(obj, iterator, context) {
return _.pluck(_.map(obj, function(value, index, list) {
return {
value : value,
criteria : iterator.call(context, value, index, list)
};
}).sort(function(left, right) {
var a = left.criteria, b = right.criteria;
return a < b ? -1 : a > b ? 1 : 0;
}), 'value');
};
// Groups the object's values by a criterion. Pass either a string attribute
// to group by, or a function that returns the criterion.
_.groupBy = function(obj, val) {
var result = {};
var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; };
each(obj, function(value, index) {
var key = iterator(value, index);
(result[key] || (result[key] = [])).push(value);
});
return result;
};
// Use a comparator function to figure out at what index an object should
// be inserted so as to maintain order. Uses binary search.
_.sortedIndex = function(array, obj, iterator) {
iterator || (iterator = _.identity);
var low = 0, high = array.length;
while (low < high) {
var mid = (low + high) >> 1;
iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid;
}
return low;
};
// Safely convert anything iterable into a real, live array.
_.toArray = function(iterable) {
if (!iterable) return [];
if (iterable.toArray) return iterable.toArray();
if (_.isArray(iterable)) return slice.call(iterable);
if (_.isArguments(iterable)) return slice.call(iterable);
return _.values(iterable);
};
// Return the number of elements in an object.
_.size = function(obj) {
return _.toArray(obj).length;
};
// Array Functions
// ---------------
// Get the first element of an array. Passing **n** will return the first N
// values in the array. Aliased as `head`. The **guard** check allows it to work
// with `_.map`.
_.first = _.head = function(array, n, guard) {
return (n != null) && !guard ? slice.call(array, 0, n) : array[0];
};
// Returns everything but the last entry of the array. Especcialy useful on
// the arguments object. Passing **n** will return all the values in
// the array, excluding the last N. The **guard** check allows it to work with
// `_.map`.
_.initial = function(array, n, guard) {
return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n));
};
// Get the last element of an array. Passing **n** will return the last N
// values in the array. The **guard** check allows it to work with `_.map`.
_.last = function(array, n, guard) {
if ((n != null) && !guard) {
return slice.call(array, Math.max(array.length - n, 0));
} else {
return array[array.length - 1];
}
};
// Returns everything but the first entry of the array. Aliased as `tail`.
// Especially useful on the arguments object. Passing an **index** will return
// the rest of the values in the array from that index onward. The **guard**
// check allows it to work with `_.map`.
_.rest = _.tail = function(array, index, guard) {
return slice.call(array, (index == null) || guard ? 1 : index);
};
// Trim out all falsy values from an array.
_.compact = function(array) {
return _.filter(array, function(value){ return !!value; });
};
// Return a completely flattened version of an array.
_.flatten = function(array, shallow) {
return _.reduce(array, function(memo, value) {
if (_.isArray(value)) return memo.concat(shallow ? value : _.flatten(value));
memo[memo.length] = value;
return memo;
}, []);
};
// Return a version of the array that does not contain the specified value(s).
_.without = function(array) {
return _.difference(array, slice.call(arguments, 1));
};
// Produce a duplicate-free version of the array. If the array has already
// been sorted, you have the option of using a faster algorithm.
// Aliased as `unique`.
_.uniq = _.unique = function(array, isSorted, iterator) {
var initial = iterator ? _.map(array, iterator) : array;
var result = [];
_.reduce(initial, function(memo, el, i) {
if (0 == i || (isSorted === true ? _.last(memo) != el : !_.include(memo, el))) {
memo[memo.length] = el;
result[result.length] = array[i];
}
return memo;
}, []);
return result;
};
// Produce an array that contains the union: each distinct element from all of
// the passed-in arrays.
_.union = function() {
return _.uniq(_.flatten(arguments, true));
};
// Produce an array that contains every item shared between all the
// passed-in arrays. (Aliased as "intersect" for back-compat.)
_.intersection = _.intersect = function(array) {
var rest = slice.call(arguments, 1);
return _.filter(_.uniq(array), function(item) {
return _.every(rest, function(other) {
return _.indexOf(other, item) >= 0;
});
});
};
// Take the difference between one array and a number of other arrays.
// Only the elements present in just the first array will remain.
_.difference = function(array) {
var rest = _.flatten(slice.call(arguments, 1));
return _.filter(array, function(value){ return !_.include(rest, value); });
};
// Zip together multiple lists into a single array -- elements that share
// an index go together.
_.zip = function() {
var args = slice.call(arguments);
var length = _.max(_.pluck(args, 'length'));
var results = new Array(length);
for (var i = 0; i < length; i++) results[i] = _.pluck(args, "" + i);
return results;
};
// If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),
// we need this function. Return the position of the first occurrence of an
// item in an array, or -1 if the item is not included in the array.
// Delegates to **ECMAScript 5**'s native `indexOf` if available.
// If the array is large and already in sort order, pass `true`
// for **isSorted** to use binary search.
_.indexOf = function(array, item, isSorted) {
if (array == null) return -1;
var i, l;
if (isSorted) {
i = _.sortedIndex(array, item);
return array[i] === item ? i : -1;
}
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);
for (i = 0, l = array.length; i < l; i++) if (i in array && array[i] === item) return i;
return -1;
};
// Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.
_.lastIndexOf = function(array, item) {
if (array == null) return -1;
if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) return array.lastIndexOf(item);
var i = array.length;
while (i--) if (i in array && array[i] === item) return i;
return -1;
};
// Generate an integer Array containing an arithmetic progression. A port of
// the native Python `range()` function. See
// [the Python documentation](http://docs.python.org/library/functions.html#range).
_.range = function(start, stop, step) {
if (arguments.length <= 1) {
stop = start || 0;
start = 0;
}
step = arguments[2] || 1;
var len = Math.max(Math.ceil((stop - start) / step), 0);
var idx = 0;
var range = new Array(len);
while(idx < len) {
range[idx++] = start;
start += step;
}
return range;
};
// Function (ahem) Functions
// ------------------
// Reusable constructor function for prototype setting.
var ctor = function(){};
// Create a function bound to a given object (assigning `this`, and arguments,
// optionally). Binding with arguments is also known as `curry`.
// Delegates to **ECMAScript 5**'s native `Function.bind` if available.
// We check for `func.bind` first, to fail fast when `func` is undefined.
_.bind = function bind(func, context) {
var bound, args;
if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
if (!_.isFunction(func)) throw new TypeError;
args = slice.call(arguments, 2);
return bound = function() {
if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
ctor.prototype = func.prototype;
var self = new ctor;
var result = func.apply(self, args.concat(slice.call(arguments)));
if (Object(result) === result) return result;
return self;
};
};
// Bind all of an object's methods to that object. Useful for ensuring that
// all callbacks defined on an object belong to it.
_.bindAll = function(obj) {
var funcs = slice.call(arguments, 1);
if (funcs.length == 0) funcs = _.functions(obj);
each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
return obj;
};
// Memoize an expensive function by storing its results.
_.memoize = function(func, hasher) {
var memo = {};
hasher || (hasher = _.identity);
return function() {
var key = hasher.apply(this, arguments);
return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));
};
};
// Delays a function for the given number of milliseconds, and then calls
// it with the arguments supplied.
_.delay = function(func, wait) {
var args = slice.call(arguments, 2);
return setTimeout(function(){ return func.apply(func, args); }, wait);
};
// Defers a function, scheduling it to run after the current call stack has
// cleared.
_.defer = function(func) {
return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1)));
};
// Returns a function, that, when invoked, will only be triggered at most once
// during a given window of time.
_.throttle = function(func, wait) {
var context, args, timeout, throttling, more;
var whenDone = _.debounce(function(){ more = throttling = false; }, wait);
return function() {
context = this; args = arguments;
var later = function() {
timeout = null;
if (more) func.apply(context, args);
whenDone();
};
if (!timeout) timeout = setTimeout(later, wait);
if (throttling) {
more = true;
} else {
func.apply(context, args);
}
whenDone();
throttling = true;
};
};
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds.
_.debounce = function(func, wait) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
func.apply(context, args);
};
clearTimeout(timeout);
timeout = setTimeout(later, wait);
};
};
// Returns a function that will be executed at most one time, no matter how
// often you call it. Useful for lazy initialization.
_.once = function(func) {
var ran = false, memo;
return function() {
if (ran) return memo;
ran = true;
return memo = func.apply(this, arguments);
};
};
// Returns the first function passed as an argument to the second,
// allowing you to adjust arguments, run code before and after, and
// conditionally execute the original function.
_.wrap = function(func, wrapper) {
return function() {
var args = [func].concat(slice.call(arguments, 0));
return wrapper.apply(this, args);
};
};
// Returns a function that is the composition of a list of functions, each
// consuming the return value of the function that follows.
_.compose = function() {
var funcs = arguments;
return function() {
var args = arguments;
for (var i = funcs.length - 1; i >= 0; i--) {
args = [funcs[i].apply(this, args)];
}
return args[0];
};
};
// Returns a function that will only be executed after being called N times.
_.after = function(times, func) {
if (times <= 0) return func();
return function() {
if (--times < 1) { return func.apply(this, arguments); }
};
};
// Object Functions
// ----------------
// Retrieve the names of an object's properties.
// Delegates to **ECMAScript 5**'s native `Object.keys`
_.keys = nativeKeys || function(obj) {
if (obj !== Object(obj)) throw new TypeError('Invalid object');
var keys = [];
for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key;
return keys;
};
// Retrieve the values of an object's properties.
_.values = function(obj) {
return _.map(obj, _.identity);
};
// Return a sorted list of the function names available on the object.
// Aliased as `methods`
_.functions = _.methods = function(obj) {
var names = [];
for (var key in obj) {
if (_.isFunction(obj[key])) names.push(key);
}
return names.sort();
};
// Extend a given object with all the properties in passed-in object(s).
_.extend = function(obj) {
each(slice.call(arguments, 1), function(source) {
for (var prop in source) {
obj[prop] = source[prop];
}
});
return obj;
};
// Fill in a given object with default properties.
_.defaults = function(obj) {
each(slice.call(arguments, 1), function(source) {
for (var prop in source) {
if (obj[prop] == null) obj[prop] = source[prop];
}
});
return obj;
};
// Create a (shallow-cloned) duplicate of an object.
_.clone = function(obj) {
if (!_.isObject(obj)) return obj;
return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
};
// Invokes interceptor with the obj, and then returns obj.
// The primary purpose of this method is to "tap into" a method chain, in
// order to perform operations on intermediate results within the chain.
_.tap = function(obj, interceptor) {
interceptor(obj);
return obj;
};
// Internal recursive comparison function.
function eq(a, b, stack) {
// Identical objects are equal. `0 === -0`, but they aren't identical.
// See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.
if (a === b) return a !== 0 || 1 / a == 1 / b;
// A strict comparison is necessary because `null == undefined`.
if (a == null || b == null) return a === b;
// Unwrap any wrapped objects.
if (a._chain) a = a._wrapped;
if (b._chain) b = b._wrapped;
// Invoke a custom `isEqual` method if one is provided.
if (a.isEqual && _.isFunction(a.isEqual)) return a.isEqual(b);
if (b.isEqual && _.isFunction(b.isEqual)) return b.isEqual(a);
// Compare `[[Class]]` names.
var className = toString.call(a);
if (className != toString.call(b)) return false;
switch (className) {
// Strings, numbers, dates, and booleans are compared by value.
case '[object String]':
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
// equivalent to `new String("5")`.
return a == String(b);
case '[object Number]':
// `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
// other numeric values.
return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b);
case '[object Date]':
case '[object Boolean]':
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
// millisecond representations. Note that invalid dates with millisecond representations
// of `NaN` are not equivalent.
return +a == +b;
// RegExps are compared by their source patterns and flags.
case '[object RegExp]':
return a.source == b.source &&
a.global == b.global &&
a.multiline == b.multiline &&
a.ignoreCase == b.ignoreCase;
}
if (typeof a != 'object' || typeof b != 'object') return false;
// Assume equality for cyclic structures. The algorithm for detecting cyclic
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
var length = stack.length;
while (length--) {
// Linear search. Performance is inversely proportional to the number of
// unique nested structures.
if (stack[length] == a) return true;
}
// Add the first object to the stack of traversed objects.
stack.push(a);
var size = 0, result = true;
// Recursively compare objects and arrays.
if (className == '[object Array]') {
// Compare array lengths to determine if a deep comparison is necessary.
size = a.length;
result = size == b.length;
if (result) {
// Deep compare the contents, ignoring non-numeric properties.
while (size--) {
// Ensure commutative equality for sparse arrays.
if (!(result = size in a == size in b && eq(a[size], b[size], stack))) break;
}
}
} else {
// Objects with different constructors are not equivalent.
if ('constructor' in a != 'constructor' in b || a.constructor != b.constructor) return false;
// Deep compare objects.
for (var key in a) {
if (_.has(a, key)) {
// Count the expected number of properties.
size++;
// Deep compare each member.
if (!(result = _.has(b, key) && eq(a[key], b[key], stack))) break;
}
}
// Ensure that both objects contain the same number of properties.
if (result) {
for (key in b) {
if (_.has(b, key) && !(size--)) break;
}
result = !size;
}
}
// Remove the first object from the stack of traversed objects.
stack.pop();
return result;
}
// Perform a deep comparison to check if two objects are equal.
_.isEqual = function(a, b) {
return eq(a, b, []);
};
// Is a given array, string, or object empty?
// An "empty" object has no enumerable own-properties.
_.isEmpty = function(obj) {
if (_.isArray(obj) || _.isString(obj)) return obj.length === 0;
for (var key in obj) if (_.has(obj, key)) return false;
return true;
};
// Is a given value a DOM element?
_.isElement = function(obj) {
return !!(obj && obj.nodeType == 1);
};
// Is a given value an array?
// Delegates to ECMA5's native Array.isArray
_.isArray = nativeIsArray || function(obj) {
return toString.call(obj) == '[object Array]';
};
// Is a given variable an object?
_.isObject = function(obj) {
return obj === Object(obj);
};
// Is a given variable an arguments object?
_.isArguments = function(obj) {
return toString.call(obj) == '[object Arguments]';
};
if (!_.isArguments(arguments)) {
_.isArguments = function(obj) {
return !!(obj && _.has(obj, 'callee'));
};
}
// Is a given value a function?
_.isFunction = function(obj) {
return toString.call(obj) == '[object Function]';
};
// Is a given value a string?
_.isString = function(obj) {
return toString.call(obj) == '[object String]';
};
// Is a given value a number?
_.isNumber = function(obj) {
return toString.call(obj) == '[object Number]';
};
// Is the given value `NaN`?
_.isNaN = function(obj) {
// `NaN` is the only value for which `===` is not reflexive.
return obj !== obj;
};
// Is a given value a boolean?
_.isBoolean = function(obj) {
return obj === true || obj === false || toString.call(obj) == '[object Boolean]';
};
// Is a given value a date?
_.isDate = function(obj) {
return toString.call(obj) == '[object Date]';
};
// Is the given value a regular expression?
_.isRegExp = function(obj) {
return toString.call(obj) == '[object RegExp]';
};
// Is a given value equal to null?
_.isNull = function(obj) {
return obj === null;
};
// Is a given variable undefined?
_.isUndefined = function(obj) {
return obj === void 0;
};
// Has own property?
_.has = function(obj, key) {
return hasOwnProperty.call(obj, key);
};
// Utility Functions
// -----------------
// Run Underscore.js in *noConflict* mode, returning the `_` variable to its
// previous owner. Returns a reference to the Underscore object.
_.noConflict = function() {
root._ = previousUnderscore;
return this;
};
// Keep the identity function around for default iterators.
_.identity = function(value) {
return value;
};
// Run a function **n** times.
_.times = function (n, iterator, context) {
for (var i = 0; i < n; i++) iterator.call(context, i);
};
// Escape a string for HTML interpolation.
_.escape = function(string) {
return (''+string).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#x27;').replace(/\//g,'&#x2F;');
};
// Add your own custom functions to the Underscore object, ensuring that
// they're correctly added to the OOP wrapper as well.
_.mixin = function(obj) {
each(_.functions(obj), function(name){
addToWrapper(name, _[name] = obj[name]);
});
};
// Generate a unique integer id (unique within the entire client session).
// Useful for temporary DOM ids.
var idCounter = 0;
_.uniqueId = function(prefix) {
var id = idCounter++;
return prefix ? prefix + id : id;
};
// By default, Underscore uses ERB-style template delimiters, change the
// following template settings to use alternative delimiters.
_.templateSettings = {
evaluate : /<%([\s\S]+?)%>/g,
interpolate : /<%=([\s\S]+?)%>/g,
escape : /<%-([\s\S]+?)%>/g
};
// When customizing `templateSettings`, if you don't want to define an
// interpolation, evaluation or escaping regex, we need one that is
// guaranteed not to match.
var noMatch = /.^/;
// Within an interpolation, evaluation, or escaping, remove HTML escaping
// that had been previously added.
var unescape = function(code) {
return code.replace(/\\\\/g, '\\').replace(/\\'/g, "'");
};
// JavaScript micro-templating, similar to John Resig's implementation.
// Underscore templating handles arbitrary delimiters, preserves whitespace,
// and correctly escapes quotes within interpolated code.
_.template = function(str, data) {
var c = _.templateSettings;
var tmpl = 'var __p=[],print=function(){__p.push.apply(__p,arguments);};' +
'with(obj||{}){__p.push(\'' +
str.replace(/\\/g, '\\\\')
.replace(/'/g, "\\'")
.replace(c.escape || noMatch, function(match, code) {
return "',_.escape(" + unescape(code) + "),'";
})
.replace(c.interpolate || noMatch, function(match, code) {
return "'," + unescape(code) + ",'";
})
.replace(c.evaluate || noMatch, function(match, code) {
return "');" + unescape(code).replace(/[\r\n\t]/g, ' ') + ";__p.push('";
})
.replace(/\r/g, '\\r')
.replace(/\n/g, '\\n')
.replace(/\t/g, '\\t')
+ "');}return __p.join('');";
var func = new Function('obj', '_', tmpl);
if (data) return func(data, _);
return function(data) {
return func.call(this, data, _);
};
};
// Add a "chain" function, which will delegate to the wrapper.
_.chain = function(obj) {
return _(obj).chain();
};
// The OOP Wrapper
// ---------------
// If Underscore is called as a function, it returns a wrapped object that
// can be used OO-style. This wrapper holds altered versions of all the
// underscore functions. Wrapped objects may be chained.
var wrapper = function(obj) { this._wrapped = obj; };
// Expose `wrapper.prototype` as `_.prototype`
_.prototype = wrapper.prototype;
// Helper function to continue chaining intermediate results.
var result = function(obj, chain) {
return chain ? _(obj).chain() : obj;
};
// A method to easily add functions to the OOP wrapper.
var addToWrapper = function(name, func) {
wrapper.prototype[name] = function() {
var args = slice.call(arguments);
unshift.call(args, this._wrapped);
return result(func.apply(_, args), this._chain);
};
};
// Add all of the Underscore functions to the wrapper object.
_.mixin(_);
// Add all mutator Array functions to the wrapper.
each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
var method = ArrayProto[name];
wrapper.prototype[name] = function() {
var wrapped = this._wrapped;
method.apply(wrapped, arguments);
var length = wrapped.length;
if ((name == 'shift' || name == 'splice') && length === 0) delete wrapped[0];
return result(wrapped, this._chain);
};
});
// Add all accessor Array functions to the wrapper.
each(['concat', 'join', 'slice'], function(name) {
var method = ArrayProto[name];
wrapper.prototype[name] = function() {
return result(method.apply(this._wrapped, arguments), this._chain);
};
});
// Start chaining a wrapped Underscore object.
wrapper.prototype.chain = function() {
this._chain = true;
return this;
};
// Extracts the result from a wrapped and chained object.
wrapper.prototype.value = function() {
return this._wrapped;
};
}).call(this);

View File

@ -0,0 +1,180 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>composer-cli &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</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>
<link rel="top" title="Lorax 19.7.18 documentation" href="index.html" />
<link rel="next" title="Product and Updates Images" href="product-images.html" />
<link rel="prev" title="lorax-composer" href="lorax-composer.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="product-images.html" title="Product and Updates Images"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="lorax-composer.html" title="lorax-composer"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="composer-cli">
<h1>composer-cli<a class="headerlink" href="#composer-cli" title="Permalink to this headline"></a></h1>
<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">Authors:</th><td class="field-body">Brian C. Lane &lt;<a class="reference external" href="mailto:bcl&#37;&#52;&#48;redhat&#46;com">bcl<span>&#64;</span>redhat<span>&#46;</span>com</a>&gt;</td>
</tr>
</tbody>
</table>
<p><tt class="docutils literal"><span class="pre">composer-cli</span></tt> is used to interact with the <tt class="docutils literal"><span class="pre">lorax-composer</span></tt> API server, managing blueprints, exploring available packages, and building new images.</p>
<p>It requires <a class="reference external" href="lorax-composer.html">lorax-composer</a> to be installed on the
local system, and the user running it needs to be a member of the <tt class="docutils literal"><span class="pre">weldr</span></tt>
group. They do not need to be root, but all of the <a class="reference external" href="lorax-composer.html#security">security precautions</a> apply.</p>
<div class="section" id="composer-cli-cmdline-arguments">
<h2>composer-cli cmdline arguments<a class="headerlink" href="#composer-cli-cmdline-arguments" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="edit-a-blueprint">
<h2>Edit a Blueprint<a class="headerlink" href="#edit-a-blueprint" title="Permalink to this headline"></a></h2>
<p>Start out by listing the available blueprints using <tt class="docutils literal"><span class="pre">composer-cli</span> <span class="pre">blueprints</span>
<span class="pre">list</span></tt>, pick one and save it to the local directory by running <tt class="docutils literal"><span class="pre">composer-cli</span>
<span class="pre">blueprints</span> <span class="pre">save</span> <span class="pre">http-server</span></tt>. If there are no blueprints available you can
copy one of the examples <a class="reference external" href="https://github.com/weldr/lorax/tree/master/tests/pylorax/blueprints/">from the test suite</a>.</p>
<p>Edit the file (it will be saved with a .toml extension) and change the
description, add a package or module to it. Send it back to the server by
running <tt class="docutils literal"><span class="pre">composer-cli</span> <span class="pre">blueprints</span> <span class="pre">push</span> <span class="pre">http-server.toml</span></tt>. You can verify that it was
saved by viewing the changelog - <tt class="docutils literal"><span class="pre">composer-cli</span> <span class="pre">blueprints</span> <span class="pre">changes</span> <span class="pre">http-server</span></tt>.</p>
</div>
<div class="section" id="build-an-image">
<h2>Build an image<a class="headerlink" href="#build-an-image" title="Permalink to this headline"></a></h2>
<p>Build a <tt class="docutils literal"><span class="pre">qcow2</span></tt> disk image from this blueprint by running <tt class="docutils literal"><span class="pre">composer-cli</span>
<span class="pre">compose</span> <span class="pre">start</span> <span class="pre">http-server</span> <span class="pre">qcow2</span></tt>. It will print a UUID that you can use to
keep track of the build. You can also cancel the build if needed.</p>
<p>The available types of images is displayed by <tt class="docutils literal"><span class="pre">composer-cli</span> <span class="pre">compose</span> <span class="pre">types</span></tt>.
Currently this consists of: ext4-filesystem, live-iso, partitioned-disk, qcow2,
tar</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>
<p>Monitor it using <tt class="docutils literal"><span class="pre">composer-cli</span> <span class="pre">compose</span> <span class="pre">status</span></tt>, which will show the status of
all the builds on the system. You can view the end of the anaconda build logs
once it is in the <tt class="docutils literal"><span class="pre">RUNNING</span></tt> state using <tt class="docutils literal"><span class="pre">composer-cli</span> <span class="pre">compose</span> <span class="pre">log</span> <span class="pre">UUID</span></tt>
where UUID is the UUID returned by the start command.</p>
<p>Once the build is in the <tt class="docutils literal"><span class="pre">FINISHED</span></tt> state you can download the image.</p>
</div>
<div class="section" id="download-the-image">
<h2>Download the image<a class="headerlink" href="#download-the-image" title="Permalink to this headline"></a></h2>
<p>Downloading the final image is done with <tt class="docutils literal"><span class="pre">composer-cli</span> <span class="pre">compose</span> <span class="pre">image</span> <span class="pre">UUID</span></tt> and it will
save the qcow2 image as <tt class="docutils literal"><span class="pre">UUID-disk.qcow2</span></tt> which you can then use to boot a VM like this:</p>
<div class="highlight-python"><pre>qemu-kvm --name test-image -m 1024 -hda ./UUID-disk.qcow2</pre>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">composer-cli</a><ul>
<li><a class="reference internal" href="#composer-cli-cmdline-arguments">composer-cli cmdline arguments</a></li>
<li><a class="reference internal" href="#edit-a-blueprint">Edit a Blueprint</a></li>
<li><a class="reference internal" href="#build-an-image">Build an image</a></li>
<li><a class="reference internal" href="#monitor-the-build-status">Monitor the build status</a></li>
<li><a class="reference internal" href="#download-the-image">Download the image</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="lorax-composer.html"
title="previous chapter">lorax-composer</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="product-images.html"
title="next chapter">Product and Updates Images</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/composer-cli.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="product-images.html" title="Product and Updates Images"
>next</a> |</li>
<li class="right" >
<a href="lorax-composer.html" title="lorax-composer"
>previous</a> |</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2018, Red Hat, Inc..
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cli Package &mdash; Lorax 19.7.15 documentation</title>
<title>cli Package &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="index.html" />
<link rel="up" title="composer Package" href="composer.html" />
<link rel="next" title="pylorax Package" href="pylorax.html" />
<link rel="prev" title="composer Package" href="composer.html" />
@ -46,7 +46,7 @@
<li class="right" >
<a href="composer.html" title="composer Package"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="modules.html" >src</a> &raquo;</li>
<li><a href="composer.html" accesskey="U">composer Package</a> &raquo;</li>
</ul>
@ -710,6 +710,9 @@ and failed so raw JSON output is not available.</p>
include this extra information.</p>
</dd></dl>
</div>
<div class="section" id="module-composer.cli.help">
<span id="help-module"></span><h2><tt class="xref py py-mod docutils literal"><span class="pre">help</span></tt> Module<a class="headerlink" href="#module-composer.cli.help" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-composer.cli.modules">
<span id="modules-module"></span><h2><tt class="xref py py-mod docutils literal"><span class="pre">modules</span></tt> Module<a class="headerlink" href="#module-composer.cli.modules" title="Permalink to this headline"></a></h2>
@ -794,6 +797,111 @@ include this extra information.</p>
<p>projects list</p>
</dd></dl>
</div>
<div class="section" id="module-composer.cli.sources">
<span id="sources-module"></span><h2><tt class="xref py py-mod docutils literal"><span class="pre">sources</span></tt> Module<a class="headerlink" href="#module-composer.cli.sources" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="composer.cli.sources.sources_add">
<tt class="descclassname">composer.cli.sources.</tt><tt class="descname">sources_add</tt><big>(</big><em>socket_path</em>, <em>api_version</em>, <em>args</em>, <em>show_json=False</em><big>)</big><a class="reference internal" href="_modules/composer/cli/sources.html#sources_add"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#composer.cli.sources.sources_add" title="Permalink to this definition"></a></dt>
<dd><p>Add or change a source</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/2/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; 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/2/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; Version of the API to talk to. eg. &#8220;0&#8221;</li>
<li><strong>args</strong> (<em>list of str</em>) &#8211; List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#bool" title="(in Python v2.7)"><em>bool</em></a>) &#8211; Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>sources add &lt;source.toml&gt;</p>
</dd></dl>
<dl class="function">
<dt id="composer.cli.sources.sources_cmd">
<tt class="descclassname">composer.cli.sources.</tt><tt class="descname">sources_cmd</tt><big>(</big><em>opts</em><big>)</big><a class="reference internal" href="_modules/composer/cli/sources.html#sources_cmd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#composer.cli.sources.sources_cmd" title="Permalink to this definition"></a></dt>
<dd><p>Process sources commands</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>opts</strong> (<a class="reference external" href="https://docs.python.org/2/library/argparse.html#argparse.Namespace" title="(in Python v2.7)"><em>argparse.Namespace</em></a>) &#8211; 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>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">int</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="composer.cli.sources.sources_delete">
<tt class="descclassname">composer.cli.sources.</tt><tt class="descname">sources_delete</tt><big>(</big><em>socket_path</em>, <em>api_version</em>, <em>args</em>, <em>show_json=False</em><big>)</big><a class="reference internal" href="_modules/composer/cli/sources.html#sources_delete"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#composer.cli.sources.sources_delete" title="Permalink to this definition"></a></dt>
<dd><p>Delete a source</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/2/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; 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/2/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; Version of the API to talk to. eg. &#8220;0&#8221;</li>
<li><strong>args</strong> (<em>list of str</em>) &#8211; List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#bool" title="(in Python v2.7)"><em>bool</em></a>) &#8211; Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>sources delete &lt;source-name&gt;</p>
</dd></dl>
<dl class="function">
<dt id="composer.cli.sources.sources_info">
<tt class="descclassname">composer.cli.sources.</tt><tt class="descname">sources_info</tt><big>(</big><em>socket_path</em>, <em>api_version</em>, <em>args</em>, <em>show_json=False</em><big>)</big><a class="reference internal" href="_modules/composer/cli/sources.html#sources_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#composer.cli.sources.sources_info" title="Permalink to this definition"></a></dt>
<dd><p>Output info on a list of projects</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/2/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; 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/2/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; Version of the API to talk to. eg. &#8220;0&#8221;</li>
<li><strong>args</strong> (<em>list of str</em>) &#8211; List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#bool" title="(in Python v2.7)"><em>bool</em></a>) &#8211; Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>sources info &lt;source-name&gt;</p>
</dd></dl>
<dl class="function">
<dt id="composer.cli.sources.sources_list">
<tt class="descclassname">composer.cli.sources.</tt><tt class="descname">sources_list</tt><big>(</big><em>socket_path</em>, <em>api_version</em>, <em>args</em>, <em>show_json=False</em><big>)</big><a class="reference internal" href="_modules/composer/cli/sources.html#sources_list"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#composer.cli.sources.sources_list" title="Permalink to this definition"></a></dt>
<dd><p>Output the list of available sources</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/2/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; 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/2/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; Version of the API to talk to. eg. &#8220;0&#8221;</li>
<li><strong>args</strong> (<em>list of str</em>) &#8211; List of remaining arguments from the cmdline</li>
<li><strong>show_json</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#bool" title="(in Python v2.7)"><em>bool</em></a>) &#8211; Set to True to show the JSON output instead of the human readable output</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>sources list</p>
</dd></dl>
</div>
<div class="section" id="module-composer.cli.utilities">
<span id="utilities-module"></span><h2><tt class="xref py py-mod docutils literal"><span class="pre">utilities</span></tt> Module<a class="headerlink" href="#module-composer.cli.utilities" title="Permalink to this headline"></a></h2>
@ -900,8 +1008,10 @@ include this extra information.</p>
<li><a class="reference internal" href="#id1"><tt class="docutils literal"><span class="pre">cli</span></tt> Package</a></li>
<li><a class="reference internal" href="#module-composer.cli.blueprints"><tt class="docutils literal"><span class="pre">blueprints</span></tt> Module</a></li>
<li><a class="reference internal" href="#module-composer.cli.compose"><tt class="docutils literal"><span class="pre">compose</span></tt> Module</a></li>
<li><a class="reference internal" href="#module-composer.cli.help"><tt class="docutils literal"><span class="pre">help</span></tt> Module</a></li>
<li><a class="reference internal" href="#module-composer.cli.modules"><tt class="docutils literal"><span class="pre">modules</span></tt> Module</a></li>
<li><a class="reference internal" href="#module-composer.cli.projects"><tt class="docutils literal"><span class="pre">projects</span></tt> Module</a></li>
<li><a class="reference internal" href="#module-composer.cli.sources"><tt class="docutils literal"><span class="pre">sources</span></tt> Module</a></li>
<li><a class="reference internal" href="#module-composer.cli.utilities"><tt class="docutils literal"><span class="pre">utilities</span></tt> Module</a></li>
</ul>
</li>
@ -950,7 +1060,7 @@ include this extra information.</p>
<li class="right" >
<a href="composer.html" title="composer Package"
>previous</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="modules.html" >src</a> &raquo;</li>
<li><a href="composer.html" >composer Package</a> &raquo;</li>
</ul>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>composer Package &mdash; Lorax 19.7.15 documentation</title>
<title>composer Package &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="index.html" />
<link rel="up" title="src" href="modules.html" />
<link rel="next" title="cli Package" href="composer.cli.html" />
<link rel="prev" title="src" href="modules.html" />
@ -46,7 +46,7 @@
<li class="right" >
<a href="modules.html" title="src"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="modules.html" accesskey="U">src</a> &raquo;</li>
</ul>
</div>
@ -301,8 +301,10 @@
<li class="toctree-l2"><a class="reference internal" href="composer.cli.html#id1"><tt class="docutils literal"><span class="pre">cli</span></tt> Package</a></li>
<li class="toctree-l2"><a class="reference internal" href="composer.cli.html#module-composer.cli.blueprints"><tt class="docutils literal"><span class="pre">blueprints</span></tt> Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="composer.cli.html#module-composer.cli.compose"><tt class="docutils literal"><span class="pre">compose</span></tt> Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="composer.cli.html#module-composer.cli.help"><tt class="docutils literal"><span class="pre">help</span></tt> Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="composer.cli.html#module-composer.cli.modules"><tt class="docutils literal"><span class="pre">modules</span></tt> Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="composer.cli.html#module-composer.cli.projects"><tt class="docutils literal"><span class="pre">projects</span></tt> Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="composer.cli.html#module-composer.cli.sources"><tt class="docutils literal"><span class="pre">sources</span></tt> Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="composer.cli.html#module-composer.cli.utilities"><tt class="docutils literal"><span class="pre">utilities</span></tt> Module</a></li>
</ul>
</li>
@ -373,7 +375,7 @@
<li class="right" >
<a href="modules.html" title="src"
>previous</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="modules.html" >src</a> &raquo;</li>
</ul>
</div>

View File

@ -10,7 +10,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Index &mdash; Lorax 19.7.15 documentation</title>
<title>Index &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -18,7 +18,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -27,7 +27,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="index.html" />
</head>
<body>
<div class="related">
@ -39,7 +39,7 @@
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
@ -305,8 +305,6 @@
<dt><a href="composer.cli.html#composer.cli.compose.compose_status">compose_status() (in module composer.cli.compose)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="composer.cli.html#composer.cli.compose.compose_types">compose_types() (in module composer.cli.compose)</a>
</dt>
@ -317,6 +315,8 @@
</dt>
</dl></dd>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="composer.html#module-composer">composer (module)</a>
</dt>
@ -334,6 +334,10 @@
</dt>
<dt><a href="composer.cli.html#module-composer.cli.help">composer.cli.help (module)</a>
</dt>
<dt><a href="composer.cli.html#module-composer.cli.modules">composer.cli.modules (module)</a>
</dt>
@ -342,6 +346,10 @@
</dt>
<dt><a href="composer.cli.html#module-composer.cli.sources">composer.cli.sources (module)</a>
</dt>
<dt><a href="composer.cli.html#module-composer.cli.utilities">composer.cli.utilities (module)</a>
</dt>
@ -438,6 +446,10 @@
</dt>
<dt><a href="pylorax.api.html#pylorax.api.projects.delete_repo_source">delete_repo_source() (in module pylorax.api.projects)</a>
</dt>
<dt><a href="composer.html#composer.http_client.delete_url_json">delete_url_json() (in module composer.http_client)</a>
</dt>
@ -453,12 +465,12 @@
<dt><a href="pylorax.html#pylorax.installer.VirtualInstall.destroy">destroy() (pylorax.installer.VirtualInstall method)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pylorax.api.html#pylorax.api.recipes.diff_items">diff_items() (in module pylorax.api.recipes)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pylorax.api.html#pylorax.api.server.GitLock.dir">dir (pylorax.api.server.GitLock attribute)</a>
</dt>
@ -637,12 +649,12 @@
<dt><a href="pylorax.api.html#pylorax.api.queue.get_image_name">get_image_name() (in module pylorax.api.queue)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pylorax.html#pylorax.installer.IsoMountpoint.get_iso_label">get_iso_label() (pylorax.installer.IsoMountpoint method)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pylorax.html#pylorax.creator.KernelInfo.get_kernel_arch">get_kernel_arch() (pylorax.creator.KernelInfo method)</a>
</dt>
@ -660,10 +672,18 @@
</dt>
<dt><a href="pylorax.api.html#pylorax.api.projects.get_repo_sources">get_repo_sources() (in module pylorax.api.projects)</a>
</dt>
<dt><a href="pylorax.api.html#pylorax.api.recipes.get_revision_from_tag">get_revision_from_tag() (in module pylorax.api.recipes)</a>
</dt>
<dt><a href="pylorax.api.html#pylorax.api.projects.get_source_ids">get_source_ids() (in module pylorax.api.projects)</a>
</dt>
<dt><a href="composer.html#composer.http_client.get_url_json">get_url_json() (in module composer.http_client)</a>
</dt>
@ -1000,6 +1020,10 @@
</dt>
<dt><a href="pylorax.api.html#pylorax.api.recipes.Recipe.module_nver">module_nver (pylorax.api.recipes.Recipe attribute)</a>
</dt>
<dt><a href="composer.cli.html#composer.cli.modules.modules_cmd">modules_cmd() (in module composer.cli.modules)</a>
</dt>
@ -1066,6 +1090,10 @@
</dt>
<dt><a href="pylorax.api.html#pylorax.api.recipes.Recipe.package_nver">package_nver (pylorax.api.recipes.Recipe attribute)</a>
</dt>
<dt><a href="composer.cli.html#composer.cli.utilities.packageNEVRA">packageNEVRA() (in module composer.cli.utilities)</a>
</dt>
@ -1169,12 +1197,12 @@
<dt><a href="pylorax.api.html#module-pylorax.api">pylorax.api (module)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pylorax.api.html#module-pylorax.api.compose">pylorax.api.compose (module)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pylorax.api.html#module-pylorax.api.config">pylorax.api.config (module)</a>
</dt>
@ -1361,12 +1389,12 @@
</dt>
</dl></dd>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.removefrom">removefrom() (pylorax.ltmpl.LoraxTemplateRunner method)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.removekmod">removekmod() (pylorax.ltmpl.LoraxTemplateRunner method)</a>
</dt>
@ -1394,6 +1422,10 @@
</dt>
<dt><a href="pylorax.api.html#pylorax.api.projects.repo_to_source">repo_to_source() (in module pylorax.api.projects)</a>
</dt>
<dt><a href="pylorax.api.html#pylorax.api.recipes.revert_file">revert_file() (in module pylorax.api.recipes)</a>
</dt>
@ -1476,12 +1508,36 @@
</dt>
<dt><a href="pylorax.html#pylorax.ltmpl.split_and_expand">split_and_expand() (in module pylorax.ltmpl)</a>
<dt><a href="pylorax.api.html#pylorax.api.projects.source_to_repo">source_to_repo() (in module pylorax.api.projects)</a>
</dt>
<dt><a href="composer.cli.html#composer.cli.sources.sources_add">sources_add() (in module composer.cli.sources)</a>
</dt>
<dt><a href="composer.cli.html#composer.cli.sources.sources_cmd">sources_cmd() (in module composer.cli.sources)</a>
</dt>
<dt><a href="composer.cli.html#composer.cli.sources.sources_delete">sources_delete() (in module composer.cli.sources)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="composer.cli.html#composer.cli.sources.sources_info">sources_info() (in module composer.cli.sources)</a>
</dt>
<dt><a href="composer.cli.html#composer.cli.sources.sources_list">sources_list() (in module composer.cli.sources)</a>
</dt>
<dt><a href="pylorax.html#pylorax.ltmpl.split_and_expand">split_and_expand() (in module pylorax.ltmpl)</a>
</dt>
<dt><a href="pylorax.api.html#pylorax.api.compose.start_build">start_build() (in module pylorax.api.compose)</a>
</dt>
@ -1582,6 +1638,10 @@
</dt>
<dt><a href="pylorax.api.html#pylorax.api.yumbase.update_metadata">update_metadata() (in module pylorax.api.yumbase)</a>
</dt>
<dt><a href="pylorax.html#pylorax.yumhelper.LoraxDownloadCallback.updateProgress">updateProgress() (pylorax.yumhelper.LoraxDownloadCallback method)</a>
</dt>
@ -1713,6 +1773,10 @@
<dt><a href="pylorax.api.html#pylorax.api.projects.yaps_to_project_info">yaps_to_project_info() (in module pylorax.api.projects)</a>
</dt>
<dt><a href="pylorax.api.html#pylorax.api.projects.yum_repo_to_file_repo">yum_repo_to_file_repo() (in module pylorax.api.projects)</a>
</dt>
</dl></td>
</tr></table>
@ -1752,7 +1816,7 @@
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome to Loraxs documentation! &mdash; Lorax 19.7.15 documentation</title>
<title>Welcome to Loraxs documentation! &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="#" />
<link rel="top" title="Lorax 19.7.18 documentation" href="#" />
<link rel="next" title="Introduction to Lorax" href="intro.html" />
</head>
<body>
@ -41,7 +41,7 @@
<li class="right" >
<a href="intro.html" title="Introduction to Lorax"
accesskey="N">next</a> |</li>
<li><a href="#">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="#">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
@ -60,6 +60,7 @@
<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>
@ -125,7 +126,7 @@
<li class="right" >
<a href="intro.html" title="Introduction to Lorax"
>next</a> |</li>
<li><a href="#">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="#">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Introduction to Lorax &mdash; Lorax 19.7.15 documentation</title>
<title>Introduction to Lorax &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="index.html" />
<link rel="next" title="Lorax" href="lorax.html" />
<link rel="prev" title="Welcome to Loraxs documentation!" href="index.html" />
</head>
@ -45,7 +45,7 @@
<li class="right" >
<a href="index.html" title="Welcome to Loraxs documentation!"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
@ -161,7 +161,7 @@ upd-instroot and mk-images* scripts.</p>
<li class="right" >
<a href="index.html" title="Welcome to Loraxs documentation!"
>previous</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>livemedia-creator &mdash; Lorax 19.7.15 documentation</title>
<title>livemedia-creator &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="index.html" />
<link rel="next" title="lorax-composer" href="lorax-composer.html" />
<link rel="prev" title="Lorax" href="lorax.html" />
</head>
@ -45,7 +45,7 @@
<li class="right" >
<a href="lorax.html" title="Lorax"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
@ -446,7 +446,7 @@ report bugs against the lorax component.</p>
<li class="right" >
<a href="lorax.html" title="Lorax"
>previous</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>lorax-composer &mdash; Lorax 19.7.15 documentation</title>
<title>lorax-composer &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,8 +25,8 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="index.html" />
<link rel="next" title="Product and Updates Images" href="product-images.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="index.html" />
<link rel="next" title="composer-cli" href="composer-cli.html" />
<link rel="prev" title="livemedia-creator" href="livemedia-creator.html" />
</head>
<body>
@ -40,12 +40,12 @@
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="product-images.html" title="Product and Updates Images"
<a href="composer-cli.html" title="composer-cli"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="livemedia-creator.html" title="livemedia-creator"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
@ -64,24 +64,34 @@
</tr>
</tbody>
</table>
<p>lorax-composer is an API server that is compatible with the Weldr project&#8217;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>The server runs as root, and communication with it is via a unix domain socket
(<tt class="docutils literal"><span class="pre">/run/weldr/api.socket</span></tt> by default). The directory and socket are owned by
root:weldr so that any user in the weldr group can use the API to control
lorax-composer.</p>
<p>When starting the server it will check for the correct permissions and
ownership of a pre-existing directory, or it will create a new one if it
doesn&#8217;t exist. The socket path and group owner&#8217;s name can be changed from the
cmdline by passing it the <tt class="docutils literal"><span class="pre">--socket</span></tt> and <tt class="docutils literal"><span class="pre">--group</span></tt> arguments.</p>
<p>As of version 19.7.7 it will drop root privileges for the API thread. The queue
and compose thread still runs as root because it needs to be able to
mount/umount files and run Anaconda.</p>
<div class="section" id="logs">
<h2>Logs<a class="headerlink" href="#logs" title="Permalink to this headline"></a></h2>
<p>Logs are stored under <tt class="docutils literal"><span class="pre">/var/log/lorax-composer/</span></tt> and include all console
messages as well as extra debugging info and API requests.</p>
<p><tt class="docutils literal"><span class="pre">lorax-composer</span></tt> 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 project&#8217;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
installation and configuration of the images.</p>
<div class="section" id="important-things-to-note">
<h2>Important Things To Note<a class="headerlink" href="#important-things-to-note" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li>SELinux must be in Permissive mode. Anaconda requires SELinux be in permissive mode
for image creation to work correctly. You can either edit the setting in the
<tt class="docutils literal"><span class="pre">/etc/sysconfig/selinux</span></tt> file, or run <tt class="docutils literal"><span class="pre">setenforce</span> <span class="pre">0</span></tt> before starting lorax-composer.</li>
<li>Some output types require packages from the RHEL 7 Optional repository. See the
<a class="reference external" href="https://access.redhat.com/solutions/392003">Red Hat Enterprise Linux 7 documentation</a>
for information on how to enable it. Otherwise you will see image creation fail to
depsolve even if the blueprint itself is correct.</li>
</ul>
</div>
<div class="section" id="installation">
<h2>Installation<a class="headerlink" href="#installation" title="Permalink to this headline"></a></h2>
<p>The best way to install <tt class="docutils literal"><span class="pre">lorax-composer</span></tt> is to use <tt class="docutils literal"><span class="pre">sudo</span> <span class="pre">dnf</span> <span class="pre">install</span>
<span class="pre">lorax-composer</span> <span class="pre">composer-cli</span></tt>, this will setup the weldr user and install the
systemd socket activation service. You will then need to enable it with <tt class="docutils literal"><span class="pre">sudo</span>
<span class="pre">systemctl</span> <span class="pre">enable</span> <span class="pre">lorax-composer.socket</span> <span class="pre">&amp;&amp;</span> <span class="pre">sudo</span> <span class="pre">systemctl</span> <span class="pre">start</span>
<span class="pre">lorax-composer.socket</span></tt>. This will leave the server off until the first request
is made. Systemd will then launch the server and it will remain running until
the system is rebooted.</p>
</div>
<div class="section" id="quickstart">
<h2>Quickstart<a class="headerlink" href="#quickstart" title="Permalink to this headline"></a></h2>
@ -89,27 +99,140 @@ messages as well as extra debugging info and API requests.</p>
<li>Create a <tt class="docutils literal"><span class="pre">weldr</span></tt> user and group by running <tt class="docutils literal"><span class="pre">useradd</span> <span class="pre">weldr</span></tt></li>
<li>Remove any pre-existing socket directory with <tt class="docutils literal"><span class="pre">rm</span> <span class="pre">-rf</span> <span class="pre">/run/weldr/</span></tt>
A new directory with correct permissions will be created the first time the server runs.</li>
<li>Either start it via systemd with <tt class="docutils literal"><span class="pre">systemctl</span> <span class="pre">start</span> <span class="pre">lorax-composer</span></tt> or
run it directly with <tt class="docutils literal"><span class="pre">lorax-composer</span> <span class="pre">/path/to/blueprints/</span></tt></li>
<li>Enable the socket activation with <tt class="docutils literal"><span class="pre">systemctl</span> <span class="pre">enable</span> <span class="pre">lorax-composer.socket</span>
<span class="pre">&amp;&amp;</span> <span class="pre">sudo</span> <span class="pre">systemctl</span> <span class="pre">start</span> <span class="pre">lorax-composer.socket</span></tt> or run it directly with
<tt class="docutils literal"><span class="pre">lorax-composer</span> <span class="pre">/path/to/blueprints/</span></tt></li>
</ol>
<p>The <tt class="docutils literal"><span class="pre">/path/to/blueprints/</span></tt> is where the blueprint&#8217;s git repo will be created, and
all the blueprints created with the <tt class="docutils literal"><span class="pre">/api/v0/blueprints/new</span></tt> route will be stored.
If there are blueprint <tt class="docutils literal"><span class="pre">.toml</span></tt> files in the top level of the directory they will
be imported into the blueprint git storage.</p>
<p>The <tt class="docutils literal"><span class="pre">/path/to/blueprints/</span></tt> directory is where the blueprints&#8217; git repo will
be created, and all the blueprints created with the <tt class="docutils literal"><span class="pre">/api/v0/blueprints/new</span></tt>
route will be stored. If there are blueprint <tt class="docutils literal"><span class="pre">.toml</span></tt> files in the top level
of the directory they will be imported into the blueprint git storage when
<tt class="docutils literal"><span class="pre">lorax-composer</span></tt> starts.</p>
</div>
<div class="section" id="logs">
<h2>Logs<a class="headerlink" href="#logs" title="Permalink to this headline"></a></h2>
<p>Logs are stored under <tt class="docutils literal"><span class="pre">/var/log/lorax-composer/</span></tt> and include all console
messages as well as extra debugging info and API requests.</p>
</div>
<div class="section" id="security">
<h2>Security<a class="headerlink" href="#security" title="Permalink to this headline"></a></h2>
<p>Some security related issues that you should be aware of before running <tt class="docutils literal"><span class="pre">lorax-composer</span></tt>:</p>
<ul class="simple">
<li>One of the API server threads needs to retain root privileges in order to run Anaconda.</li>
<li>SELinux must be set to Permissive or disabled to allow <tt class="docutils literal"><span class="pre">livemedia-creator</span></tt> to run Anaconda.</li>
<li>Only allow authorized users access to the <tt class="docutils literal"><span class="pre">weldr</span></tt> group and socket.</li>
</ul>
<p>Since Anaconda kickstarts are used there is the possibility that a user could
inject commands into a blueprint that would result in the kickstart executing
arbitrary code on the host. Only authorized users should be allowed to build
images using <tt class="docutils literal"><span class="pre">lorax-composer</span></tt>.</p>
</div>
<div class="section" id="how-it-works">
<h2>How it Works<a class="headerlink" href="#how-it-works" title="Permalink to this headline"></a></h2>
<p>The server runs as root, and as <tt class="docutils literal"><span class="pre">weldr</span></tt>. Communication with it is via a unix
domain socket (<tt class="docutils literal"><span class="pre">/run/weldr/api.socket</span></tt> by default). The directory and socket
are owned by <tt class="docutils literal"><span class="pre">root:weldr</span></tt> so that any user in the <tt class="docutils literal"><span class="pre">weldr</span></tt> group can use the API
to control <tt class="docutils literal"><span class="pre">lorax-composer</span></tt>.</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
doesn&#8217;t exist. The socket path and group owner&#8217;s name can be changed from the
cmdline by passing it the <tt class="docutils literal"><span class="pre">--socket</span></tt> and <tt class="docutils literal"><span class="pre">--group</span></tt> arguments.</p>
<p>It will then drop root privileges for the API thread and run as the <tt class="docutils literal"><span class="pre">weldr</span></tt>
user. The queue and compose thread still runs as root because it needs to be
able to mount/umount files and run Anaconda.</p>
</div>
<div class="section" id="composing-images">
<h2>Composing Images<a class="headerlink" href="#composing-images" title="Permalink to this headline"></a></h2>
<p>As of version 19.7.7 lorax-composer can create <tt class="docutils literal"><span class="pre">tar</span></tt> output images. You can use curl to start
a compose like this:</p>
<div class="highlight-python"><pre>curl --unix-socket /run/weldr/api.socket -X POST -H "Content-Type: application/json" -d '{"blueprint_name": "http-server", "compose_type": "tar", "branch": "master"}' http:///api/v0/compose</pre>
<p>The <a class="reference external" href="https://github.com/weldr/welder-web/">welder-web</a> GUI project can be used to construct
blueprints and create composes using a web browser.</p>
<p>Or use the command line with <a class="reference external" href="composer-cli.html">composer-cli</a>.</p>
</div>
<div class="section" id="blueprints">
<h2>Blueprints<a class="headerlink" href="#blueprints" title="Permalink to this headline"></a></h2>
<p>Blueprints are simple text files in <a class="reference external" href="https://github.com/toml-lang/toml">TOML</a> format that describe
which packages, and what versions, to install into the image. They can also define a limited set
of customizations to make to the final image.</p>
<p>Example blueprints can be found in the <tt class="docutils literal"><span class="pre">lorax-composer</span></tt> <a class="reference external" href="https://github.com/weldr/lorax/tree/master/tests/pylorax/blueprints/">test suite</a>, with a simple one
looking like this:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">name</span> <span class="o">=</span> <span class="s">&quot;base&quot;</span>
<span class="n">description</span> <span class="o">=</span> <span class="s">&quot;A base system with bash&quot;</span>
<span class="n">version</span> <span class="o">=</span> <span class="s">&quot;0.0.1&quot;</span>
<span class="p">[[</span><span class="n">packages</span><span class="p">]]</span>
<span class="n">name</span> <span class="o">=</span> <span class="s">&quot;bash&quot;</span>
<span class="n">version</span> <span class="o">=</span> <span class="s">&quot;4.4.*&quot;</span>
</pre></div>
</div>
<p>The <tt class="docutils literal"><span class="pre">name</span></tt> field is the name of the blueprint. It can contain spaces, but they will be converted to <tt class="docutils literal"><span class="pre">-</span></tt>
when it is written to disk. It should be short and descriptive.</p>
<p><tt class="docutils literal"><span class="pre">description</span></tt> can be a longer description of the blueprint, it is only used for display purposes.</p>
<p><tt class="docutils literal"><span class="pre">version</span></tt> is a <a class="reference external" href="https://semver.org/">semver compatible</a> version number. If
a new blueprint is uploaded with the same <tt class="docutils literal"><span class="pre">version</span></tt> the server will
automatically bump the PATCH level of the <tt class="docutils literal"><span class="pre">version</span></tt>. If the <tt class="docutils literal"><span class="pre">version</span></tt>
doesn&#8217;t match it will be used as is. eg. Uploading a blueprint with <tt class="docutils literal"><span class="pre">version</span></tt>
set to <tt class="docutils literal"><span class="pre">0.1.0</span></tt> when the existing blueprint <tt class="docutils literal"><span class="pre">version</span></tt> is <tt class="docutils literal"><span class="pre">0.0.1</span></tt> will
result in the new blueprint being stored as <tt class="docutils literal"><span class="pre">version</span> <span class="pre">0.1.0</span></tt>.</p>
<div class="section" id="packages-and-modules">
<h3>[[packages]] and [[modules]]<a class="headerlink" href="#packages-and-modules" title="Permalink to this headline"></a></h3>
<p>These entries describe the package names and matching version glob to be installed into the image.</p>
<p>The names must match the names exactly, and the versions can be an exact match
or a filesystem-like glob of the version using <tt class="docutils literal"><span class="pre">*</span></tt> wildcards and <tt class="docutils literal"><span class="pre">?</span></tt>
character matching.</p>
<p>NOTE: As of lorax-composer-29.2-1 the versions are not used for depsolving,
that is planned for a future release. And currently there are no differences
between <tt class="docutils literal"><span class="pre">packages</span></tt> and <tt class="docutils literal"><span class="pre">modules</span></tt> in <tt class="docutils literal"><span class="pre">lorax-composer</span></tt>.</p>
</div>
<div class="section" id="customizations">
<h3>Customizations<a class="headerlink" href="#customizations" title="Permalink to this headline"></a></h3>
<p>The <tt class="docutils literal"><span class="pre">[[customizations]]</span></tt> section can be used to configure the hostname of the final image. eg.:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">[[</span><span class="n">customizations</span><span class="p">]]</span>
<span class="n">hostname</span> <span class="o">=</span> <span class="s">&quot;baseimage&quot;</span>
</pre></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 user&#8217;s ssh key in the final image:</p>
<div class="highlight-python"><div class="highlight"><pre><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="s">&quot;root&quot;</span>
<span class="n">key</span> <span class="o">=</span> <span class="s">&quot;PUBLIC SSH KEY&quot;</span>
</pre></div>
</div>
<p>The key will be added to the user&#8217;s authorized_keys file.</p>
</div>
<div class="section" id="customizations-user">
<h4>[[customizations.user]]<a class="headerlink" href="#customizations-user" title="Permalink to this headline"></a></h4>
<p>Add a user to the image, and/or set their ssh key.
All fields for this section are optional except for the <tt class="docutils literal"><span class="pre">name</span></tt>, here is a complete example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">[[</span><span class="n">customizations</span><span class="o">.</span><span class="n">user</span><span class="p">]]</span>
<span class="n">name</span> <span class="o">=</span> <span class="s">&quot;admin&quot;</span>
<span class="n">description</span> <span class="o">=</span> <span class="s">&quot;Administrator account&quot;</span>
<span class="n">password</span> <span class="o">=</span> <span class="s">&quot;$6$CHO2$3rN8eviE2t50lmVyBYihTgVRHcaecmeCk31L...&quot;</span>
<span class="n">key</span> <span class="o">=</span> <span class="s">&quot;PUBLIC SSH KEY&quot;</span>
<span class="n">home</span> <span class="o">=</span> <span class="s">&quot;/srv/widget/&quot;</span>
<span class="n">shell</span> <span class="o">=</span> <span class="s">&quot;/usr/bin/bash&quot;</span>
<span class="n">groups</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;widget&quot;</span><span class="p">,</span> <span class="s">&quot;users&quot;</span><span class="p">,</span> <span class="s">&quot;wheel&quot;</span><span class="p">]</span>
<span class="n">uid</span> <span class="o">=</span> <span class="mi">1200</span>
<span class="n">gid</span> <span class="o">=</span> <span class="mi">1200</span>
</pre></div>
</div>
<p>If the password starts with <tt class="docutils literal"><span class="pre">$6$</span></tt>, <tt class="docutils literal"><span class="pre">$5$</span></tt>, or <tt class="docutils literal"><span class="pre">$2b$</span></tt> it will be stored as
an encrypted password. Otherwise it will be treated as a plain text password.</p>
</div>
<div class="section" id="customizations-group">
<h4>[[customizations.group]]<a class="headerlink" href="#customizations-group" title="Permalink to this headline"></a></h4>
<p>Add a group to the image. <tt class="docutils literal"><span class="pre">name</span></tt> is required and <tt class="docutils literal"><span class="pre">gid</span></tt> is optional:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">[[</span><span class="n">customizations</span><span class="o">.</span><span class="n">group</span><span class="p">]]</span>
<span class="n">name</span> <span class="o">=</span> <span class="s">&quot;widget&quot;</span>
<span class="n">gid</span> <span class="o">=</span> <span class="mi">1130</span>
</pre></div>
</div>
</div>
</div>
<p>And then monitor it by passing the returned build UUID to <tt class="docutils literal"><span class="pre">/compose/status/&lt;uuid&gt;</span></tt>.</p>
<p>Version 19.7.10 adds support for <tt class="docutils literal"><span class="pre">live-iso</span></tt> and <tt class="docutils literal"><span class="pre">partitioned-disk</span></tt></p>
</div>
<div class="section" id="adding-output-types">
<h2>Adding Output Types<a class="headerlink" href="#adding-output-types" title="Permalink to this headline"></a></h2>
<p>livemedia-creator supports a large number of output types, and only some of
these are currently available via lorax-composer. To add a new output type to
<p><tt class="docutils literal"><span class="pre">livemedia-creator</span></tt> supports a large number of output types, and only some of
these are currently available via <tt class="docutils literal"><span class="pre">lorax-composer</span></tt>. To add a new output type to
lorax-composer a kickstart file needs to be added to <tt class="docutils literal"><span class="pre">./share/composer/</span></tt>. The
name of the kickstart is what will be used by the <tt class="docutils literal"><span class="pre">/compose/types</span></tt> route, and the
<tt class="docutils literal"><span class="pre">compose_type</span></tt> field of the POST to start a compose. It also needs to have
@ -150,6 +273,50 @@ unneeded extra files. This is especially true for the <tt class="docutils litera
the contents of the iso as well as the boot.iso itself.</p>
</div>
</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 host&#8217;s configured repositories. It copies
the <tt class="docutils literal"><span class="pre">*.repo</span></tt> files from <tt class="docutils literal"><span class="pre">/etc/yum.repos.d/</span></tt> into
<tt class="docutils literal"><span class="pre">/var/lib/lorax/composer/repos.d/</span></tt> at startup, these are immutable system
repositories and cannot be deleted or changed. If you want to add additional
repos you can put them into <tt class="docutils literal"><span class="pre">/var/lib/lorax/composer/repos.d/</span></tt> or use the
<tt class="docutils literal"><span class="pre">/api/v0/projects/source/*</span></tt> API routes to create them.</p>
<p>The new source can be added by doing a POST to the <tt class="docutils literal"><span class="pre">/api/v0/projects/source/new</span></tt>
route using JSON (with <cite>Content-Type</cite> header set to <cite>application/json</cite>) or TOML
(with it set to <cite>text/x-toml</cite>). The format of the source looks like this (in
TOML):</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">name</span> <span class="o">=</span> <span class="s">&quot;custom-source-1&quot;</span>
<span class="n">url</span> <span class="o">=</span> <span class="s">&quot;https://url/path/to/repository/&quot;</span>
<span class="nb">type</span> <span class="o">=</span> <span class="s">&quot;yum-baseurl&quot;</span>
<span class="n">proxy</span> <span class="o">=</span> <span class="s">&quot;https://proxy-url/&quot;</span>
<span class="n">check_ssl</span> <span class="o">=</span> <span class="n">true</span>
<span class="n">check_gpg</span> <span class="o">=</span> <span class="n">true</span>
<span class="n">gpgkey_urls</span> <span class="o">=</span> <span class="p">[</span><span class="s">&quot;https://url/path/to/gpg-key&quot;</span><span class="p">]</span>
</pre></div>
</div>
<p>The <tt class="docutils literal"><span class="pre">proxy</span></tt> and <tt class="docutils literal"><span class="pre">gpgkey_urls</span></tt> entries are optional. All of the others are required. The supported
types for the urls are:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">yum-baseurl</span></tt> is a URL to a yum repository.</li>
<li><tt class="docutils literal"><span class="pre">yum-mirrorlist</span></tt> is a URL for a mirrorlist.</li>
<li><tt class="docutils literal"><span class="pre">yum-metalink</span></tt> is a URL for a metalink.</li>
</ul>
<p>If <tt class="docutils literal"><span class="pre">check_ssl</span></tt> is true the https certificates must be valid. If they are self-signed you can either set
this to false, or add your Certificate Authority to the host system.</p>
<p>If <tt class="docutils literal"><span class="pre">check_gpg</span></tt> is true the GPG key must either be installed on the host system, or <tt class="docutils literal"><span class="pre">gpgkey_urls</span></tt>
should point to it.</p>
<p>You can edit an existing source (other than system sources), by doing a POST to the <tt class="docutils literal"><span class="pre">new</span></tt> route
with the new version of the source. It will overwrite the previous one.</p>
<p>A list of existing sources is available from <tt class="docutils literal"><span class="pre">/api/v0/projects/source/list</span></tt>, and detailed info
on a source can be retrieved with the <tt class="docutils literal"><span class="pre">/api/v0/projects/source/info/&lt;source-name&gt;</span></tt> route. By default
it returns JSON but it can also return TOML if <tt class="docutils literal"><span class="pre">?format=toml</span></tt> is added to the request.</p>
<p>Non-system sources can be deleted by doing a <tt class="docutils literal"><span class="pre">DELETE</span></tt> request to the
<tt class="docutils literal"><span class="pre">/api/v0/projects/source/delete/&lt;source-name&gt;</span></tt> route.</p>
<p>The documentation for the source API routes can be <a class="reference external" href="pylorax.api.html#api-v0-projects-source-list">found here</a></p>
<p>The configured sources are used for all blueprint depsolve operations, and for composing images.
When adding additional sources you must make sure that the packages in the source do not
conflict with any other package sources, otherwise depsolving will fail.</p>
</div>
</div>
@ -161,13 +328,28 @@ the contents of the iso as well as the boot.iso itself.</p>
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">lorax-composer</a><ul>
<li><a class="reference internal" href="#logs">Logs</a></li>
<li><a class="reference internal" href="#important-things-to-note">Important Things To Note</a></li>
<li><a class="reference internal" href="#installation">Installation</a></li>
<li><a class="reference internal" href="#quickstart">Quickstart</a></li>
<li><a class="reference internal" href="#logs">Logs</a></li>
<li><a class="reference internal" href="#security">Security</a></li>
<li><a class="reference internal" href="#how-it-works">How it Works</a></li>
<li><a class="reference internal" href="#composing-images">Composing Images</a></li>
<li><a class="reference internal" href="#blueprints">Blueprints</a><ul>
<li><a class="reference internal" href="#packages-and-modules">[[packages]] and [[modules]]</a></li>
<li><a class="reference internal" href="#customizations">Customizations</a><ul>
<li><a class="reference internal" href="#customizations-sshkey">[[customizations.sshkey]]</a></li>
<li><a class="reference internal" href="#customizations-user">[[customizations.user]]</a></li>
<li><a class="reference internal" href="#customizations-group">[[customizations.group]]</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#adding-output-types">Adding Output Types</a><ul>
<li><a class="reference internal" href="#example-add-partitioned-disk-support">Example: Add partitioned disk support</a></li>
</ul>
</li>
<li><a class="reference internal" href="#package-sources">Package Sources</a></li>
</ul>
</li>
</ul>
@ -176,8 +358,8 @@ the contents of the iso as well as the boot.iso itself.</p>
<p class="topless"><a href="livemedia-creator.html"
title="previous chapter">livemedia-creator</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="product-images.html"
title="next chapter">Product and Updates Images</a></p>
<p class="topless"><a href="composer-cli.html"
title="next chapter">composer-cli</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/lorax-composer.txt"
@ -210,12 +392,12 @@ the contents of the iso as well as the boot.iso itself.</p>
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="product-images.html" title="Product and Updates Images"
<a href="composer-cli.html" title="composer-cli"
>next</a> |</li>
<li class="right" >
<a href="livemedia-creator.html" title="livemedia-creator"
>previous</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Lorax &mdash; Lorax 19.7.15 documentation</title>
<title>Lorax &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="index.html" />
<link rel="next" title="livemedia-creator" href="livemedia-creator.html" />
<link rel="prev" title="Introduction to Lorax" href="intro.html" />
</head>
@ -45,7 +45,7 @@
<li class="right" >
<a href="intro.html" title="Introduction to Lorax"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
@ -254,7 +254,7 @@ into another directory and then select the new template directory by passing
<li class="right" >
<a href="intro.html" title="Introduction to Lorax"
>previous</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>src &mdash; Lorax 19.7.15 documentation</title>
<title>src &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="index.html" />
<link rel="next" title="composer Package" href="composer.html" />
<link rel="prev" title="Product and Updates Images" href="product-images.html" />
</head>
@ -45,7 +45,7 @@
<li class="right" >
<a href="product-images.html" title="Product and Updates Images"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
@ -67,8 +67,10 @@
<li class="toctree-l4"><a class="reference internal" href="composer.cli.html#id1"><tt class="docutils literal"><span class="pre">cli</span></tt> Package</a></li>
<li class="toctree-l4"><a class="reference internal" href="composer.cli.html#module-composer.cli.blueprints"><tt class="docutils literal"><span class="pre">blueprints</span></tt> Module</a></li>
<li class="toctree-l4"><a class="reference internal" href="composer.cli.html#module-composer.cli.compose"><tt class="docutils literal"><span class="pre">compose</span></tt> Module</a></li>
<li class="toctree-l4"><a class="reference internal" href="composer.cli.html#module-composer.cli.help"><tt class="docutils literal"><span class="pre">help</span></tt> Module</a></li>
<li class="toctree-l4"><a class="reference internal" href="composer.cli.html#module-composer.cli.modules"><tt class="docutils literal"><span class="pre">modules</span></tt> Module</a></li>
<li class="toctree-l4"><a class="reference internal" href="composer.cli.html#module-composer.cli.projects"><tt class="docutils literal"><span class="pre">projects</span></tt> Module</a></li>
<li class="toctree-l4"><a class="reference internal" href="composer.cli.html#module-composer.cli.sources"><tt class="docutils literal"><span class="pre">sources</span></tt> Module</a></li>
<li class="toctree-l4"><a class="reference internal" href="composer.cli.html#module-composer.cli.utilities"><tt class="docutils literal"><span class="pre">utilities</span></tt> Module</a></li>
</ul>
</li>
@ -165,7 +167,7 @@
<li class="right" >
<a href="product-images.html" title="Product and Updates Images"
>previous</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

Binary file not shown.

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Product and Updates Images &mdash; Lorax 19.7.15 documentation</title>
<title>Product and Updates Images &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,9 +25,9 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="index.html" />
<link rel="next" title="src" href="modules.html" />
<link rel="prev" title="lorax-composer" href="lorax-composer.html" />
<link rel="prev" title="composer-cli" href="composer-cli.html" />
</head>
<body>
<div class="related">
@ -43,9 +43,9 @@
<a href="modules.html" title="src"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="lorax-composer.html" title="lorax-composer"
<a href="composer-cli.html" title="composer-cli"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
@ -85,8 +85,8 @@ command or the installpkgs paramater of <a class="reference internal" href="pylo
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="lorax-composer.html"
title="previous chapter">lorax-composer</a></p>
<p class="topless"><a href="composer-cli.html"
title="previous chapter">composer-cli</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="modules.html"
title="next chapter">src</a></p>
@ -125,9 +125,9 @@ command or the installpkgs paramater of <a class="reference internal" href="pylo
<a href="modules.html" title="src"
>next</a> |</li>
<li class="right" >
<a href="lorax-composer.html" title="lorax-composer"
<a href="composer-cli.html" title="composer-cli"
>previous</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Python Module Index &mdash; Lorax 19.7.15 documentation</title>
<title>Python Module Index &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="index.html" />
@ -40,7 +40,7 @@
<li class="right" >
<a href="#" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
@ -82,6 +82,11 @@
<td>&nbsp;&nbsp;&nbsp;
<a href="composer.cli.html#module-composer.cli.compose"><tt class="xref">composer.cli.compose</tt></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&nbsp;&nbsp;&nbsp;
<a href="composer.cli.html#module-composer.cli.help"><tt class="xref">composer.cli.help</tt></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&nbsp;&nbsp;&nbsp;
@ -92,6 +97,11 @@
<td>&nbsp;&nbsp;&nbsp;
<a href="composer.cli.html#module-composer.cli.projects"><tt class="xref">composer.cli.projects</tt></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&nbsp;&nbsp;&nbsp;
<a href="composer.cli.html#module-composer.cli.sources"><tt class="xref">composer.cli.sources</tt></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&nbsp;&nbsp;&nbsp;
@ -280,7 +290,7 @@
<li class="right" >
<a href="#" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>api Package &mdash; Lorax 19.7.15 documentation</title>
<title>api Package &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="index.html" />
<link rel="up" title="pylorax Package" href="pylorax.html" />
<link rel="prev" title="pylorax Package" href="pylorax.html" />
</head>
@ -42,7 +42,7 @@
<li class="right" >
<a href="pylorax.html" title="pylorax Package"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="modules.html" >src</a> &raquo;</li>
<li><a href="pylorax.html" accesskey="U">pylorax Package</a> &raquo;</li>
</ul>
@ -343,6 +343,28 @@ with whatever options are relevant.</p>
</table>
</dd></dl>
<dl class="function">
<dt id="pylorax.api.projects.delete_repo_source">
<tt class="descclassname">pylorax.api.projects.</tt><tt class="descname">delete_repo_source</tt><big>(</big><em>source_glob</em>, <em>source_name</em><big>)</big><a class="reference internal" href="_modules/pylorax/api/projects.html#delete_repo_source"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.api.projects.delete_repo_source" title="Permalink to this definition"></a></dt>
<dd><p>Delete a source from a repo file</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>source_glob</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; A glob of the repo sources to search</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises :</th><td class="field-body">ProjectsError if there was a problem</td>
</tr>
</tbody>
</table>
<p>A repo file may have multiple sources in it, delete only the selected source.
If it is the last one in the file, delete the file.</p>
<p>WARNING: This will delete ANY source, the caller needs to ensure that a system
source_name isn&#8217;t passed to it.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.api.projects.dep_evra">
<tt class="descclassname">pylorax.api.projects.</tt><tt class="descname">dep_evra</tt><big>(</big><em>dep</em><big>)</big><a class="reference internal" href="_modules/pylorax/api/projects.html#dep_evra"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.api.projects.dep_evra" title="Permalink to this definition"></a></dt>
@ -394,6 +416,42 @@ yum doesn&#8217;t provide access to. So use the file count and block size to est
a minimum size for each package.</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.api.projects.get_repo_sources">
<tt class="descclassname">pylorax.api.projects.</tt><tt class="descname">get_repo_sources</tt><big>(</big><em>source_glob</em><big>)</big><a class="reference internal" href="_modules/pylorax/api/projects.html#get_repo_sources"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.api.projects.get_repo_sources" title="Permalink to this definition"></a></dt>
<dd><p>Return a list of sources from a directory of yum repositories</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>source_glob</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; A glob to use to match the source files, including full path</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A list of the source ids in all of the matching files</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">list of str</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pylorax.api.projects.get_source_ids">
<tt class="descclassname">pylorax.api.projects.</tt><tt class="descname">get_source_ids</tt><big>(</big><em>source_path</em><big>)</big><a class="reference internal" href="_modules/pylorax/api/projects.html#get_source_ids"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.api.projects.get_source_ids" title="Permalink to this definition"></a></dt>
<dd><p>Return a list of the source ids in a file</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>source_path</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#str" title="(in Python v2.7)"><em>str</em></a>) &#8211; Full path and filename of the source (yum repo) file</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A list of source id strings</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">list of str</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pylorax.api.projects.modules_info">
<tt class="descclassname">pylorax.api.projects.</tt><tt class="descname">modules_info</tt><big>(</big><em>yb</em>, <em>module_names</em><big>)</big><a class="reference internal" href="_modules/pylorax/api/projects.html#modules_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.api.projects.modules_info" title="Permalink to this definition"></a></dt>
@ -447,7 +505,7 @@ and sets the type to &#8220;rpm&#8221;</p>
<dl class="function">
<dt id="pylorax.api.projects.projects_depsolve">
<tt class="descclassname">pylorax.api.projects.</tt><tt class="descname">projects_depsolve</tt><big>(</big><em>yb</em>, <em>project_names</em><big>)</big><a class="reference internal" href="_modules/pylorax/api/projects.html#projects_depsolve"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.api.projects.projects_depsolve" title="Permalink to this definition"></a></dt>
<tt class="descclassname">pylorax.api.projects.</tt><tt class="descname">projects_depsolve</tt><big>(</big><em>yb</em>, <em>projects</em><big>)</big><a class="reference internal" href="_modules/pylorax/api/projects.html#projects_depsolve"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.api.projects.projects_depsolve" title="Permalink to this definition"></a></dt>
<dd><p>Return the dependencies for a list of projects</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@ -455,14 +513,17 @@ and sets the type to &#8220;rpm&#8221;</p>
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>yb</strong> (<em>YumBase</em>) &#8211; yum base object</li>
<li><strong>project_names</strong> (<em>List of Strings</em>) &#8211; The projects to find the dependencies for</li>
<li><strong>projects</strong> (<em>List of tuples</em>) &#8211; The projects and version globs to find the dependencies for</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">NEVRA&#8217;s of the project and its dependencies</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">list of dicts</p>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">list of dicts</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body"><p class="first last">ProjectsError if there was a problem installing something</p>
</td>
</tr>
</tbody>
@ -471,7 +532,7 @@ and sets the type to &#8220;rpm&#8221;</p>
<dl class="function">
<dt id="pylorax.api.projects.projects_depsolve_with_size">
<tt class="descclassname">pylorax.api.projects.</tt><tt class="descname">projects_depsolve_with_size</tt><big>(</big><em>yb</em>, <em>project_names</em>, <em>with_core=True</em><big>)</big><a class="reference internal" href="_modules/pylorax/api/projects.html#projects_depsolve_with_size"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.api.projects.projects_depsolve_with_size" title="Permalink to this definition"></a></dt>
<tt class="descclassname">pylorax.api.projects.</tt><tt class="descname">projects_depsolve_with_size</tt><big>(</big><em>yb</em>, <em>projects</em>, <em>with_core=True</em><big>)</big><a class="reference internal" href="_modules/pylorax/api/projects.html#projects_depsolve_with_size"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.api.projects.projects_depsolve_with_size" title="Permalink to this definition"></a></dt>
<dd><p>Return the dependencies and installed size for a list of projects</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@ -479,14 +540,17 @@ and sets the type to &#8220;rpm&#8221;</p>
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>yb</strong> (<em>YumBase</em>) &#8211; yum base object</li>
<li><strong>project_names</strong> (<em>List of Strings</em>) &#8211; The projects to find the dependencies for</li>
<li><strong>projects</strong> (<em>List of tuples</em>) &#8211; The projects and version globs to find the dependencies for</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">installed size and a list of NEVRA&#8217;s of the project and its dependencies</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">tuple of (int, list of dicts)</p>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">tuple of (int, list of dicts)</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body"><p class="first last">ProjectsError if there was a problem installing something</p>
</td>
</tr>
</tbody>
@ -535,6 +599,77 @@ and sets the type to &#8220;rpm&#8221;</p>
</table>
</dd></dl>
<dl class="function">
<dt id="pylorax.api.projects.repo_to_source">
<tt class="descclassname">pylorax.api.projects.</tt><tt class="descname">repo_to_source</tt><big>(</big><em>repo</em>, <em>system_source</em><big>)</big><a class="reference internal" href="_modules/pylorax/api/projects.html#repo_to_source"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.api.projects.repo_to_source" title="Permalink to this definition"></a></dt>
<dd><p>Return a Weldr Source dict created from the YumRepository</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>repo</strong> (<em>yum.yumRepo.YumRepository</em>) &#8211; Yum Repository</li>
<li><strong>system_source</strong> (<a class="reference external" href="https://docs.python.org/2/library/functions.html#bool" title="(in Python v2.7)"><em>bool</em></a>) &#8211; True if this source is an immutable system source</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A dict with Weldr Source fields filled in</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">dict</p>
</td>
</tr>
</tbody>
</table>
<p>Example:</p>
<div class="highlight-python"><pre>{
"check_gpg": true,
"check_ssl": true,
"gpgkey_url": [
"file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-28-x86_64"
],
"name": "fedora",
"proxy": "http://proxy.brianlane.com:8123",
"system": true
"type": "yum-metalink",
"url": "https://mirrors.fedoraproject.org/metalink?repo=fedora-28&amp;arch=x86_64"
}</pre>
</div>
</dd></dl>
<dl class="function">
<dt id="pylorax.api.projects.source_to_repo">
<tt class="descclassname">pylorax.api.projects.</tt><tt class="descname">source_to_repo</tt><big>(</big><em>source</em><big>)</big><a class="reference internal" href="_modules/pylorax/api/projects.html#source_to_repo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.api.projects.source_to_repo" title="Permalink to this definition"></a></dt>
<dd><p>Return an add_enable_repo kwargs dict created from a source dict</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>source</strong> (<a class="reference external" href="https://docs.python.org/2/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) &#8211; A Weldr source dict</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A yum YumRepository object</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">yum.yumRepo.YumRepository</td>
</tr>
</tbody>
</table>
<p>The dict it suitable for passing to yum&#8217;s add_enable_repo function
after popping off baseurl and mirrorlist.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span>
<span class="s">&quot;gpgcheck&quot;</span><span class="p">:</span> <span class="bp">True</span><span class="p">,</span>
<span class="s">&quot;sslverify&quot;</span><span class="p">:</span> <span class="bp">True</span><span class="p">,</span>
<span class="s">&quot;gpgkey&quot;</span><span class="p">:</span> <span class="p">[</span><span class="s">&quot;file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-28-x86_64&quot;</span><span class="p">],</span>
<span class="s">&quot;id&quot;</span><span class="p">:</span> <span class="s">&quot;fedora&quot;</span><span class="p">,</span>
<span class="s">&quot;proxy&quot;</span><span class="p">:</span> <span class="s">&quot;http://proxy.brianlane.com:8123&quot;</span><span class="p">,</span>
<span class="s">&quot;baseurl&quot;</span><span class="p">:</span> <span class="s">&quot;https://mirrors.fedoraproject.org/metalink?repo=fedora-28&amp;arch=x86_64&quot;</span><span class="p">,</span>
<span class="s">&quot;metalink&quot;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
<span class="s">&quot;mirrorlist&quot;</span><span class="p">:</span> <span class="bp">None</span>
<span class="p">}</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="pylorax.api.projects.tm_to_dep">
<tt class="descclassname">pylorax.api.projects.</tt><tt class="descname">tm_to_dep</tt><big>(</big><em>tm</em><big>)</big><a class="reference internal" href="_modules/pylorax/api/projects.html#tm_to_dep"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.api.projects.tm_to_dep" title="Permalink to this definition"></a></dt>
@ -610,6 +745,26 @@ and sets the type to &#8220;rpm&#8221;</p>
<p>metadata entries are hard-coded to {}</p>
</dd></dl>
<dl class="function">
<dt id="pylorax.api.projects.yum_repo_to_file_repo">
<tt class="descclassname">pylorax.api.projects.</tt><tt class="descname">yum_repo_to_file_repo</tt><big>(</big><em>repo</em><big>)</big><a class="reference internal" href="_modules/pylorax/api/projects.html#yum_repo_to_file_repo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.api.projects.yum_repo_to_file_repo" title="Permalink to this definition"></a></dt>
<dd><p>Return a string representation of a repo dict suitable for writing to a .repo file</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>repo</strong> (<a class="reference external" href="https://docs.python.org/2/library/stdtypes.html#dict" title="(in Python v2.7)"><em>dict</em></a>) &#8211; Yum Repository represented as a dict</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A string</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">str</td>
</tr>
</tbody>
</table>
<p>The YumRepo.dump() function does not produce a string that can be used as a
yum .repo file. So do this manually with only the attributes we care about.</p>
</dd></dl>
</div>
<div class="section" id="module-pylorax.api.queue">
<span id="queue-module"></span><h2><tt class="xref py py-mod docutils literal"><span class="pre">queue</span></tt> Module<a class="headerlink" href="#module-pylorax.api.queue" title="Permalink to this headline"></a></h2>
@ -1089,12 +1244,24 @@ If they are different, check and return the new version</p>
<dd><p>Return the names of the modules</p>
</dd></dl>
<dl class="attribute">
<dt id="pylorax.api.recipes.Recipe.module_nver">
<tt class="descname">module_nver</tt><a class="reference internal" href="_modules/pylorax/api/recipes.html#Recipe.module_nver"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.api.recipes.Recipe.module_nver" title="Permalink to this definition"></a></dt>
<dd><p>Return the names and versions of the modules</p>
</dd></dl>
<dl class="attribute">
<dt id="pylorax.api.recipes.Recipe.package_names">
<tt class="descname">package_names</tt><a class="reference internal" href="_modules/pylorax/api/recipes.html#Recipe.package_names"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.api.recipes.Recipe.package_names" title="Permalink to this definition"></a></dt>
<dd><p>Return the names of the packages</p>
</dd></dl>
<dl class="attribute">
<dt id="pylorax.api.recipes.Recipe.package_nver">
<tt class="descname">package_nver</tt><a class="reference internal" href="_modules/pylorax/api/recipes.html#Recipe.package_nver"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.api.recipes.Recipe.package_nver" title="Permalink to this definition"></a></dt>
<dd><p>Return the names and versions of the packages</p>
</dd></dl>
<dl class="method">
<dt id="pylorax.api.recipes.Recipe.toml">
<tt class="descname">toml</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/pylorax/api/recipes.html#Recipe.toml"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.api.recipes.Recipe.toml" title="Permalink to this definition"></a></dt>
@ -2483,6 +2650,93 @@ to satisfy the request.</p>
</div>
</div></blockquote>
</div>
<div class="section" id="api-v0-projects-source-list">
<h4><cite>/api/v0/projects/source/list</cite><a class="headerlink" href="#api-v0-projects-source-list" title="Permalink to this headline"></a></h4>
<blockquote>
<div><p>Return the list of repositories used for depsolving and installing packages.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span>
<span class="s">&quot;sources&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="s">&quot;fedora&quot;</span><span class="p">,</span>
<span class="s">&quot;fedora-cisco-openh264&quot;</span><span class="p">,</span>
<span class="s">&quot;fedora-updates-testing&quot;</span><span class="p">,</span>
<span class="s">&quot;fedora-updates&quot;</span>
<span class="p">]</span>
<span class="p">}</span>
</pre></div>
</div>
</div></blockquote>
</div>
<div class="section" id="api-v0-projects-source-info-source-names">
<h4><cite>/api/v0/projects/source/info/&lt;source-names&gt;</cite><a class="headerlink" href="#api-v0-projects-source-info-source-names" title="Permalink to this headline"></a></h4>
<blockquote>
<div><p>Return information about the comma-separated list of source names. Or all of the
sources if &#8216;*&#8217; is passed. Note that general globbing is not supported, only &#8216;*&#8217;.</p>
<p>immutable system sources will have the &#8220;system&#8221; field set to true. User added sources
will have it set to false. System sources cannot be changed or deleted.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span>
<span class="s">&quot;errors&quot;</span><span class="p">:</span> <span class="p">[],</span>
<span class="s">&quot;sources&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="s">&quot;fedora&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="s">&quot;check_gpg&quot;</span><span class="p">:</span> <span class="n">true</span><span class="p">,</span>
<span class="s">&quot;check_ssl&quot;</span><span class="p">:</span> <span class="n">true</span><span class="p">,</span>
<span class="s">&quot;gpgkey_urls&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="s">&quot;file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-28-x86_64&quot;</span>
<span class="p">],</span>
<span class="s">&quot;name&quot;</span><span class="p">:</span> <span class="s">&quot;fedora&quot;</span><span class="p">,</span>
<span class="s">&quot;proxy&quot;</span><span class="p">:</span> <span class="s">&quot;http://proxy.brianlane.com:8123&quot;</span><span class="p">,</span>
<span class="s">&quot;system&quot;</span><span class="p">:</span> <span class="n">true</span><span class="p">,</span>
<span class="s">&quot;type&quot;</span><span class="p">:</span> <span class="s">&quot;yum-metalink&quot;</span><span class="p">,</span>
<span class="s">&quot;url&quot;</span><span class="p">:</span> <span class="s">&quot;https://mirrors.fedoraproject.org/metalink?repo=fedora-28&amp;arch=x86_64&quot;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
</div></blockquote>
</div>
<div class="section" id="post-api-v0-projects-source-new">
<h4>POST <cite>/api/v0/projects/source/new</cite><a class="headerlink" href="#post-api-v0-projects-source-new" title="Permalink to this headline"></a></h4>
<blockquote>
<div><p>Add (or change) a source for use when depsolving blueprints and composing images.</p>
<p>The <tt class="docutils literal"><span class="pre">proxy</span></tt> and <tt class="docutils literal"><span class="pre">gpgkey_urls</span></tt> entries are optional. All of the others are required. The supported
types for the urls are:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">yum-baseurl</span></tt> is a URL to a yum repository.</li>
<li><tt class="docutils literal"><span class="pre">yum-mirrorlist</span></tt> is a URL for a mirrorlist.</li>
<li><tt class="docutils literal"><span class="pre">yum-metalink</span></tt> is a URL for a metalink.</li>
</ul>
<p>If <tt class="docutils literal"><span class="pre">check_ssl</span></tt> is true the https certificates must be valid. If they are self-signed you can either set
this to false, or add your Certificate Authority to the host system.</p>
<p>If <tt class="docutils literal"><span class="pre">check_gpg</span></tt> is true the GPG key must either be installed on the host system, or <tt class="docutils literal"><span class="pre">gpgkey_urls</span></tt>
should point to it.</p>
<p>You can edit an existing source (other than system sources), by doing a POST
of the new version of the source. It will overwrite the previous one.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span>
<span class="s">&quot;name&quot;</span><span class="p">:</span> <span class="s">&quot;custom-source-1&quot;</span><span class="p">,</span>
<span class="s">&quot;url&quot;</span><span class="p">:</span> <span class="s">&quot;https://url/path/to/repository/&quot;</span><span class="p">,</span>
<span class="s">&quot;type&quot;</span><span class="p">:</span> <span class="s">&quot;yum-baseurl&quot;</span><span class="p">,</span>
<span class="s">&quot;check_ssl&quot;</span><span class="p">:</span> <span class="n">true</span><span class="p">,</span>
<span class="s">&quot;check_gpg&quot;</span><span class="p">:</span> <span class="n">true</span><span class="p">,</span>
<span class="s">&quot;gpgkey_urls&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="s">&quot;https://url/path/to/gpg-key&quot;</span>
<span class="p">]</span>
<span class="p">}</span>
</pre></div>
</div>
</div></blockquote>
</div>
<div class="section" id="delete-api-v0-projects-source-delete-source-name">
<h4>DELETE <cite>/api/v0/projects/source/delete/&lt;source-name&gt;</cite><a class="headerlink" href="#delete-api-v0-projects-source-delete-source-name" title="Permalink to this headline"></a></h4>
<blockquote>
<div><p>Delete a user added source. This will fail if a system source is passed to
it.</p>
<p>The response will be a status response with <cite>status</cite> set to true, or an
error response with it set to false and an error message included.</p>
</div></blockquote>
</div>
<div class="section" id="api-v0-modules-list-offset-0-limit-20">
<h4><cite>/api/v0/modules/list[?offset=0&amp;limit=20]</cite><a class="headerlink" href="#api-v0-modules-list-offset-0-limit-20" title="Permalink to this headline"></a></h4>
<blockquote>
@ -3029,6 +3283,24 @@ a line boundry.</p>
</table>
</dd></dl>
<dl class="function">
<dt id="pylorax.api.yumbase.update_metadata">
<tt class="descclassname">pylorax.api.yumbase.</tt><tt class="descname">update_metadata</tt><big>(</big><em>yb</em><big>)</big><a class="reference internal" href="_modules/pylorax/api/yumbase.html#update_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.api.yumbase.update_metadata" title="Permalink to this definition"></a></dt>
<dd><p>Update the metadata for all the enabled repos</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>yb</strong> (<em>yum.YumBase</em>) &#8211; The Yum base object</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">None</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
@ -3070,6 +3342,10 @@ a line boundry.</p>
<li><a class="reference internal" href="#api-v0-projects-list-offset-0-limit-20"><cite>/api/v0/projects/list[?offset=0&amp;limit=20]</cite></a></li>
<li><a class="reference internal" href="#api-v0-projects-info-project-names"><cite>/api/v0/projects/info/&lt;project_names&gt;</cite></a></li>
<li><a class="reference internal" href="#api-v0-projects-depsolve-project-names"><cite>/api/v0/projects/depsolve/&lt;project_names&gt;</cite></a></li>
<li><a class="reference internal" href="#api-v0-projects-source-list"><cite>/api/v0/projects/source/list</cite></a></li>
<li><a class="reference internal" href="#api-v0-projects-source-info-source-names"><cite>/api/v0/projects/source/info/&lt;source-names&gt;</cite></a></li>
<li><a class="reference internal" href="#post-api-v0-projects-source-new">POST <cite>/api/v0/projects/source/new</cite></a></li>
<li><a class="reference internal" href="#delete-api-v0-projects-source-delete-source-name">DELETE <cite>/api/v0/projects/source/delete/&lt;source-name&gt;</cite></a></li>
<li><a class="reference internal" href="#api-v0-modules-list-offset-0-limit-20"><cite>/api/v0/modules/list[?offset=0&amp;limit=20]</cite></a></li>
<li><a class="reference internal" href="#api-v0-modules-list-module-names-offset-0-limit-20"><cite>/api/v0/modules/list/&lt;module_names&gt;[?offset=0&amp;limit=20]</cite></a></li>
<li><a class="reference internal" href="#api-v0-modules-info-module-names"><cite>/api/v0/modules/info/&lt;module_names&gt;</cite></a></li>
@ -3134,7 +3410,7 @@ a line boundry.</p>
<li class="right" >
<a href="pylorax.html" title="pylorax Package"
>previous</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="modules.html" >src</a> &raquo;</li>
<li><a href="pylorax.html" >pylorax Package</a> &raquo;</li>
</ul>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>pylorax Package &mdash; Lorax 19.7.15 documentation</title>
<title>pylorax Package &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -25,7 +25,7 @@
<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>
<link rel="top" title="Lorax 19.7.15 documentation" href="index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="index.html" />
<link rel="up" title="src" href="modules.html" />
<link rel="next" title="api Package" href="pylorax.api.html" />
<link rel="prev" title="cli Package" href="composer.cli.html" />
@ -46,7 +46,7 @@
<li class="right" >
<a href="composer.cli.html" title="cli Package"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="modules.html" accesskey="U">src</a> &raquo;</li>
</ul>
</div>
@ -97,7 +97,7 @@
<dl class="method">
<dt id="pylorax.Lorax.run">
<tt class="descname">run</tt><big>(</big><em>ybo</em>, <em>product</em>, <em>version</em>, <em>release</em>, <em>variant=''</em>, <em>bugurl=''</em>, <em>isfinal=False</em>, <em>workdir=None</em>, <em>outputdir=None</em>, <em>buildarch=None</em>, <em>volid=None</em>, <em>domacboot=False</em>, <em>doupgrade=True</em>, <em>remove_temp=False</em>, <em>installpkgs=None</em>, <em>size=2</em>, <em>add_templates=None</em>, <em>add_template_vars=None</em>, <em>add_arch_templates=None</em>, <em>add_arch_template_vars=None</em>, <em>template_tempdir=None</em><big>)</big><a class="reference internal" href="_modules/pylorax.html#Lorax.run"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.Lorax.run" title="Permalink to this definition"></a></dt>
<tt class="descname">run</tt><big>(</big><em>ybo</em>, <em>product</em>, <em>version</em>, <em>release</em>, <em>variant=''</em>, <em>bugurl=''</em>, <em>isfinal=False</em>, <em>workdir=None</em>, <em>outputdir=None</em>, <em>buildarch=None</em>, <em>volid=None</em>, <em>domacboot=False</em>, <em>doupgrade=True</em>, <em>remove_temp=False</em>, <em>installpkgs=None</em>, <em>size=2</em>, <em>add_templates=None</em>, <em>add_template_vars=None</em>, <em>add_arch_templates=None</em>, <em>add_arch_template_vars=None</em>, <em>template_tempdir=None</em>, <em>user_dracut_args=None</em><big>)</big><a class="reference internal" href="_modules/pylorax.html#Lorax.run"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.Lorax.run" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -116,27 +116,27 @@
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/2/library/functions.html#object" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></a></p>
<dl class="method">
<dt id="pylorax.base.BaseLoraxClass.pcritical">
<tt class="descname">pcritical</tt><big>(</big><em>msg</em>, <em>fobj=&lt;open file '&lt;stdout&gt;'</em>, <em>mode 'w' at 0x7fd44c5d2150&gt;</em><big>)</big><a class="reference internal" href="_modules/pylorax/base.html#BaseLoraxClass.pcritical"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.BaseLoraxClass.pcritical" title="Permalink to this definition"></a></dt>
<tt class="descname">pcritical</tt><big>(</big><em>msg</em>, <em>fobj=&lt;open file '&lt;stdout&gt;'</em>, <em>mode 'w' at 0x7f488c86d150&gt;</em><big>)</big><a class="reference internal" href="_modules/pylorax/base.html#BaseLoraxClass.pcritical"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.BaseLoraxClass.pcritical" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.base.BaseLoraxClass.pdebug">
<tt class="descname">pdebug</tt><big>(</big><em>msg</em>, <em>fobj=&lt;open file '&lt;stdout&gt;'</em>, <em>mode 'w' at 0x7fd44c5d2150&gt;</em><big>)</big><a class="reference internal" href="_modules/pylorax/base.html#BaseLoraxClass.pdebug"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.BaseLoraxClass.pdebug" title="Permalink to this definition"></a></dt>
<tt class="descname">pdebug</tt><big>(</big><em>msg</em>, <em>fobj=&lt;open file '&lt;stdout&gt;'</em>, <em>mode 'w' at 0x7f488c86d150&gt;</em><big>)</big><a class="reference internal" href="_modules/pylorax/base.html#BaseLoraxClass.pdebug"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.BaseLoraxClass.pdebug" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.base.BaseLoraxClass.perror">
<tt class="descname">perror</tt><big>(</big><em>msg</em>, <em>fobj=&lt;open file '&lt;stdout&gt;'</em>, <em>mode 'w' at 0x7fd44c5d2150&gt;</em><big>)</big><a class="reference internal" href="_modules/pylorax/base.html#BaseLoraxClass.perror"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.BaseLoraxClass.perror" title="Permalink to this definition"></a></dt>
<tt class="descname">perror</tt><big>(</big><em>msg</em>, <em>fobj=&lt;open file '&lt;stdout&gt;'</em>, <em>mode 'w' at 0x7f488c86d150&gt;</em><big>)</big><a class="reference internal" href="_modules/pylorax/base.html#BaseLoraxClass.perror"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.BaseLoraxClass.perror" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.base.BaseLoraxClass.pinfo">
<tt class="descname">pinfo</tt><big>(</big><em>msg</em>, <em>fobj=&lt;open file '&lt;stdout&gt;'</em>, <em>mode 'w' at 0x7fd44c5d2150&gt;</em><big>)</big><a class="reference internal" href="_modules/pylorax/base.html#BaseLoraxClass.pinfo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.BaseLoraxClass.pinfo" title="Permalink to this definition"></a></dt>
<tt class="descname">pinfo</tt><big>(</big><em>msg</em>, <em>fobj=&lt;open file '&lt;stdout&gt;'</em>, <em>mode 'w' at 0x7f488c86d150&gt;</em><big>)</big><a class="reference internal" href="_modules/pylorax/base.html#BaseLoraxClass.pinfo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.BaseLoraxClass.pinfo" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pylorax.base.BaseLoraxClass.pwarning">
<tt class="descname">pwarning</tt><big>(</big><em>msg</em>, <em>fobj=&lt;open file '&lt;stdout&gt;'</em>, <em>mode 'w' at 0x7fd44c5d2150&gt;</em><big>)</big><a class="reference internal" href="_modules/pylorax/base.html#BaseLoraxClass.pwarning"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.BaseLoraxClass.pwarning" title="Permalink to this definition"></a></dt>
<tt class="descname">pwarning</tt><big>(</big><em>msg</em>, <em>fobj=&lt;open file '&lt;stdout&gt;'</em>, <em>mode 'w' at 0x7f488c86d150&gt;</em><big>)</big><a class="reference internal" href="_modules/pylorax/base.html#BaseLoraxClass.pwarning"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.BaseLoraxClass.pwarning" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -601,8 +601,11 @@ Raises RuntimeError if more than one loop is associated</p>
<dl class="function">
<dt id="pylorax.imgutils.loop_attach">
<tt class="descclassname">pylorax.imgutils.</tt><tt class="descname">loop_attach</tt><big>(</big><em>outfile</em><big>)</big><a class="reference internal" href="_modules/pylorax/imgutils.html#loop_attach"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.loop_attach" title="Permalink to this definition"></a></dt>
<dd><p>Attach a loop device to the given file. Return the loop device name.
Raises CalledProcessError if losetup fails.</p>
<dd><p>Attach a loop device to the given file. Return the loop device name.</p>
<p>On rare occasions it appears that the device never shows up, some experiments
seem to indicate that it may be a race with another process using /dev/loop* devices.</p>
<p>So we now try 3 times before actually failing.</p>
<p>Raises CalledProcessError if losetup fails.</p>
</dd></dl>
<dl class="function">
@ -772,7 +775,7 @@ initrd.img than the iso has. The iso is still used for stage2.</p>
<dl class="class">
<dt id="pylorax.installer.VirtualInstall">
<em class="property">class </em><tt class="descclassname">pylorax.installer.</tt><tt class="descname">VirtualInstall</tt><big>(</big><em>iso</em>, <em>ks_paths</em>, <em>disk_img</em>, <em>img_size=2</em>, <em>kernel_args=None</em>, <em>memory=1024</em>, <em>vnc=None</em>, <em>arch=None</em>, <em>log_check=None</em>, <em>virtio_host='127.0.0.1'</em>, <em>virtio_port=6080</em>, <em>qcow2=False</em><big>)</big><a class="reference internal" href="_modules/pylorax/installer.html#VirtualInstall"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.installer.VirtualInstall" title="Permalink to this definition"></a></dt>
<em class="property">class </em><tt class="descclassname">pylorax.installer.</tt><tt class="descname">VirtualInstall</tt><big>(</big><em>iso</em>, <em>ks_paths</em>, <em>disk_img</em>, <em>img_size=2</em>, <em>kernel_args=None</em>, <em>memory=1024</em>, <em>vnc=None</em>, <em>arch=None</em>, <em>log_check=None</em>, <em>virtio_host='127.0.0.1'</em>, <em>virtio_port=6080</em>, <em>qcow2=False</em>, <em>boot_uefi=False</em>, <em>ovmf_path=None</em><big>)</big><a class="reference internal" href="_modules/pylorax/installer.html#VirtualInstall"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.installer.VirtualInstall" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/2/library/functions.html#object" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></a></p>
<p>Run virt-install using an iso and kickstart(s)</p>
<dl class="method">
@ -1492,6 +1495,10 @@ image is built with the filename &#8220;${prefix}-${kernel.version}.img&#8221;</
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#api-v0-projects-list-offset-0-limit-20"><cite>/api/v0/projects/list[?offset=0&amp;limit=20]</cite></a></li>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#api-v0-projects-info-project-names"><cite>/api/v0/projects/info/&lt;project_names&gt;</cite></a></li>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#api-v0-projects-depsolve-project-names"><cite>/api/v0/projects/depsolve/&lt;project_names&gt;</cite></a></li>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#api-v0-projects-source-list"><cite>/api/v0/projects/source/list</cite></a></li>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#api-v0-projects-source-info-source-names"><cite>/api/v0/projects/source/info/&lt;source-names&gt;</cite></a></li>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#post-api-v0-projects-source-new">POST <cite>/api/v0/projects/source/new</cite></a></li>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#delete-api-v0-projects-source-delete-source-name">DELETE <cite>/api/v0/projects/source/delete/&lt;source-name&gt;</cite></a></li>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#api-v0-modules-list-offset-0-limit-20"><cite>/api/v0/modules/list[?offset=0&amp;limit=20]</cite></a></li>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#api-v0-modules-list-module-names-offset-0-limit-20"><cite>/api/v0/modules/list/&lt;module_names&gt;[?offset=0&amp;limit=20]</cite></a></li>
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#api-v0-modules-info-module-names"><cite>/api/v0/modules/info/&lt;module_names&gt;</cite></a></li>
@ -1597,7 +1604,7 @@ image is built with the filename &#8220;${prefix}-${kernel.version}.img&#8221;</
<li class="right" >
<a href="composer.cli.html" title="cli Package"
>previous</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
<li><a href="modules.html" >src</a> &raquo;</li>
</ul>
</div>

View File

@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Search &mdash; Lorax 19.7.15 documentation</title>
<title>Search &mdash; Lorax 19.7.18 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@ -16,7 +16,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '19.7.15',
VERSION: '19.7.18',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@ -26,7 +26,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/searchtools.js"></script>
<link rel="top" title="Lorax 19.7.15 documentation" href="index.html" />
<link rel="top" title="Lorax 19.7.18 documentation" href="index.html" />
<script type="text/javascript">
jQuery(function() { Search.loadIndex("searchindex.js"); });
</script>
@ -43,7 +43,7 @@
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
@ -94,7 +94,7 @@
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="index.html">Lorax 19.7.15 documentation</a> &raquo;</li>
<li><a href="index.html">Lorax 19.7.18 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">

File diff suppressed because one or more lines are too long