Add lorax 28.17 documentation
This commit is contained in:
parent
9482ad3f4a
commit
5a919ed4b1
@ -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: 8c6d5046be6cdda5a0fb930f5ba51489
|
||||
config: 3a668c2f46d22054be7f83ab00baa16f
|
||||
tags: 645f666f9bcd5a90fca523b33c5a78b7
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Overview: module code — Lorax 28.14 documentation</title>
|
||||
<title>Overview: module code — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -156,6 +156,7 @@
|
||||
<li><a href="pylorax/api/compose.html">pylorax.api.compose</a></li>
|
||||
<li><a href="pylorax/api/config.html">pylorax.api.config</a></li>
|
||||
<li><a href="pylorax/api/crossdomain.html">pylorax.api.crossdomain</a></li>
|
||||
<li><a href="pylorax/api/dnfbase.html">pylorax.api.dnfbase</a></li>
|
||||
<li><a href="pylorax/api/projects.html">pylorax.api.projects</a></li>
|
||||
<li><a href="pylorax/api/queue.html">pylorax.api.queue</a></li>
|
||||
<li><a href="pylorax/api/recipes.html">pylorax.api.recipes</a></li>
|
||||
@ -212,7 +213,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax — Lorax 28.14 documentation</title>
|
||||
<title>pylorax — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -642,7 +642,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.api.cmdline — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.api.cmdline — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -247,7 +247,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.api.compose — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.api.compose — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -203,13 +203,44 @@
|
||||
<span class="kn">from</span> <span class="nn">pykickstart.parser</span> <span class="k">import</span> <span class="n">KickstartParser</span>
|
||||
<span class="kn">from</span> <span class="nn">pykickstart.version</span> <span class="k">import</span> <span class="n">makeVersion</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.projects</span> <span class="k">import</span> <span class="n">projects_depsolve_with_size</span><span class="p">,</span> <span class="n">dep_nevra</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.projects</span> <span class="k">import</span> <span class="n">projects_depsolve</span><span class="p">,</span> <span class="n">projects_depsolve_with_size</span><span class="p">,</span> <span class="n">dep_nevra</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.projects</span> <span class="k">import</span> <span class="n">ProjectsError</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.recipes</span> <span class="k">import</span> <span class="n">read_recipe_and_id</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.timestamp</span> <span class="k">import</span> <span class="n">TS_CREATED</span><span class="p">,</span> <span class="n">write_timestamp</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.imgutils</span> <span class="k">import</span> <span class="n">default_image_name</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="k">import</span> <span class="n">joinpaths</span>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="test_templates"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.compose.test_templates">[docs]</a><span class="k">def</span> <span class="nf">test_templates</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">share_dir</span><span class="p">):</span>
|
||||
<span class="sd">""" Try depsolving each of the the templates and report any errors</span>
|
||||
|
||||
<span class="sd"> :param dbo: dnf base object</span>
|
||||
<span class="sd"> :type dbo: dnf.Base</span>
|
||||
<span class="sd"> :returns: List of template types and errors</span>
|
||||
<span class="sd"> :rtype: List of errors</span>
|
||||
|
||||
<span class="sd"> Return a list of templates and errors encountered or an empty list</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">template_errors</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">compose_type</span> <span class="ow">in</span> <span class="n">compose_types</span><span class="p">(</span><span class="n">share_dir</span><span class="p">):</span>
|
||||
<span class="c1"># Read the kickstart template for this type</span>
|
||||
<span class="n">ks_template_path</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">share_dir</span><span class="p">,</span> <span class="s2">"composer"</span><span class="p">,</span> <span class="n">compose_type</span><span class="p">)</span> <span class="o">+</span> <span class="s2">".ks"</span>
|
||||
<span class="n">ks_template</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">ks_template_path</span><span class="p">,</span> <span class="s2">"r"</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
|
||||
|
||||
<span class="c1"># How much space will the packages in the default template take?</span>
|
||||
<span class="n">ks_version</span> <span class="o">=</span> <span class="n">makeVersion</span><span class="p">()</span>
|
||||
<span class="n">ks</span> <span class="o">=</span> <span class="n">KickstartParser</span><span class="p">(</span><span class="n">ks_version</span><span class="p">,</span> <span class="n">errorsAreFatal</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">missingIncludeIsFatal</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
|
||||
<span class="n">ks</span><span class="o">.</span><span class="n">readKickstartFromString</span><span class="p">(</span><span class="n">ks_template</span><span class="o">+</span><span class="s2">"</span><span class="se">\n</span><span class="si">%e</span><span class="s2">nd</span><span class="se">\n</span><span class="s2">"</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="s2">"*"</span><span class="p">)</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">packages</span><span class="o">.</span><span class="n">packageList</span><span class="p">]</span>
|
||||
<span class="n">grps</span> <span class="o">=</span> <span class="p">[</span><span class="n">grp</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">grp</span> <span class="ow">in</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">packages</span><span class="o">.</span><span class="n">groupList</span><span class="p">]</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">_</span> <span class="o">=</span> <span class="n">projects_depsolve</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">pkgs</span><span class="p">,</span> <span class="n">grps</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="n">ProjectsError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">template_errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"Error depsolving </span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">compose_type</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)))</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">template_errors</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="repo_to_ks"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.compose.repo_to_ks">[docs]</a><span class="k">def</span> <span class="nf">repo_to_ks</span><span class="p">(</span><span class="n">r</span><span class="p">,</span> <span class="n">url</span><span class="o">=</span><span class="s2">"url"</span><span class="p">):</span>
|
||||
<span class="sd">""" Return a kickstart line with the correct args.</span>
|
||||
<span class="sd"> :param r: DNF repository information</span>
|
||||
@ -386,7 +417,7 @@
|
||||
<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">dnflock</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
|
||||
<span class="p">(</span><span class="n">installed_size</span><span class="p">,</span> <span class="n">deps</span><span class="p">)</span> <span class="o">=</span> <span class="n">projects_depsolve_with_size</span><span class="p">(</span><span class="n">dnflock</span><span class="o">.</span><span class="n">dbo</span><span class="p">,</span> <span class="n">projects</span><span class="p">,</span> <span class="n">with_core</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
|
||||
<span class="p">(</span><span class="n">installed_size</span><span class="p">,</span> <span class="n">deps</span><span class="p">)</span> <span class="o">=</span> <span class="n">projects_depsolve_with_size</span><span class="p">(</span><span class="n">dnflock</span><span class="o">.</span><span class="n">dbo</span><span class="p">,</span> <span class="n">projects</span><span class="p">,</span> <span class="n">recipe</span><span class="o">.</span><span class="n">group_names</span><span class="p">,</span> <span class="n">with_core</span><span class="o">=</span><span class="kc">False</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="s2">"start_build depsolve: </span><span class="si">%s</span><span class="s2">"</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="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Problem depsolving </span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">recipe</span><span class="p">[</span><span class="s2">"name"</span><span class="p">],</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)))</span>
|
||||
@ -399,11 +430,11 @@
|
||||
<span class="n">ks_version</span> <span class="o">=</span> <span class="n">makeVersion</span><span class="p">()</span>
|
||||
<span class="n">ks</span> <span class="o">=</span> <span class="n">KickstartParser</span><span class="p">(</span><span class="n">ks_version</span><span class="p">,</span> <span class="n">errorsAreFatal</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">missingIncludeIsFatal</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
|
||||
<span class="n">ks</span><span class="o">.</span><span class="n">readKickstartFromString</span><span class="p">(</span><span class="n">ks_template</span><span class="o">+</span><span class="s2">"</span><span class="se">\n</span><span class="si">%e</span><span class="s2">nd</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span>
|
||||
<span class="n">ks_projects</span> <span class="o">=</span> <span class="p">[(</span><span class="n">name</span><span class="p">,</span> <span class="s2">"*"</span><span class="p">)</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">packages</span><span class="o">.</span><span class="n">packageList</span><span class="p">]</span>
|
||||
<span class="n">pkgs</span> <span class="o">=</span> <span class="p">[(</span><span class="n">name</span><span class="p">,</span> <span class="s2">"*"</span><span class="p">)</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">packages</span><span class="o">.</span><span class="n">packageList</span><span class="p">]</span>
|
||||
<span class="n">grps</span> <span class="o">=</span> <span class="p">[</span><span class="n">grp</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">grp</span> <span class="ow">in</span> <span class="n">ks</span><span class="o">.</span><span class="n">handler</span><span class="o">.</span><span class="n">packages</span><span class="o">.</span><span class="n">groupList</span><span class="p">]</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="k">with</span> <span class="n">dnflock</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">dnflock</span><span class="o">.</span><span class="n">dbo</span><span class="p">,</span> <span class="n">ks_projects</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="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">dnflock</span><span class="o">.</span><span class="n">dbo</span><span class="p">,</span> <span class="n">pkgs</span><span class="p">,</span> <span class="n">grps</span><span class="p">,</span> <span class="n">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="s2">"start_build depsolve: </span><span class="si">%s</span><span class="s2">"</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="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Problem depsolving </span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">recipe</span><span class="p">[</span><span class="s2">"name"</span><span class="p">],</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)))</span>
|
||||
@ -460,6 +491,10 @@
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">"repo composer-</span><span class="si">%s</span><span class="s2"> = </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">idx</span><span class="p">,</span> <span class="n">ks_repo</span><span class="p">)</span>
|
||||
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s1">'repo --name="composer-</span><span class="si">%s</span><span class="s1">" </span><span class="si">%s</span><span class="se">\n</span><span class="s1">'</span> <span class="o">%</span> <span class="p">(</span><span class="n">idx</span><span class="p">,</span> <span class="n">ks_repo</span><span class="p">))</span>
|
||||
|
||||
<span class="c1"># Setup the disk for booting</span>
|
||||
<span class="c1"># TODO Add GPT and UEFI boot support</span>
|
||||
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s1">'clearpart --all --initlabel</span><span class="se">\n</span><span class="s1">'</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Write the root partition and it's size in MB (rounded up)</span>
|
||||
<span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s1">'part / --fstype="ext4" --size=</span><span class="si">%d</span><span class="se">\n</span><span class="s1">'</span> <span class="o">%</span> <span class="n">ceil</span><span class="p">(</span><span class="n">installed_size</span> <span class="o">/</span> <span class="mi">1024</span><span class="o">**</span><span class="mi">2</span><span class="p">))</span>
|
||||
|
||||
@ -505,6 +540,7 @@
|
||||
<span class="k">if</span> <span class="n">test_mode</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="s2">"TEST"</span><span class="p">),</span> <span class="s2">"w"</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"</span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">test_mode</span><span class="p">)</span>
|
||||
|
||||
<span class="n">write_timestamp</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="n">TS_CREATED</span><span class="p">)</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"Adding </span><span class="si">%s</span><span class="s2"> (</span><span class="si">%s</span><span class="s2"> </span><span class="si">%s</span><span class="s2">) to compose queue"</span><span class="p">,</span> <span class="n">build_id</span><span class="p">,</span> <span class="n">recipe</span><span class="p">[</span><span class="s2">"name"</span><span class="p">],</span> <span class="n">compose_type</span><span class="p">)</span>
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">symlink</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">lib_dir</span><span class="p">,</span> <span class="s2">"queue/new/"</span><span class="p">,</span> <span class="n">build_id</span><span class="p">))</span>
|
||||
|
||||
@ -698,7 +734,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.api.config — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.api.config — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -302,7 +302,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.api.crossdomain — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.api.crossdomain — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -253,7 +253,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
310
f28-branch/_modules/pylorax/api/dnfbase.html
Normal file
310
f28-branch/_modules/pylorax/api/dnfbase.html
Normal file
@ -0,0 +1,310 @@
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.api.dnfbase — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
|
||||
|
||||
<script src="../../../_static/js/modernizr.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="wy-body-for-nav">
|
||||
|
||||
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search">
|
||||
|
||||
|
||||
|
||||
<a href="../../../index.html" class="icon icon-home"> Lorax
|
||||
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="search">
|
||||
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
|
||||
<input type="text" name="q" placeholder="Search docs" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../intro.html">Introduction to Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../intro.html#before-lorax">Before Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../lorax.html">Lorax</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../livemedia-creator.html">livemedia-creator</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../lorax-composer.html">lorax-composer</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../composer-cli.html">composer-cli</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../product-images.html">Product and Updates Images</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../modules.html">pylorax</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||
|
||||
|
||||
<nav class="wy-nav-top" aria-label="top navigation">
|
||||
|
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||
<a href="../../../index.html">Lorax</a>
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="wy-nav-content">
|
||||
|
||||
<div class="rst-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||
|
||||
<ul class="wy-breadcrumbs">
|
||||
|
||||
<li><a href="../../../index.html">Docs</a> »</li>
|
||||
|
||||
<li><a href="../../index.html">Module code</a> »</li>
|
||||
|
||||
<li><a href="../../pylorax.html">pylorax</a> »</li>
|
||||
|
||||
<li>pylorax.api.dnfbase</li>
|
||||
|
||||
|
||||
<li class="wy-breadcrumbs-aside">
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<hr/>
|
||||
</div>
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
|
||||
<h1>Source code for pylorax.api.dnfbase</h1><div class="highlight"><pre>
|
||||
<span></span><span class="c1">#</span>
|
||||
<span class="c1"># Copyright (C) 2017-2018 Red Hat, Inc.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># This program is free software; you can redistribute it and/or modify</span>
|
||||
<span class="c1"># it under the terms of the GNU General Public License as published by</span>
|
||||
<span class="c1"># the Free Software Foundation; either version 2 of the License, or</span>
|
||||
<span class="c1"># (at your option) any later version.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># This program is distributed in the hope that it will be useful,</span>
|
||||
<span class="c1"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
|
||||
<span class="c1"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
|
||||
<span class="c1"># GNU General Public License for more details.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># You should have received a copy of the GNU General Public License</span>
|
||||
<span class="c1"># along with this program. If not, see <http://www.gnu.org/licenses/>.</span>
|
||||
<span class="c1">#</span>
|
||||
<span class="c1"># pylint: disable=bad-preconf-access</span>
|
||||
|
||||
<span class="kn">import</span> <span class="nn">logging</span>
|
||||
<span class="n">log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">"lorax-composer"</span><span class="p">)</span>
|
||||
|
||||
<span class="kn">import</span> <span class="nn">dnf</span>
|
||||
<span class="kn">import</span> <span class="nn">dnf.logging</span>
|
||||
<span class="kn">from</span> <span class="nn">glob</span> <span class="k">import</span> <span class="n">glob</span>
|
||||
<span class="kn">import</span> <span class="nn">os</span>
|
||||
<span class="kn">import</span> <span class="nn">shutil</span>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="get_base_object"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.dnfbase.get_base_object">[docs]</a><span class="k">def</span> <span class="nf">get_base_object</span><span class="p">(</span><span class="n">conf</span><span class="p">):</span>
|
||||
<span class="sd">"""Get the DNF object with settings from the config file</span>
|
||||
|
||||
<span class="sd"> :param conf: configuration object</span>
|
||||
<span class="sd"> :type conf: ComposerParser</span>
|
||||
<span class="sd"> :returns: A DNF Base object</span>
|
||||
<span class="sd"> :rtype: dnf.Base</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">cachedir</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="s2">"composer"</span><span class="p">,</span> <span class="s2">"cache_dir"</span><span class="p">))</span>
|
||||
<span class="n">dnfconf</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="s2">"composer"</span><span class="p">,</span> <span class="s2">"dnf_conf"</span><span class="p">))</span>
|
||||
<span class="n">dnfroot</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="s2">"composer"</span><span class="p">,</span> <span class="s2">"dnf_root"</span><span class="p">))</span>
|
||||
<span class="n">repodir</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="s2">"composer"</span><span class="p">,</span> <span class="s2">"repo_dir"</span><span class="p">))</span>
|
||||
|
||||
<span class="c1"># Setup the config for the DNF Base object</span>
|
||||
<span class="n">dbo</span> <span class="o">=</span> <span class="n">dnf</span><span class="o">.</span><span class="n">Base</span><span class="p">()</span>
|
||||
<span class="n">dbc</span> <span class="o">=</span> <span class="n">dbo</span><span class="o">.</span><span class="n">conf</span>
|
||||
<span class="c1"># TODO - Handle this</span>
|
||||
<span class="c1"># dbc.logdir = logdir</span>
|
||||
<span class="n">dbc</span><span class="o">.</span><span class="n">installroot</span> <span class="o">=</span> <span class="n">dnfroot</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">dnfroot</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">dnfroot</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">repodir</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">repodir</span><span class="p">)</span>
|
||||
|
||||
<span class="n">dbc</span><span class="o">.</span><span class="n">cachedir</span> <span class="o">=</span> <span class="n">cachedir</span>
|
||||
<span class="n">dbc</span><span class="o">.</span><span class="n">reposdir</span> <span class="o">=</span> <span class="p">[</span><span class="n">repodir</span><span class="p">]</span>
|
||||
<span class="n">dbc</span><span class="o">.</span><span class="n">install_weak_deps</span> <span class="o">=</span> <span class="kc">False</span>
|
||||
<span class="n">dbc</span><span class="o">.</span><span class="n">prepend_installroot</span><span class="p">(</span><span class="s1">'persistdir'</span><span class="p">)</span>
|
||||
<span class="n">dbc</span><span class="o">.</span><span class="n">tsflags</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s1">'nodocs'</span><span class="p">)</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">conf</span><span class="o">.</span><span class="n">get_default</span><span class="p">(</span><span class="s2">"dnf"</span><span class="p">,</span> <span class="s2">"proxy"</span><span class="p">,</span> <span class="kc">None</span><span class="p">):</span>
|
||||
<span class="n">dbc</span><span class="o">.</span><span class="n">proxy</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="s2">"dnf"</span><span class="p">,</span> <span class="s2">"proxy"</span><span class="p">)</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">conf</span><span class="o">.</span><span class="n">has_option</span><span class="p">(</span><span class="s2">"dnf"</span><span class="p">,</span> <span class="s2">"sslverify"</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">conf</span><span class="o">.</span><span class="n">getboolean</span><span class="p">(</span><span class="s2">"dnf"</span><span class="p">,</span> <span class="s2">"sslverify"</span><span class="p">):</span>
|
||||
<span class="n">dbc</span><span class="o">.</span><span class="n">sslverify</span> <span class="o">=</span> <span class="kc">False</span>
|
||||
|
||||
<span class="n">_releasever</span> <span class="o">=</span> <span class="n">conf</span><span class="o">.</span><span class="n">get_default</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"releasever"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">_releasever</span><span class="p">:</span>
|
||||
<span class="c1"># Use the releasever of the host system</span>
|
||||
<span class="n">_releasever</span> <span class="o">=</span> <span class="n">dnf</span><span class="o">.</span><span class="n">rpm</span><span class="o">.</span><span class="n">detect_releasever</span><span class="p">(</span><span class="s2">"/"</span><span class="p">)</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"releasever = </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">_releasever</span><span class="p">)</span>
|
||||
<span class="n">dbc</span><span class="o">.</span><span class="n">releasever</span> <span class="o">=</span> <span class="n">_releasever</span>
|
||||
|
||||
<span class="c1"># write the dnf configuration file</span>
|
||||
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">dnfconf</span><span class="p">,</span> <span class="s2">"w"</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">dbc</span><span class="o">.</span><span class="n">dump</span><span class="p">())</span>
|
||||
|
||||
<span class="c1"># dnf needs the repos all in one directory, composer uses repodir for this</span>
|
||||
<span class="c1"># if system repos are supposed to be used, copy them into repodir, overwriting any previous copies</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">conf</span><span class="o">.</span><span class="n">has_option</span><span class="p">(</span><span class="s2">"repos"</span><span class="p">,</span> <span class="s2">"use_system_repos"</span><span class="p">)</span> <span class="ow">or</span> <span class="n">conf</span><span class="o">.</span><span class="n">getboolean</span><span class="p">(</span><span class="s2">"repos"</span><span class="p">,</span> <span class="s2">"use_system_repos"</span><span class="p">):</span>
|
||||
<span class="k">for</span> <span class="n">repo_file</span> <span class="ow">in</span> <span class="n">glob</span><span class="p">(</span><span class="s2">"/etc/yum.repos.d/*.repo"</span><span class="p">):</span>
|
||||
<span class="n">shutil</span><span class="o">.</span><span class="n">copy2</span><span class="p">(</span><span class="n">repo_file</span><span class="p">,</span> <span class="n">repodir</span><span class="p">)</span>
|
||||
<span class="n">dbo</span><span class="o">.</span><span class="n">read_all_repos</span><span class="p">()</span>
|
||||
|
||||
<span class="c1"># Update the metadata from the enabled repos to speed up later operations</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"Updating repository metadata"</span><span class="p">)</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">dbo</span><span class="o">.</span><span class="n">fill_sack</span><span class="p">(</span><span class="n">load_system_repo</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
|
||||
<span class="n">dbo</span><span class="o">.</span><span class="n">read_comps</span><span class="p">()</span>
|
||||
<span class="k">except</span> <span class="n">dnf</span><span class="o">.</span><span class="n">exceptions</span><span class="o">.</span><span class="n">Error</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"Failed to update metadata: </span><span class="si">%s</span><span class="s2">"</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="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Fetching metadata failed: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">dbo</span></div>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
<div role="contentinfo">
|
||||
<p>
|
||||
© Copyright 2018, Red Hat, Inc..
|
||||
|
||||
</p>
|
||||
</div>
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
||||
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../../',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
HAS_SOURCE: true,
|
||||
SOURCELINK_SUFFIX: '.txt'
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../../_static/js/theme.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function () {
|
||||
SphinxRtdTheme.Navigation.enable(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.api.projects — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.api.projects — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -339,45 +339,60 @@
|
||||
<span class="n">pkgs</span> <span class="o">=</span> <span class="n">dbo</span><span class="o">.</span><span class="n">sack</span><span class="o">.</span><span class="n">query</span><span class="p">()</span><span class="o">.</span><span class="n">available</span><span class="p">()</span>
|
||||
<span class="k">return</span> <span class="nb">sorted</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="n">pkg_to_project_info</span><span class="p">,</span> <span class="n">pkgs</span><span class="p">),</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="n">p</span><span class="p">[</span><span class="s2">"name"</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span></div>
|
||||
|
||||
<span class="k">def</span> <span class="nf">_depsolve</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">projects</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="nf">_depsolve</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">projects</span><span class="p">,</span> <span class="n">groups</span><span class="p">):</span>
|
||||
<span class="sd">"""Add projects to a new transaction</span>
|
||||
|
||||
<span class="sd"> :param dbo: dnf base object</span>
|
||||
<span class="sd"> :type dbo: dnf.Base</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"> :param groups: The groups to include in dependency solving</span>
|
||||
<span class="sd"> :type groups: List of str</span>
|
||||
<span class="sd"> :returns: None</span>
|
||||
<span class="sd"> :rtype: None</span>
|
||||
<span class="sd"> :raises: ProjectsError if there was a problem installing something</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="c1"># This resets the transaction</span>
|
||||
<span class="n">dbo</span><span class="o">.</span><span class="n">reset</span><span class="p">(</span><span class="n">goal</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||||
<span class="n">install_errors</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">groups</span><span class="p">:</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">dbo</span><span class="o">.</span><span class="n">group_install</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="p">[</span><span class="s2">"mandatory"</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">])</span>
|
||||
<span class="k">except</span> <span class="n">dnf</span><span class="o">.</span><span class="n">exceptions</span><span class="o">.</span><span class="n">MarkingError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">install_errors</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="s2">"Group </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">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">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">try</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="s2">"*"</span>
|
||||
<span class="n">pkgs</span> <span class="o">=</span> <span class="p">[</span><span class="n">pkg</span> <span class="k">for</span> <span class="n">pkg</span> <span class="ow">in</span> <span class="n">dnf</span><span class="o">.</span><span class="n">subject</span><span class="o">.</span><span class="n">Subject</span><span class="p">(</span><span class="n">name</span><span class="p">)</span><span class="o">.</span><span class="n">get_best_query</span><span class="p">(</span><span class="n">dbo</span><span class="o">.</span><span class="n">sack</span><span class="p">)</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">version__glob</span><span class="o">=</span><span class="n">version</span><span class="p">,</span> <span class="n">latest</span><span class="o">=</span><span class="kc">True</span><span class="p">)]</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">pkgs</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="n">ProjectsError</span><span class="p">(</span><span class="s2">"No match for </span><span class="si">%s</span><span class="s2">-</span><span class="si">%s</span><span class="s2">"</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="n">install_errors</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="s2">"</span><span class="si">%s</span><span class="s2">-</span><span class="si">%s</span><span class="s2">"</span> <span class="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="s2">"No match"</span><span class="p">))</span>
|
||||
<span class="k">continue</span>
|
||||
|
||||
<span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">pkgs</span><span class="p">:</span>
|
||||
<span class="n">dbo</span><span class="o">.</span><span class="n">package_install</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="n">dnf</span><span class="o">.</span><span class="n">exceptions</span><span class="o">.</span><span class="n">MarkingError</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="n">ProjectsError</span><span class="p">(</span><span class="s2">"No match for </span><span class="si">%s</span><span class="s2">-</span><span class="si">%s</span><span class="s2">"</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">except</span> <span class="n">dnf</span><span class="o">.</span><span class="n">exceptions</span><span class="o">.</span><span class="n">MarkingError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">install_errors</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="s2">"</span><span class="si">%s</span><span class="s2">-</span><span class="si">%s</span><span class="s2">"</span> <span class="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="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)))</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">install_errors</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="n">ProjectsError</span><span class="p">(</span><span class="s2">"The following package(s) had problems: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="s2">","</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="s2">"</span><span class="si">%s</span><span class="s2"> (</span><span class="si">%s</span><span class="s2">)"</span> <span class="o">%</span> <span class="p">(</span><span class="n">pattern</span><span class="p">,</span> <span class="n">err</span><span class="p">)</span> <span class="k">for</span> <span class="n">pattern</span><span class="p">,</span> <span class="n">err</span> <span class="ow">in</span> <span class="n">install_errors</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">dbo</span><span class="p">,</span> <span class="n">projects</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">dbo</span><span class="p">,</span> <span class="n">projects</span><span class="p">,</span> <span class="n">groups</span><span class="p">):</span>
|
||||
<span class="sd">"""Return the dependencies for a list of projects</span>
|
||||
|
||||
<span class="sd"> :param dbo: dnf base object</span>
|
||||
<span class="sd"> :type dbo: dnf.Base</span>
|
||||
<span class="sd"> :param projects: The projects to find the dependencies for</span>
|
||||
<span class="sd"> :type projects: List of Strings</span>
|
||||
<span class="sd"> :param groups: The groups to include in dependency solving</span>
|
||||
<span class="sd"> :type groups: List of str</span>
|
||||
<span class="sd"> :returns: NEVRA'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"> """</span>
|
||||
<span class="n">_depsolve</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">projects</span><span class="p">)</span>
|
||||
<span class="n">_depsolve</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">projects</span><span class="p">,</span> <span class="n">groups</span><span class="p">)</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">dbo</span><span class="o">.</span><span class="n">resolve</span><span class="p">()</span>
|
||||
@ -411,18 +426,20 @@
|
||||
<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">dbo</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="kc">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">dbo</span><span class="p">,</span> <span class="n">projects</span><span class="p">,</span> <span class="n">groups</span><span class="p">,</span> <span class="n">with_core</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
|
||||
<span class="sd">"""Return the dependencies and installed size for a list of projects</span>
|
||||
|
||||
<span class="sd"> :param dbo: dnf base object</span>
|
||||
<span class="sd"> :type dbo: dnf.Base</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 groups: The groups to include in dependency solving</span>
|
||||
<span class="sd"> :type groups: List of str</span>
|
||||
<span class="sd"> :returns: installed size and a list of NEVRA'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"> """</span>
|
||||
<span class="n">_depsolve</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">projects</span><span class="p">)</span>
|
||||
<span class="n">_depsolve</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="n">projects</span><span class="p">,</span> <span class="n">groups</span><span class="p">)</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">with_core</span><span class="p">:</span>
|
||||
<span class="n">dbo</span><span class="o">.</span><span class="n">group_install</span><span class="p">(</span><span class="s2">"core"</span><span class="p">,</span> <span class="p">[</span><span class="s1">'mandatory'</span><span class="p">,</span> <span class="s1">'default'</span><span class="p">,</span> <span class="s1">'optional'</span><span class="p">])</span>
|
||||
@ -475,7 +492,7 @@
|
||||
|
||||
<span class="c1"># 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="s2">"dependencies"</span><span class="p">]</span> <span class="o">=</span> <span class="n">projects_depsolve</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="p">[(</span><span class="n">module</span><span class="p">[</span><span class="s2">"name"</span><span class="p">],</span> <span class="s2">"*.*"</span><span class="p">)])</span>
|
||||
<span class="n">module</span><span class="p">[</span><span class="s2">"dependencies"</span><span class="p">]</span> <span class="o">=</span> <span class="n">projects_depsolve</span><span class="p">(</span><span class="n">dbo</span><span class="p">,</span> <span class="p">[(</span><span class="n">module</span><span class="p">[</span><span class="s2">"name"</span><span class="p">],</span> <span class="s2">"*.*"</span><span class="p">)],</span> <span class="p">[])</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">modules</span></div>
|
||||
|
||||
@ -721,7 +738,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.api.queue — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.api.queue — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -188,6 +188,7 @@
|
||||
<span class="kn">from</span> <span class="nn">pylorax</span> <span class="k">import</span> <span class="n">find_templates</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.compose</span> <span class="k">import</span> <span class="n">move_compose_results</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.recipes</span> <span class="k">import</span> <span class="n">recipe_from_file</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.timestamp</span> <span class="k">import</span> <span class="n">TS_CREATED</span><span class="p">,</span> <span class="n">TS_STARTED</span><span class="p">,</span> <span class="n">TS_FINISHED</span><span class="p">,</span> <span class="n">write_timestamp</span><span class="p">,</span> <span class="n">timestamp_dict</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.base</span> <span class="k">import</span> <span class="n">DataHolder</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.creator</span> <span class="k">import</span> <span class="n">run_creator</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="k">import</span> <span class="n">joinpaths</span>
|
||||
@ -264,6 +265,7 @@
|
||||
<span class="n">make_compose</span><span class="p">(</span><span class="n">cfg</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">dst</span><span class="p">))</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">"Finished building </span><span class="si">%s</span><span class="s2">, results are in </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">dst</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">dst</span><span class="p">))</span>
|
||||
<span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">dst</span><span class="p">,</span> <span class="s2">"STATUS"</span><span class="p">),</span> <span class="s2">"w"</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"FINISHED</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span>
|
||||
<span class="n">write_timestamp</span><span class="p">(</span><span class="n">dst</span><span class="p">,</span> <span class="n">TS_FINISHED</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span><span class="p">:</span>
|
||||
<span class="kn">import</span> <span class="nn">traceback</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"traceback: </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">traceback</span><span class="o">.</span><span class="n">format_exc</span><span class="p">())</span>
|
||||
@ -271,6 +273,7 @@
|
||||
<span class="c1"># TODO - Write the error message to an ERROR-LOG file to include with the status</span>
|
||||
<span class="c1"># log.error("Error running compose: %s", e)</span>
|
||||
<span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">dst</span><span class="p">,</span> <span class="s2">"STATUS"</span><span class="p">),</span> <span class="s2">"w"</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">"FAILED</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span>
|
||||
<span class="n">write_timestamp</span><span class="p">(</span><span class="n">dst</span><span class="p">,</span> <span class="n">TS_FINISHED</span><span class="p">)</span>
|
||||
|
||||
<span class="n">os</span><span class="o">.</span><span class="n">unlink</span><span class="p">(</span><span class="n">dst</span><span class="p">)</span></div>
|
||||
|
||||
@ -351,6 +354,7 @@
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">"cfg = </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">install_cfg</span><span class="p">)</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<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="s2">"TEST"</span><span class="p">)</span>
|
||||
<span class="n">write_timestamp</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="n">TS_STARTED</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="c1"># 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">5</span><span class="p">)</span>
|
||||
@ -410,15 +414,21 @@
|
||||
|
||||
<span class="sd"> * id - The uuid of the comoposition</span>
|
||||
<span class="sd"> * queue_status - The final status of the composition (FINISHED or FAILED)</span>
|
||||
<span class="sd"> * timestamp - The time of the last status change</span>
|
||||
<span class="sd"> * compose_type - The type of output generated (tar, iso, etc.)</span>
|
||||
<span class="sd"> * blueprint - Blueprint name</span>
|
||||
<span class="sd"> * version - Blueprint version</span>
|
||||
<span class="sd"> * image_size - Size of the image, if finished. 0 otherwise.</span>
|
||||
|
||||
<span class="sd"> Various timestamps are also included in the dict. These are all Unix UTC timestamps.</span>
|
||||
<span class="sd"> It is possible for these timestamps to not always exist, in which case they will be</span>
|
||||
<span class="sd"> None in Python (or null in JSON). The following timestamps are included:</span>
|
||||
|
||||
<span class="sd"> * job_created - When the user submitted the compose</span>
|
||||
<span class="sd"> * job_started - Anaconda started running</span>
|
||||
<span class="sd"> * job_finished - Job entered FINISHED or FAILED state</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">build_id</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">basename</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">results_dir</span><span class="p">))</span>
|
||||
<span class="n">status</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="s2">"STATUS"</span><span class="p">))</span><span class="o">.</span><span class="n">read</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
|
||||
<span class="n">mtime</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">stat</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="s2">"STATUS"</span><span class="p">))</span><span class="o">.</span><span class="n">st_mtime</span>
|
||||
<span class="n">blueprint</span> <span class="o">=</span> <span class="n">recipe_from_file</span><span class="p">(</span><span class="n">joinpaths</span><span class="p">(</span><span class="n">results_dir</span><span class="p">,</span> <span class="s2">"blueprint.toml"</span><span class="p">))</span>
|
||||
|
||||
<span class="n">compose_type</span> <span class="o">=</span> <span class="n">get_compose_type</span><span class="p">(</span><span class="n">results_dir</span><span class="p">)</span>
|
||||
@ -429,9 +439,13 @@
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">image_size</span> <span class="o">=</span> <span class="mi">0</span>
|
||||
|
||||
<span class="n">times</span> <span class="o">=</span> <span class="n">timestamp_dict</span><span class="p">(</span><span class="n">results_dir</span><span class="p">)</span>
|
||||
|
||||
<span class="k">return</span> <span class="p">{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">build_id</span><span class="p">,</span>
|
||||
<span class="s2">"queue_status"</span><span class="p">:</span> <span class="n">status</span><span class="p">,</span>
|
||||
<span class="s2">"timestamp"</span><span class="p">:</span> <span class="n">mtime</span><span class="p">,</span>
|
||||
<span class="s2">"job_created"</span><span class="p">:</span> <span class="n">times</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">TS_CREATED</span><span class="p">),</span>
|
||||
<span class="s2">"job_started"</span><span class="p">:</span> <span class="n">times</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">TS_STARTED</span><span class="p">),</span>
|
||||
<span class="s2">"job_finished"</span><span class="p">:</span> <span class="n">times</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">TS_FINISHED</span><span class="p">),</span>
|
||||
<span class="s2">"compose_type"</span><span class="p">:</span> <span class="n">compose_type</span><span class="p">,</span>
|
||||
<span class="s2">"blueprint"</span><span class="p">:</span> <span class="n">blueprint</span><span class="p">[</span><span class="s2">"name"</span><span class="p">],</span>
|
||||
<span class="s2">"version"</span><span class="p">:</span> <span class="n">blueprint</span><span class="p">[</span><span class="s2">"version"</span><span class="p">],</span>
|
||||
@ -599,7 +613,7 @@
|
||||
<span class="sd"> :type cfg: ComposerConfig</span>
|
||||
<span class="sd"> :param uuid: The UUID of the build</span>
|
||||
<span class="sd"> :type uuid: str</span>
|
||||
<span class="sd"> :returns: dictionary of information about the composition</span>
|
||||
<span class="sd"> :returns: dictionary of information about the composition or None</span>
|
||||
<span class="sd"> :rtype: dict</span>
|
||||
<span class="sd"> :raises: RuntimeError if there was a problem</span>
|
||||
|
||||
@ -615,7 +629,7 @@
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">uuid_dir</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">cfg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"lib_dir"</span><span class="p">),</span> <span class="s2">"results"</span><span class="p">,</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">):</span>
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid build_id"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="kc">None</span>
|
||||
|
||||
<span class="c1"># Load the compose configuration</span>
|
||||
<span class="n">cfg_path</span> <span class="o">=</span> <span class="n">joinpaths</span><span class="p">(</span><span class="n">uuid_dir</span><span class="p">,</span> <span class="s2">"config.toml"</span><span class="p">)</span>
|
||||
@ -805,7 +819,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.api.recipes — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.api.recipes — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -204,21 +204,24 @@
|
||||
<span class="sd"> and adds a .filename property to return the recipe's filename,</span>
|
||||
<span class="sd"> and a .toml() function to return the recipe as a TOML string.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">description</span><span class="p">,</span> <span class="n">version</span><span class="p">,</span> <span class="n">modules</span><span class="p">,</span> <span class="n">packages</span><span class="p">,</span> <span class="n">customizations</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">description</span><span class="p">,</span> <span class="n">version</span><span class="p">,</span> <span class="n">modules</span><span class="p">,</span> <span class="n">packages</span><span class="p">,</span> <span class="n">groups</span><span class="p">,</span> <span class="n">customizations</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="c1"># Check that version is empty or semver compatible</span>
|
||||
<span class="k">if</span> <span class="n">version</span><span class="p">:</span>
|
||||
<span class="n">semver</span><span class="o">.</span><span class="n">Version</span><span class="p">(</span><span class="n">version</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Make sure modules and packages are listed by their case-insensitive names</span>
|
||||
<span class="c1"># Make sure modules, packages, and groups are listed by their case-insensitive names</span>
|
||||
<span class="k">if</span> <span class="n">modules</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="n">modules</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">modules</span><span class="p">,</span> <span class="n">key</span><span class="o">=</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="s2">"name"</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
|
||||
<span class="k">if</span> <span class="n">packages</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="n">packages</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">packages</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">p</span><span class="p">:</span> <span class="n">p</span><span class="p">[</span><span class="s2">"name"</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
|
||||
<span class="k">if</span> <span class="n">groups</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="n">groups</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">groups</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">g</span><span class="p">:</span> <span class="n">g</span><span class="p">[</span><span class="s2">"name"</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
|
||||
<span class="nb">dict</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="n">name</span><span class="p">,</span>
|
||||
<span class="n">description</span><span class="o">=</span><span class="n">description</span><span class="p">,</span>
|
||||
<span class="n">version</span><span class="o">=</span><span class="n">version</span><span class="p">,</span>
|
||||
<span class="n">modules</span><span class="o">=</span><span class="n">modules</span><span class="p">,</span>
|
||||
<span class="n">packages</span><span class="o">=</span><span class="n">packages</span><span class="p">,</span>
|
||||
<span class="n">groups</span><span class="o">=</span><span class="n">groups</span><span class="p">,</span>
|
||||
<span class="n">customizations</span><span class="o">=</span><span class="n">customizations</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># We don't want customizations=None to show up in the TOML so remove it</span>
|
||||
@ -245,6 +248,11 @@
|
||||
<span class="sd">"""Return the names and version globs of the modules"""</span>
|
||||
<span class="k">return</span> <span class="p">[(</span><span class="n">m</span><span class="p">[</span><span class="s2">"name"</span><span class="p">],</span> <span class="n">m</span><span class="p">[</span><span class="s2">"version"</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="s2">"modules"</span><span class="p">]</span> <span class="ow">or</span> <span class="p">[]]</span>
|
||||
|
||||
<span class="nd">@property</span>
|
||||
<span class="k">def</span> <span class="nf">group_names</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""Return the names of the groups. Groups do not have versions."""</span>
|
||||
<span class="k">return</span> <span class="nb">map</span><span class="p">(</span><span class="k">lambda</span> <span class="n">g</span><span class="p">:</span> <span class="n">g</span><span class="p">[</span><span class="s2">"name"</span><span class="p">],</span> <span class="bp">self</span><span class="p">[</span><span class="s2">"groups"</span><span class="p">]</span> <span class="ow">or</span> <span class="p">[])</span>
|
||||
|
||||
<span class="nd">@property</span>
|
||||
<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">"""Return the Recipe's filename</span>
|
||||
@ -301,21 +309,25 @@
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">module_names</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">module_names</span>
|
||||
<span class="n">package_names</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">package_names</span>
|
||||
<span class="n">group_names</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">group_names</span>
|
||||
|
||||
<span class="n">new_modules</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">new_packages</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">new_groups</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">dep</span> <span class="ow">in</span> <span class="n">deps</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">dep</span><span class="p">[</span><span class="s2">"name"</span><span class="p">]</span> <span class="ow">in</span> <span class="n">package_names</span><span class="p">:</span>
|
||||
<span class="n">new_packages</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">RecipePackage</span><span class="p">(</span><span class="n">dep</span><span class="p">[</span><span class="s2">"name"</span><span class="p">],</span> <span class="n">dep_evra</span><span class="p">(</span><span class="n">dep</span><span class="p">)))</span>
|
||||
<span class="k">elif</span> <span class="n">dep</span><span class="p">[</span><span class="s2">"name"</span><span class="p">]</span> <span class="ow">in</span> <span class="n">module_names</span><span class="p">:</span>
|
||||
<span class="n">new_modules</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">RecipeModule</span><span class="p">(</span><span class="n">dep</span><span class="p">[</span><span class="s2">"name"</span><span class="p">],</span> <span class="n">dep_evra</span><span class="p">(</span><span class="n">dep</span><span class="p">)))</span>
|
||||
<span class="k">elif</span> <span class="n">dep</span><span class="p">[</span><span class="s2">"name"</span><span class="p">]</span> <span class="ow">in</span> <span class="n">group_names</span><span class="p">:</span>
|
||||
<span class="n">new_groups</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">RecipeGroup</span><span class="p">(</span><span class="n">dep</span><span class="p">[</span><span class="s2">"name"</span><span class="p">]))</span>
|
||||
<span class="k">if</span> <span class="s2">"customizations"</span> <span class="ow">in</span> <span class="bp">self</span><span class="p">:</span>
|
||||
<span class="n">customizations</span> <span class="o">=</span> <span class="bp">self</span><span class="p">[</span><span class="s2">"customizations"</span><span class="p">]</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">customizations</span> <span class="o">=</span> <span class="kc">None</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">Recipe</span><span class="p">(</span><span class="bp">self</span><span class="p">[</span><span class="s2">"name"</span><span class="p">],</span> <span class="bp">self</span><span class="p">[</span><span class="s2">"description"</span><span class="p">],</span> <span class="bp">self</span><span class="p">[</span><span class="s2">"version"</span><span class="p">],</span>
|
||||
<span class="n">new_modules</span><span class="p">,</span> <span class="n">new_packages</span><span class="p">,</span> <span class="n">customizations</span><span class="p">)</span></div></div>
|
||||
<span class="n">new_modules</span><span class="p">,</span> <span class="n">new_packages</span><span class="p">,</span> <span class="n">new_groups</span><span class="p">,</span> <span class="n">customizations</span><span class="p">)</span></div></div>
|
||||
|
||||
<div class="viewcode-block" id="RecipeModule"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.recipes.RecipeModule">[docs]</a><span class="k">class</span> <span class="nc">RecipeModule</span><span class="p">(</span><span class="nb">dict</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">version</span><span class="p">):</span>
|
||||
@ -324,6 +336,10 @@
|
||||
<div class="viewcode-block" id="RecipePackage"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.recipes.RecipePackage">[docs]</a><span class="k">class</span> <span class="nc">RecipePackage</span><span class="p">(</span><span class="n">RecipeModule</span><span class="p">):</span>
|
||||
<span class="k">pass</span></div>
|
||||
|
||||
<div class="viewcode-block" id="RecipeGroup"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.recipes.RecipeGroup">[docs]</a><span class="k">class</span> <span class="nc">RecipeGroup</span><span class="p">(</span><span class="nb">dict</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
|
||||
<span class="nb">dict</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="n">name</span><span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="recipe_from_file"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.recipes.recipe_from_file">[docs]</a><span class="k">def</span> <span class="nf">recipe_from_file</span><span class="p">(</span><span class="n">recipe_path</span><span class="p">):</span>
|
||||
<span class="sd">"""Return a recipe file as a Recipe object</span>
|
||||
|
||||
@ -367,6 +383,10 @@
|
||||
<span class="n">packages</span> <span class="o">=</span> <span class="p">[</span><span class="n">RecipePackage</span><span class="p">(</span><span class="n">p</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"name"</span><span class="p">),</span> <span class="n">p</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"version"</span><span class="p">))</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">recipe_dict</span><span class="p">[</span><span class="s2">"packages"</span><span class="p">]]</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">packages</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">if</span> <span class="n">recipe_dict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"groups"</span><span class="p">):</span>
|
||||
<span class="n">groups</span> <span class="o">=</span> <span class="p">[</span><span class="n">RecipeGroup</span><span class="p">(</span><span class="n">g</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"name"</span><span class="p">))</span> <span class="k">for</span> <span class="n">g</span> <span class="ow">in</span> <span class="n">recipe_dict</span><span class="p">[</span><span class="s2">"groups"</span><span class="p">]]</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">groups</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">name</span> <span class="o">=</span> <span class="n">recipe_dict</span><span class="p">[</span><span class="s2">"name"</span><span class="p">]</span>
|
||||
<span class="n">description</span> <span class="o">=</span> <span class="n">recipe_dict</span><span class="p">[</span><span class="s2">"description"</span><span class="p">]</span>
|
||||
<span class="n">version</span> <span class="o">=</span> <span class="n">recipe_dict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"version"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
|
||||
@ -374,7 +394,7 @@
|
||||
<span class="k">except</span> <span class="ne">KeyError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="k">raise</span> <span class="n">RecipeError</span><span class="p">(</span><span class="s2">"There was a problem parsing the recipe: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">Recipe</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">description</span><span class="p">,</span> <span class="n">version</span><span class="p">,</span> <span class="n">modules</span><span class="p">,</span> <span class="n">packages</span><span class="p">,</span> <span class="n">customizations</span><span class="p">)</span></div>
|
||||
<span class="k">return</span> <span class="n">Recipe</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">description</span><span class="p">,</span> <span class="n">version</span><span class="p">,</span> <span class="n">modules</span><span class="p">,</span> <span class="n">packages</span><span class="p">,</span> <span class="n">groups</span><span class="p">,</span> <span class="n">customizations</span><span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="gfile"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.recipes.gfile">[docs]</a><span class="k">def</span> <span class="nf">gfile</span><span class="p">(</span><span class="n">path</span><span class="p">):</span>
|
||||
<span class="sd">"""Convert a string path to GFile for use with Git"""</span>
|
||||
@ -1054,6 +1074,7 @@
|
||||
|
||||
<span class="n">diffs</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">diff_items</span><span class="p">(</span><span class="s2">"Module"</span><span class="p">,</span> <span class="n">old_recipe</span><span class="p">[</span><span class="s2">"modules"</span><span class="p">],</span> <span class="n">new_recipe</span><span class="p">[</span><span class="s2">"modules"</span><span class="p">]))</span>
|
||||
<span class="n">diffs</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">diff_items</span><span class="p">(</span><span class="s2">"Package"</span><span class="p">,</span> <span class="n">old_recipe</span><span class="p">[</span><span class="s2">"packages"</span><span class="p">],</span> <span class="n">new_recipe</span><span class="p">[</span><span class="s2">"packages"</span><span class="p">]))</span>
|
||||
<span class="n">diffs</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">diff_items</span><span class="p">(</span><span class="s2">"Group"</span><span class="p">,</span> <span class="n">old_recipe</span><span class="p">[</span><span class="s2">"groups"</span><span class="p">],</span> <span class="n">new_recipe</span><span class="p">[</span><span class="s2">"groups"</span><span class="p">]))</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">diffs</span></div>
|
||||
</pre></div>
|
||||
@ -1090,7 +1111,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.api.server — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.api.server — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -222,14 +222,20 @@
|
||||
<span class="sd"> "db_supported": true,</span>
|
||||
<span class="sd"> "db_version": "0",</span>
|
||||
<span class="sd"> "schema_version": "0",</span>
|
||||
<span class="sd"> "backend": "lorax-composer"}</span>
|
||||
<span class="sd"> "backend": "lorax-composer",</span>
|
||||
<span class="sd"> "msgs": []}</span>
|
||||
|
||||
<span class="sd"> The 'msgs' field can be a list of strings describing startup problems or status that</span>
|
||||
<span class="sd"> should be displayed to the user. eg. if the compose templates are not depsolving properly</span>
|
||||
<span class="sd"> the errors will be in 'msgs'.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">backend</span><span class="o">=</span><span class="s2">"lorax-composer"</span><span class="p">,</span>
|
||||
<span class="n">build</span><span class="o">=</span><span class="n">vernum</span><span class="p">,</span>
|
||||
<span class="n">api</span><span class="o">=</span><span class="s2">"0"</span><span class="p">,</span>
|
||||
<span class="n">db_version</span><span class="o">=</span><span class="s2">"0"</span><span class="p">,</span>
|
||||
<span class="n">schema_version</span><span class="o">=</span><span class="s2">"0"</span><span class="p">,</span>
|
||||
<span class="n">db_supported</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||||
<span class="n">db_supported</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
|
||||
<span class="n">msgs</span><span class="o">=</span><span class="n">server</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"TEMPLATE_ERRORS"</span><span class="p">])</span>
|
||||
|
||||
<span class="n">v0_api</span><span class="p">(</span><span class="n">server</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
@ -266,7 +272,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.api.v0 — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.api.v0 — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -884,14 +884,14 @@
|
||||
<span class="sd"> "id": "45502a6d-06e8-48a5-a215-2b4174b3614b",</span>
|
||||
<span class="sd"> "blueprint": "glusterfs",</span>
|
||||
<span class="sd"> "queue_status": "WAITING",</span>
|
||||
<span class="sd"> "timestamp": 1517362647.4570868,</span>
|
||||
<span class="sd"> "job_created": 1517362647.4570868,</span>
|
||||
<span class="sd"> "version": "0.0.6"</span>
|
||||
<span class="sd"> },</span>
|
||||
<span class="sd"> {</span>
|
||||
<span class="sd"> "id": "6d292bd0-bec7-4825-8d7d-41ef9c3e4b73",</span>
|
||||
<span class="sd"> "blueprint": "kubernetes",</span>
|
||||
<span class="sd"> "queue_status": "WAITING",</span>
|
||||
<span class="sd"> "timestamp": 1517362659.0034983,</span>
|
||||
<span class="sd"> "job_created": 1517362659.0034983,</span>
|
||||
<span class="sd"> "version": "0.0.1"</span>
|
||||
<span class="sd"> }</span>
|
||||
<span class="sd"> ],</span>
|
||||
@ -900,7 +900,8 @@
|
||||
<span class="sd"> "id": "745712b2-96db-44c0-8014-fe925c35e795",</span>
|
||||
<span class="sd"> "blueprint": "glusterfs",</span>
|
||||
<span class="sd"> "queue_status": "RUNNING",</span>
|
||||
<span class="sd"> "timestamp": 1517362633.7965999,</span>
|
||||
<span class="sd"> "job_created": 1517362633.7965999,</span>
|
||||
<span class="sd"> "job_started": 1517362633.8001345,</span>
|
||||
<span class="sd"> "version": "0.0.6"</span>
|
||||
<span class="sd"> }</span>
|
||||
<span class="sd"> ]</span>
|
||||
@ -919,14 +920,18 @@
|
||||
<span class="sd"> "id": "70b84195-9817-4b8a-af92-45e380f39894",</span>
|
||||
<span class="sd"> "blueprint": "glusterfs",</span>
|
||||
<span class="sd"> "queue_status": "FINISHED",</span>
|
||||
<span class="sd"> "timestamp": 1517351003.8210032,</span>
|
||||
<span class="sd"> "job_created": 1517351003.8210032,</span>
|
||||
<span class="sd"> "job_started": 1517351003.8230415,</span>
|
||||
<span class="sd"> "job_finished": 1517359234.1003145,</span>
|
||||
<span class="sd"> "version": "0.0.6"</span>
|
||||
<span class="sd"> },</span>
|
||||
<span class="sd"> {</span>
|
||||
<span class="sd"> "id": "e695affd-397f-4af9-9022-add2636e7459",</span>
|
||||
<span class="sd"> "blueprint": "glusterfs",</span>
|
||||
<span class="sd"> "queue_status": "FINISHED",</span>
|
||||
<span class="sd"> "timestamp": 1517362289.7193348,</span>
|
||||
<span class="sd"> "job_created": 1517362289.7193348,</span>
|
||||
<span class="sd"> "job_started": 1517362289.9751132,</span>
|
||||
<span class="sd"> "job_finished": 1517363500.1234567,</span>
|
||||
<span class="sd"> "version": "0.0.6"</span>
|
||||
<span class="sd"> }</span>
|
||||
<span class="sd"> ]</span>
|
||||
@ -945,7 +950,9 @@
|
||||
<span class="sd"> "id": "8c8435ef-d6bd-4c68-9bf1-a2ef832e6b1a",</span>
|
||||
<span class="sd"> "blueprint": "http-server",</span>
|
||||
<span class="sd"> "queue_status": "FAILED",</span>
|
||||
<span class="sd"> "timestamp": 1517523249.9301329,</span>
|
||||
<span class="sd"> "job_created": 1517523249.9301329,</span>
|
||||
<span class="sd"> "job_started": 1517523249.9314211,</span>
|
||||
<span class="sd"> "job_finished": 1517523255.5623411,</span>
|
||||
<span class="sd"> "version": "0.0.2"</span>
|
||||
<span class="sd"> }</span>
|
||||
<span class="sd"> ]</span>
|
||||
@ -964,14 +971,18 @@
|
||||
<span class="sd"> "id": "8c8435ef-d6bd-4c68-9bf1-a2ef832e6b1a",</span>
|
||||
<span class="sd"> "blueprint": "http-server",</span>
|
||||
<span class="sd"> "queue_status": "FINISHED",</span>
|
||||
<span class="sd"> "timestamp": 1517523644.2384307,</span>
|
||||
<span class="sd"> "job_created": 1517523644.2384307,</span>
|
||||
<span class="sd"> "job_started": 1517523644.2551234,</span>
|
||||
<span class="sd"> "job_finished": 1517523689.9864314,</span>
|
||||
<span class="sd"> "version": "0.0.2"</span>
|
||||
<span class="sd"> },</span>
|
||||
<span class="sd"> {</span>
|
||||
<span class="sd"> "id": "45502a6d-06e8-48a5-a215-2b4174b3614b",</span>
|
||||
<span class="sd"> "blueprint": "glusterfs",</span>
|
||||
<span class="sd"> "queue_status": "FINISHED",</span>
|
||||
<span class="sd"> "timestamp": 1517363442.188399,</span>
|
||||
<span class="sd"> "job_created": 1517363442.188399,</span>
|
||||
<span class="sd"> "job_started": 1517363442.325324,</span>
|
||||
<span class="sd"> "job_finished": 1517363451.653621,</span>
|
||||
<span class="sd"> "version": "0.0.6"</span>
|
||||
<span class="sd"> }</span>
|
||||
<span class="sd"> ]</span>
|
||||
@ -1126,16 +1137,19 @@
|
||||
<span class="kn">import</span> <span class="nn">pytoml</span> <span class="k">as</span> <span class="nn">toml</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">pylorax.sysutils</span> <span class="k">import</span> <span class="n">joinpaths</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.checkparams</span> <span class="k">import</span> <span class="n">checkparams</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.compose</span> <span class="k">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="k">import</span> <span class="n">crossdomain</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.errors</span> <span class="k">import</span> <span class="o">*</span> <span class="c1"># pylint: disable=wildcard-import</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.projects</span> <span class="k">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="k">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="k">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">dnf_repo_to_file_repo</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.queue</span> <span class="k">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="k">import</span> <span class="n">uuid_tar</span><span class="p">,</span> <span class="n">uuid_image</span><span class="p">,</span> <span class="n">uuid_cancel</span><span class="p">,</span> <span class="n">uuid_log</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.recipes</span> <span class="k">import</span> <span class="n">list_branch_files</span><span class="p">,</span> <span class="n">read_recipe_commit</span><span class="p">,</span> <span class="n">recipe_filename</span><span class="p">,</span> <span class="n">list_commits</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.recipes</span> <span class="k">import</span> <span class="n">RecipeError</span><span class="p">,</span> <span class="n">list_branch_files</span><span class="p">,</span> <span class="n">read_recipe_commit</span><span class="p">,</span> <span class="n">recipe_filename</span><span class="p">,</span> <span class="n">list_commits</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.recipes</span> <span class="k">import</span> <span class="n">recipe_from_dict</span><span class="p">,</span> <span class="n">recipe_from_toml</span><span class="p">,</span> <span class="n">commit_recipe</span><span class="p">,</span> <span class="n">delete_recipe</span><span class="p">,</span> <span class="n">revert_recipe</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.recipes</span> <span class="k">import</span> <span class="n">tag_recipe_commit</span><span class="p">,</span> <span class="n">recipe_diff</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.regexes</span> <span class="k">import</span> <span class="n">VALID_API_STRING</span>
|
||||
<span class="kn">from</span> <span class="nn">pylorax.api.workspace</span> <span class="k">import</span> <span class="n">workspace_read</span><span class="p">,</span> <span class="n">workspace_write</span><span class="p">,</span> <span class="n">workspace_delete</span>
|
||||
|
||||
<span class="c1"># The API functions don't actually get called by any code here</span>
|
||||
@ -1154,6 +1168,15 @@
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="n">iterable</span><span class="p">[</span><span class="n">offset</span><span class="p">:][:</span><span class="n">limit</span><span class="p">]</span></div>
|
||||
|
||||
<div class="viewcode-block" id="blueprint_exists"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.v0.blueprint_exists">[docs]</a><span class="k">def</span> <span class="nf">blueprint_exists</span><span class="p">(</span><span class="n">api</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">):</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
|
||||
<span class="n">read_recipe_commit</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">)</span>
|
||||
|
||||
<span class="k">return</span> <span class="kc">True</span>
|
||||
<span class="k">except</span> <span class="n">RecipeError</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="kc">False</span></div>
|
||||
|
||||
<div class="viewcode-block" id="v0_api"><a class="viewcode-back" href="../../../pylorax.api.html#pylorax.api.v0.v0_api">[docs]</a><span class="k">def</span> <span class="nf">v0_api</span><span class="p">(</span><span class="n">api</span><span class="p">):</span>
|
||||
<span class="c1"># Note that Sphinx will not generate documentations for any of these.</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/list"</span><span class="p">)</span>
|
||||
@ -1161,22 +1184,36 @@
|
||||
<span class="k">def</span> <span class="nf">v0_blueprints_list</span><span class="p">():</span>
|
||||
<span class="sd">"""List the available blueprints on a branch."""</span>
|
||||
<span class="n">branch</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="s2">"branch"</span><span class="p">,</span> <span class="s2">"master"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">branch</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in branch argument"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">limit</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</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="s2">"limit"</span><span class="p">,</span> <span class="s2">"20"</span><span class="p">))</span>
|
||||
<span class="n">offset</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</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="s2">"offset"</span><span class="p">,</span> <span class="s2">"0"</span><span class="p">))</span>
|
||||
<span class="k">except</span> <span class="ne">ValueError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BAD_LIMIT_OR_OFFSET</span><span class="p">,</span> <span class="s2">"msg"</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">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
|
||||
<span class="n">blueprints</span> <span class="o">=</span> <span class="n">take_limits</span><span class="p">([</span><span class="n">f</span><span class="p">[:</span><span class="o">-</span><span class="mi">5</span><span class="p">]</span> <span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="n">list_branch_files</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">)],</span> <span class="n">offset</span><span class="p">,</span> <span class="n">limit</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">blueprints</span><span class="o">=</span><span class="n">blueprints</span><span class="p">,</span> <span class="n">limit</span><span class="o">=</span><span class="n">limit</span><span class="p">,</span> <span class="n">offset</span><span class="o">=</span><span class="n">offset</span><span class="p">,</span> <span class="n">total</span><span class="o">=</span><span class="nb">len</span><span class="p">(</span><span class="n">blueprints</span><span class="p">))</span>
|
||||
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/info"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'blueprint_names'</span><span class="p">:</span> <span class="s2">""</span><span class="p">})</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/info/<blueprint_names>"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"blueprint_names"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no blueprint names given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_blueprints_info</span><span class="p">(</span><span class="n">blueprint_names</span><span class="p">):</span>
|
||||
<span class="sd">"""Return the contents of the blueprint, or a list of blueprints"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">blueprint_names</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">branch</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="s2">"branch"</span><span class="p">,</span> <span class="s2">"master"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">branch</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in branch argument"</span><span class="p">}]),</span> <span class="mi">400</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="s2">"format"</span><span class="p">,</span> <span class="s2">"json"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">out_fmt</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in format argument"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">blueprints</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">changes</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">errors</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
@ -1202,7 +1239,7 @@
|
||||
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">ws_blueprint</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">git_blueprint</span><span class="p">:</span>
|
||||
<span class="c1"># Neither blueprint, return an error</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"</span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="s2">", "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">exceptions</span><span class="p">)))</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_BLUEPRINT</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="s2">", "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">exceptions</span><span class="p">))})</span>
|
||||
<span class="k">elif</span> <span class="n">ws_blueprint</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">git_blueprint</span><span class="p">:</span>
|
||||
<span class="c1"># No git blueprint, return the workspace blueprint</span>
|
||||
<span class="n">changes</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"name"</span><span class="p">:</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="s2">"changed"</span><span class="p">:</span><span class="kc">True</span><span class="p">})</span>
|
||||
@ -1219,7 +1256,6 @@
|
||||
<span class="c1"># Sort all the results by case-insensitive blueprint name</span>
|
||||
<span class="n">changes</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">changes</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">c</span><span class="p">:</span> <span class="n">c</span><span class="p">[</span><span class="s2">"name"</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
|
||||
<span class="n">blueprints</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">blueprints</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">r</span><span class="p">:</span> <span class="n">r</span><span class="p">[</span><span class="s2">"name"</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
|
||||
<span class="n">errors</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">errors</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">e</span><span class="p">:</span> <span class="n">e</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">out_fmt</span> <span class="o">==</span> <span class="s2">"toml"</span><span class="p">:</span>
|
||||
<span class="c1"># With TOML output we just want to dump the raw blueprint, skipping the rest.</span>
|
||||
@ -1227,32 +1263,44 @@
|
||||
<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">changes</span><span class="o">=</span><span class="n">changes</span><span class="p">,</span> <span class="n">blueprints</span><span class="o">=</span><span class="n">blueprints</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</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/changes"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'blueprint_names'</span><span class="p">:</span> <span class="s2">""</span><span class="p">})</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/changes/<blueprint_names>"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"blueprint_names"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no blueprint names given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_blueprints_changes</span><span class="p">(</span><span class="n">blueprint_names</span><span class="p">):</span>
|
||||
<span class="sd">"""Return the changes to a blueprint or list of blueprints"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">blueprint_names</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">branch</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="s2">"branch"</span><span class="p">,</span> <span class="s2">"master"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">branch</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in branch argument"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">limit</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</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="s2">"limit"</span><span class="p">,</span> <span class="s2">"20"</span><span class="p">))</span>
|
||||
<span class="n">offset</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</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="s2">"offset"</span><span class="p">,</span> <span class="s2">"0"</span><span class="p">))</span>
|
||||
<span class="k">except</span> <span class="ne">ValueError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BAD_LIMIT_OR_OFFSET</span><span class="p">,</span> <span class="s2">"msg"</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="n">blueprints</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">errors</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">blueprint_name</span> <span class="ow">in</span> <span class="p">[</span><span class="n">n</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">blueprint_names</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">","</span><span class="p">)]:</span>
|
||||
<span class="n">filename</span> <span class="o">=</span> <span class="n">recipe_filename</span><span class="p">(</span><span class="n">blueprint_name</span><span class="p">)</span>
|
||||
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">blueprint_exists</span><span class="p">(</span><span class="n">api</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">):</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_BLUEPRINT</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Unknown blueprint name: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">blueprint_name</span><span class="p">})</span>
|
||||
<span class="k">continue</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
|
||||
<span class="n">commits</span> <span class="o">=</span> <span class="n">take_limits</span><span class="p">(</span><span class="n">list_commits</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">filename</span><span class="p">),</span> <span class="n">offset</span><span class="p">,</span> <span class="n">limit</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"</span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)))</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BLUEPRINTS_ERROR</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))})</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"(v0_blueprints_changes) </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">blueprints</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"name"</span><span class="p">:</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="s2">"changes"</span><span class="p">:</span><span class="n">commits</span><span class="p">,</span> <span class="s2">"total"</span><span class="p">:</span><span class="nb">len</span><span class="p">(</span><span class="n">commits</span><span class="p">)})</span>
|
||||
|
||||
<span class="n">blueprints</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">blueprints</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">r</span><span class="p">:</span> <span class="n">r</span><span class="p">[</span><span class="s2">"name"</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
|
||||
<span class="n">errors</span> <span class="o">=</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">errors</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">e</span><span class="p">:</span> <span class="n">e</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">blueprints</span><span class="o">=</span><span class="n">blueprints</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="n">offset</span><span class="o">=</span><span class="n">offset</span><span class="p">,</span> <span class="n">limit</span><span class="o">=</span><span class="n">limit</span><span class="p">)</span>
|
||||
|
||||
@ -1261,12 +1309,18 @@
|
||||
<span class="k">def</span> <span class="nf">v0_blueprints_new</span><span class="p">():</span>
|
||||
<span class="sd">"""Commit a new blueprint"""</span>
|
||||
<span class="n">branch</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="s2">"branch"</span><span class="p">,</span> <span class="s2">"master"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">branch</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in branch argument"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</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="s1">'Content-Type'</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"text/x-toml"</span><span class="p">:</span>
|
||||
<span class="n">blueprint</span> <span class="o">=</span> <span class="n">recipe_from_toml</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">blueprint</span> <span class="o">=</span> <span class="n">recipe_from_dict</span><span class="p">(</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="kc">False</span><span class="p">))</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">blueprint</span><span class="p">[</span><span class="s2">"name"</span><span class="p">])</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
|
||||
<span class="n">commit_recipe</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint</span><span class="p">)</span>
|
||||
|
||||
@ -1275,21 +1329,29 @@
|
||||
<span class="n">workspace_write</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"(v0_blueprints_new) </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BLUEPRINTS_ERROR</span><span class="p">,</span> <span class="s2">"msg"</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">else</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||||
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/delete"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'blueprint_name'</span><span class="p">:</span> <span class="s2">""</span><span class="p">},</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s2">"DELETE"</span><span class="p">])</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/delete/<blueprint_name>"</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s2">"DELETE"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"blueprint_name"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no blueprint name given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_blueprints_delete</span><span class="p">(</span><span class="n">blueprint_name</span><span class="p">):</span>
|
||||
<span class="sd">"""Delete a blueprint from git"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">blueprint_name</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">branch</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="s2">"branch"</span><span class="p">,</span> <span class="s2">"master"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">branch</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in branch argument"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
|
||||
<span class="n">delete_recipe</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"(v0_blueprints_delete) </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BLUEPRINTS_ERROR</span><span class="p">,</span> <span class="s2">"msg"</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">else</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||||
|
||||
@ -1298,39 +1360,63 @@
|
||||
<span class="k">def</span> <span class="nf">v0_blueprints_workspace</span><span class="p">():</span>
|
||||
<span class="sd">"""Write a blueprint to the workspace"""</span>
|
||||
<span class="n">branch</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="s2">"branch"</span><span class="p">,</span> <span class="s2">"master"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">branch</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in branch argument"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</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="s1">'Content-Type'</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"text/x-toml"</span><span class="p">:</span>
|
||||
<span class="n">blueprint</span> <span class="o">=</span> <span class="n">recipe_from_toml</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">blueprint</span> <span class="o">=</span> <span class="n">recipe_from_dict</span><span class="p">(</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="kc">False</span><span class="p">))</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">blueprint</span><span class="p">[</span><span class="s2">"name"</span><span class="p">])</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
|
||||
<span class="n">workspace_write</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"(v0_blueprints_workspace) </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BLUEPRINTS_ERROR</span><span class="p">,</span> <span class="s2">"msg"</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">else</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||||
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/workspace"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'blueprint_name'</span><span class="p">:</span> <span class="s2">""</span><span class="p">},</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s2">"DELETE"</span><span class="p">])</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/workspace/<blueprint_name>"</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s2">"DELETE"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"blueprint_name"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no blueprint name given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_blueprints_delete_workspace</span><span class="p">(</span><span class="n">blueprint_name</span><span class="p">):</span>
|
||||
<span class="sd">"""Delete a blueprint from the workspace"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">blueprint_name</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">branch</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="s2">"branch"</span><span class="p">,</span> <span class="s2">"master"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">branch</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in branch argument"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
|
||||
<span class="n">workspace_delete</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"(v0_blueprints_delete_workspace) </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">error</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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BLUEPRINTS_ERROR</span><span class="p">,</span> <span class="s2">"msg"</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">else</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||||
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/undo"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'blueprint_name'</span><span class="p">:</span> <span class="s2">""</span><span class="p">,</span> <span class="s1">'commit'</span><span class="p">:</span> <span class="s2">""</span><span class="p">},</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s2">"POST"</span><span class="p">])</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/undo/<blueprint_name>"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'commit'</span><span class="p">:</span> <span class="s2">""</span><span class="p">},</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s2">"POST"</span><span class="p">])</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/undo/<blueprint_name>/<commit>"</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s2">"POST"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"blueprint_name"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no blueprint name given"</span><span class="p">),</span>
|
||||
<span class="p">(</span><span class="s2">"commit"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no commit ID given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_blueprints_undo</span><span class="p">(</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="n">commit</span><span class="p">):</span>
|
||||
<span class="sd">"""Undo changes to a blueprint by reverting to a previous commit."""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">blueprint_name</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">branch</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="s2">"branch"</span><span class="p">,</span> <span class="s2">"master"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">branch</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in branch argument"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
|
||||
<span class="n">revert_recipe</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">,</span> <span class="n">commit</span><span class="p">)</span>
|
||||
@ -1340,29 +1426,50 @@
|
||||
<span class="n">workspace_write</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"(v0_blueprints_undo) </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_COMMIT</span><span class="p">,</span> <span class="s2">"msg"</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">else</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||||
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/tag"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'blueprint_name'</span><span class="p">:</span> <span class="s2">""</span><span class="p">},</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s2">"POST"</span><span class="p">])</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/tag/<blueprint_name>"</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s2">"POST"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"blueprint_name"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no blueprint name given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_blueprints_tag</span><span class="p">(</span><span class="n">blueprint_name</span><span class="p">):</span>
|
||||
<span class="sd">"""Tag a blueprint's latest blueprint commit as a 'revision'"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">blueprint_name</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">branch</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="s2">"branch"</span><span class="p">,</span> <span class="s2">"master"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">branch</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in branch argument"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
|
||||
<span class="n">tag_recipe_commit</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"(v0_blueprints_tag) </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BLUEPRINTS_ERROR</span><span class="p">,</span> <span class="s2">"msg"</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">else</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||||
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/diff"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'blueprint_name'</span><span class="p">:</span> <span class="s2">""</span><span class="p">,</span> <span class="s1">'from_commit'</span><span class="p">:</span> <span class="s2">""</span><span class="p">,</span> <span class="s1">'to_commit'</span><span class="p">:</span> <span class="s2">""</span><span class="p">})</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/diff/<blueprint_name>"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'from_commit'</span><span class="p">:</span> <span class="s2">""</span><span class="p">,</span> <span class="s1">'to_commit'</span><span class="p">:</span> <span class="s2">""</span><span class="p">})</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/diff/<blueprint_name>/<from_commit>"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'to_commit'</span><span class="p">:</span> <span class="s2">""</span><span class="p">})</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/diff/<blueprint_name>/<from_commit>/<to_commit>"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"blueprint_name"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no blueprint name given"</span><span class="p">),</span>
|
||||
<span class="p">(</span><span class="s2">"from_commit"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no from commit ID given"</span><span class="p">),</span>
|
||||
<span class="p">(</span><span class="s2">"to_commit"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no to commit ID given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_blueprints_diff</span><span class="p">(</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="n">from_commit</span><span class="p">,</span> <span class="n">to_commit</span><span class="p">):</span>
|
||||
<span class="sd">"""Return the differences between two commits of a blueprint"""</span>
|
||||
<span class="k">for</span> <span class="n">s</span> <span class="ow">in</span> <span class="p">[</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="n">from_commit</span><span class="p">,</span> <span class="n">to_commit</span><span class="p">]:</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">s</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">branch</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="s2">"branch"</span><span class="p">,</span> <span class="s2">"master"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">branch</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in branch argument"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">from_commit</span> <span class="o">==</span> <span class="s2">"NEWEST"</span><span class="p">:</span>
|
||||
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
|
||||
@ -1372,7 +1479,7 @@
|
||||
<span class="n">old_blueprint</span> <span class="o">=</span> <span class="n">read_recipe_commit</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">,</span> <span class="n">from_commit</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"(v0_blueprints_diff) </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_COMMIT</span><span class="p">,</span> <span class="s2">"msg"</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">try</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">to_commit</span> <span class="o">==</span> <span class="s2">"WORKSPACE"</span><span class="p">:</span>
|
||||
@ -1390,17 +1497,28 @@
|
||||
<span class="n">new_blueprint</span> <span class="o">=</span> <span class="n">read_recipe_commit</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">,</span> <span class="n">to_commit</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"(v0_blueprints_diff) </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_COMMIT</span><span class="p">,</span> <span class="s2">"msg"</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="n">diff</span> <span class="o">=</span> <span class="n">recipe_diff</span><span class="p">(</span><span class="n">old_blueprint</span><span class="p">,</span> <span class="n">new_blueprint</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">diff</span><span class="o">=</span><span class="n">diff</span><span class="p">)</span>
|
||||
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/freeze"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'blueprint_names'</span><span class="p">:</span> <span class="s2">""</span><span class="p">})</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/freeze/<blueprint_names>"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"blueprint_names"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no blueprint names given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_blueprints_freeze</span><span class="p">(</span><span class="n">blueprint_names</span><span class="p">):</span>
|
||||
<span class="sd">"""Return the blueprint with the exact modules and packages selected by depsolve"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">blueprint_names</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">branch</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="s2">"branch"</span><span class="p">,</span> <span class="s2">"master"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">branch</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in branch argument"</span><span class="p">}]),</span> <span class="mi">400</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="s2">"format"</span><span class="p">,</span> <span class="s2">"json"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">out_fmt</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in format argument"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">blueprints</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">errors</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">blueprint_name</span> <span class="ow">in</span> <span class="p">[</span><span class="n">n</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">blueprint_names</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">","</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>
|
||||
@ -1419,12 +1537,12 @@
|
||||
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
|
||||
<span class="n">blueprint</span> <span class="o">=</span> <span class="n">read_recipe_commit</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"</span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)))</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BLUEPRINTS_ERROR</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))})</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"(v0_blueprints_freeze) </span><span class="si">%s</span><span class="s2">"</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="c1"># No blueprint found, skip it.</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">blueprint</span><span class="p">:</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"</span><span class="si">%s</span><span class="s2">: blueprint_not_found"</span> <span class="o">%</span> <span class="p">(</span><span class="n">blueprint_name</span><span class="p">))</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_BLUEPRINT</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2">: blueprint_not_found"</span> <span class="o">%</span> <span class="n">blueprint_name</span><span class="p">})</span>
|
||||
<span class="k">continue</span>
|
||||
|
||||
<span class="c1"># Combine modules and packages and depsolve the list</span>
|
||||
@ -1435,9 +1553,9 @@
|
||||
<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="s2">"DNFLOCK"</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="s2">"DNFLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">dbo</span><span class="p">,</span> <span class="n">projects</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="s2">"DNFLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">dbo</span><span class="p">,</span> <span class="n">projects</span><span class="p">,</span> <span class="n">blueprint</span><span class="o">.</span><span class="n">group_names</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">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"</span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)))</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BLUEPRINTS_ERROR</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))})</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"(v0_blueprints_freeze) </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
|
||||
<span class="n">blueprints</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"blueprint"</span><span class="p">:</span> <span class="n">blueprint</span><span class="o">.</span><span class="n">freeze</span><span class="p">(</span><span class="n">deps</span><span class="p">)})</span>
|
||||
@ -1448,11 +1566,19 @@
|
||||
<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">blueprints</span><span class="o">=</span><span class="n">blueprints</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</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/depsolve"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'blueprint_names'</span><span class="p">:</span> <span class="s2">""</span><span class="p">})</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/blueprints/depsolve/<blueprint_names>"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"blueprint_names"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no blueprint names given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_blueprints_depsolve</span><span class="p">(</span><span class="n">blueprint_names</span><span class="p">):</span>
|
||||
<span class="sd">"""Return the dependencies for a blueprint"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">blueprint_names</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">branch</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="s2">"branch"</span><span class="p">,</span> <span class="s2">"master"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">branch</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in branch argument"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">blueprints</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">errors</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">blueprint_name</span> <span class="ow">in</span> <span class="p">[</span><span class="n">n</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">blueprint_names</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">","</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>
|
||||
@ -1471,12 +1597,12 @@
|
||||
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
|
||||
<span class="n">blueprint</span> <span class="o">=</span> <span class="n">read_recipe_commit</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">repo</span><span class="p">,</span> <span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"</span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)))</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BLUEPRINTS_ERROR</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))})</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"(v0_blueprints_depsolve) </span><span class="si">%s</span><span class="s2">"</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="c1"># No blueprint found, skip it.</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">blueprint</span><span class="p">:</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"</span><span class="si">%s</span><span class="s2">: blueprint not found"</span> <span class="o">%</span> <span class="n">blueprint_name</span><span class="p">)</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_BLUEPRINT</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2">: blueprint not found"</span> <span class="o">%</span> <span class="n">blueprint_name</span><span class="p">})</span>
|
||||
<span class="k">continue</span>
|
||||
|
||||
<span class="c1"># Combine modules and packages and depsolve the list</span>
|
||||
@ -1487,9 +1613,9 @@
|
||||
<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="s2">"DNFLOCK"</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="s2">"DNFLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">dbo</span><span class="p">,</span> <span class="n">projects</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="s2">"DNFLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">dbo</span><span class="p">,</span> <span class="n">projects</span><span class="p">,</span> <span class="n">blueprint</span><span class="o">.</span><span class="n">group_names</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">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"</span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)))</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BLUEPRINTS_ERROR</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">blueprint_name</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))})</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"(v0_blueprints_depsolve) </span><span class="si">%s</span><span class="s2">"</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="c1"># Get the NEVRA's of the modules and projects, add as "modules"</span>
|
||||
@ -1511,41 +1637,61 @@
|
||||
<span class="n">limit</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</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="s2">"limit"</span><span class="p">,</span> <span class="s2">"20"</span><span class="p">))</span>
|
||||
<span class="n">offset</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</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="s2">"offset"</span><span class="p">,</span> <span class="s2">"0"</span><span class="p">))</span>
|
||||
<span class="k">except</span> <span class="ne">ValueError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BAD_LIMIT_OR_OFFSET</span><span class="p">,</span> <span class="s2">"msg"</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">try</span><span class="p">:</span>
|
||||
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"DNFLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
|
||||
<span class="n">available</span> <span class="o">=</span> <span class="n">projects_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="s2">"DNFLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">dbo</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="s2">"(v0_projects_list) </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">PROJECTS_ERROR</span><span class="p">,</span> <span class="s2">"msg"</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="n">projects</span> <span class="o">=</span> <span class="n">take_limits</span><span class="p">(</span><span class="n">available</span><span class="p">,</span> <span class="n">offset</span><span class="p">,</span> <span class="n">limit</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">projects</span><span class="o">=</span><span class="n">projects</span><span class="p">,</span> <span class="n">offset</span><span class="o">=</span><span class="n">offset</span><span class="p">,</span> <span class="n">limit</span><span class="o">=</span><span class="n">limit</span><span class="p">,</span> <span class="n">total</span><span class="o">=</span><span class="nb">len</span><span class="p">(</span><span class="n">available</span><span class="p">))</span>
|
||||
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/projects/info"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'project_names'</span><span class="p">:</span> <span class="s2">""</span><span class="p">})</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/projects/info/<project_names>"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"project_names"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no project names given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_projects_info</span><span class="p">(</span><span class="n">project_names</span><span class="p">):</span>
|
||||
<span class="sd">"""Return detailed information about the listed projects"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">project_names</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"DNFLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
|
||||
<span class="n">projects</span> <span class="o">=</span> <span class="n">projects_info</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"DNFLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">dbo</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="s2">","</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="s2">"(v0_projects_info) </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">PROJECTS_ERROR</span><span class="p">,</span> <span class="s2">"msg"</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">if</span> <span class="ow">not</span> <span class="n">projects</span><span class="p">:</span>
|
||||
<span class="n">msg</span> <span class="o">=</span> <span class="s2">"one of the requested projects does not exist: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">project_names</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"(v0_projects_info) </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">msg</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_PROJECT</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="n">msg</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">projects</span><span class="p">)</span>
|
||||
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/projects/depsolve"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'project_names'</span><span class="p">:</span> <span class="s2">""</span><span class="p">})</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/projects/depsolve/<project_names>"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"project_names"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no project names given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_projects_depsolve</span><span class="p">(</span><span class="n">project_names</span><span class="p">):</span>
|
||||
<span class="sd">"""Return detailed information about the listed projects"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">project_names</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"DNFLOCK"</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="s2">"DNFLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">dbo</span><span class="p">,</span> <span class="p">[(</span><span class="n">n</span><span class="p">,</span> <span class="s2">"*"</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="s2">","</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="s2">"DNFLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">dbo</span><span class="p">,</span> <span class="p">[(</span><span class="n">n</span><span class="p">,</span> <span class="s2">"*"</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="s2">","</span><span class="p">)],</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="s2">"(v0_projects_depsolve) </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">PROJECTS_ERROR</span><span class="p">,</span> <span class="s2">"msg"</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">if</span> <span class="ow">not</span> <span class="n">deps</span><span class="p">:</span>
|
||||
<span class="n">msg</span> <span class="o">=</span> <span class="s2">"one of the requested projects does not exist: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">project_names</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"(v0_projects_depsolve) </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">msg</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_PROJECT</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="n">msg</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>
|
||||
|
||||
@ -1558,11 +1704,18 @@
|
||||
<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</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/projects/source/info"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'source_names'</span><span class="p">:</span> <span class="s2">""</span><span class="p">})</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/projects/source/info/<source_names>"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"source_names"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no source names given"</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">"""Return detailed info about the list of sources"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">source_names</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</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="s2">"format"</span><span class="p">,</span> <span class="s2">"json"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">out_fmt</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in format argument"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="c1"># 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="s2">"*"</span><span class="p">:</span>
|
||||
@ -1576,7 +1729,7 @@
|
||||
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"DNFLOCK"</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="s2">"DNFLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">dbo</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">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="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid source"</span> <span class="o">%</span> <span class="n">source</span><span class="p">)</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_SOURCE</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid source"</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>
|
||||
|
||||
@ -1600,7 +1753,7 @@
|
||||
|
||||
<span class="n">system_sources</span> <span class="o">=</span> <span class="n">get_repo_sources</span><span class="p">(</span><span class="s2">"/etc/yum.repos.d/*.repo"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">source</span><span class="p">[</span><span class="s2">"name"</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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="s2">"</span><span class="si">%s</span><span class="s2"> is a system source, it cannot be deleted."</span> <span class="o">%</span> <span class="n">source</span><span class="p">[</span><span class="s2">"name"</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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">SYSTEM_SOURCE</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2"> is a system source, it cannot be changed."</span> <span class="o">%</span> <span class="n">source</span><span class="p">[</span><span class="s2">"name"</span><span class="p">]}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="c1"># Remove it from the RepoDict (NOTE that this isn't explicitly supported by the DNF API)</span>
|
||||
@ -1645,17 +1798,22 @@
|
||||
<span class="n">dbo</span><span class="o">.</span><span class="n">fill_sack</span><span class="p">(</span><span class="n">load_system_repo</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
|
||||
<span class="n">dbo</span><span class="o">.</span><span class="n">read_comps</span><span class="p">()</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">PROJECTS_ERROR</span><span class="p">,</span> <span class="s2">"msg"</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="kc">True</span><span class="p">)</span>
|
||||
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/projects/source/delete"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'source_name'</span><span class="p">:</span> <span class="s2">""</span><span class="p">},</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s2">"DELETE"</span><span class="p">])</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/projects/source/delete/<source_name>"</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s2">"DELETE"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"source_name"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no source name given"</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">"""Delete the named source and return a status response"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">source_name</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">system_sources</span> <span class="o">=</span> <span class="n">get_repo_sources</span><span class="p">(</span><span class="s2">"/etc/yum.repos.d/*.repo"</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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="s2">"</span><span class="si">%s</span><span class="s2"> is a system source, it cannot be deleted."</span> <span class="o">%</span> <span class="n">source_name</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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">SYSTEM_SOURCE</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2"> is a system source, it cannot be deleted."</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="s2">"COMPOSER_CFG"</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"composer"</span><span class="p">,</span> <span class="s2">"repo_dir"</span><span class="p">)</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="c1"># Remove the file entry for the source</span>
|
||||
@ -1671,7 +1829,7 @@
|
||||
|
||||
<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="s2">"(v0_projects_source_delete) </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_SOURCE</span><span class="p">,</span> <span class="s2">"msg"</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="kc">True</span><span class="p">)</span>
|
||||
|
||||
@ -1680,11 +1838,14 @@
|
||||
<span class="nd">@crossdomain</span><span class="p">(</span><span class="n">origin</span><span class="o">=</span><span class="s2">"*"</span><span class="p">)</span>
|
||||
<span class="k">def</span> <span class="nf">v0_modules_list</span><span class="p">(</span><span class="n">module_names</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="sd">"""List available modules, filtering by module_names"""</span>
|
||||
<span class="k">if</span> <span class="n">module_names</span> <span class="ow">and</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">module_names</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">limit</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</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="s2">"limit"</span><span class="p">,</span> <span class="s2">"20"</span><span class="p">))</span>
|
||||
<span class="n">offset</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</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="s2">"offset"</span><span class="p">,</span> <span class="s2">"0"</span><span class="p">))</span>
|
||||
<span class="k">except</span> <span class="ne">ValueError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BAD_LIMIT_OR_OFFSET</span><span class="p">,</span> <span class="s2">"msg"</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">if</span> <span class="n">module_names</span><span class="p">:</span>
|
||||
<span class="n">module_names</span> <span class="o">=</span> <span class="n">module_names</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">","</span><span class="p">)</span>
|
||||
@ -1694,21 +1855,35 @@
|
||||
<span class="n">available</span> <span class="o">=</span> <span class="n">modules_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="s2">"DNFLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">dbo</span><span class="p">,</span> <span class="n">module_names</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="s2">"(v0_modules_list) </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">MODULES_ERROR</span><span class="p">,</span> <span class="s2">"msg"</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">if</span> <span class="n">module_names</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">available</span><span class="p">:</span>
|
||||
<span class="n">msg</span> <span class="o">=</span> <span class="s2">"one of the requested modules does not exist: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">module_names</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"(v0_modules_list) </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">msg</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_MODULE</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="n">msg</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">modules</span> <span class="o">=</span> <span class="n">take_limits</span><span class="p">(</span><span class="n">available</span><span class="p">,</span> <span class="n">offset</span><span class="p">,</span> <span class="n">limit</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">modules</span><span class="o">=</span><span class="n">modules</span><span class="p">,</span> <span class="n">offset</span><span class="o">=</span><span class="n">offset</span><span class="p">,</span> <span class="n">limit</span><span class="o">=</span><span class="n">limit</span><span class="p">,</span> <span class="n">total</span><span class="o">=</span><span class="nb">len</span><span class="p">(</span><span class="n">available</span><span class="p">))</span>
|
||||
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/modules/info"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'module_names'</span><span class="p">:</span> <span class="s2">""</span><span class="p">})</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/modules/info/<module_names>"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"module_names"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no module names given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_modules_info</span><span class="p">(</span><span class="n">module_names</span><span class="p">):</span>
|
||||
<span class="sd">"""Return detailed information about the listed modules"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">module_names</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="k">with</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"DNFLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">lock</span><span class="p">:</span>
|
||||
<span class="n">modules</span> <span class="o">=</span> <span class="n">modules_info</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"DNFLOCK"</span><span class="p">]</span><span class="o">.</span><span class="n">dbo</span><span class="p">,</span> <span class="n">module_names</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">","</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="s2">"(v0_modules_info) </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">MODULES_ERROR</span><span class="p">,</span> <span class="s2">"msg"</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">if</span> <span class="ow">not</span> <span class="n">modules</span><span class="p">:</span>
|
||||
<span class="n">msg</span> <span class="o">=</span> <span class="s2">"one of the requested modules does not exist: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="n">module_names</span>
|
||||
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">"(v0_modules_info) </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">msg</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_MODULE</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="n">msg</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">modules</span><span class="o">=</span><span class="n">modules</span><span class="p">)</span>
|
||||
|
||||
@ -1733,10 +1908,10 @@
|
||||
|
||||
<span class="n">errors</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">compose</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="s2">"Missing POST body"</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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">MISSING_POST</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Missing POST body"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="k">if</span> <span class="s2">"blueprint_name"</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">compose</span><span class="p">:</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"No 'blueprint_name' in the JSON request"</span><span class="p">)</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_BLUEPRINT</span><span class="p">,</span><span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"No 'blueprint_name' in the JSON request"</span><span class="p">})</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">blueprint_name</span> <span class="o">=</span> <span class="n">compose</span><span class="p">[</span><span class="s2">"blueprint_name"</span><span class="p">]</span>
|
||||
|
||||
@ -1746,10 +1921,13 @@
|
||||
<span class="n">branch</span> <span class="o">=</span> <span class="n">compose</span><span class="p">[</span><span class="s2">"branch"</span><span class="p">]</span>
|
||||
|
||||
<span class="k">if</span> <span class="s2">"compose_type"</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">compose</span><span class="p">:</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"No 'compose_type' in the JSON request"</span><span class="p">)</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BAD_COMPOSE_TYPE</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"No 'compose_type' in the JSON request"</span><span class="p">})</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">compose_type</span> <span class="o">=</span> <span class="n">compose</span><span class="p">[</span><span class="s2">"compose_type"</span><span class="p">]</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">blueprint_name</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">})</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">errors</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="n">errors</span><span class="p">),</span> <span class="mi">400</span>
|
||||
|
||||
@ -1757,7 +1935,10 @@
|
||||
<span class="n">build_id</span> <span class="o">=</span> <span class="n">start_build</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"COMPOSER_CFG"</span><span class="p">],</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"DNFLOCK"</span><span class="p">],</span> <span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"GITLOCK"</span><span class="p">],</span>
|
||||
<span class="n">branch</span><span class="p">,</span> <span class="n">blueprint_name</span><span class="p">,</span> <span class="n">compose_type</span><span class="p">,</span> <span class="n">test_mode</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">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)]),</span> <span class="mi">400</span>
|
||||
<span class="k">if</span> <span class="s2">"Invalid compose type"</span> <span class="ow">in</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">):</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BAD_COMPOSE_TYPE</span><span class="p">,</span> <span class="s2">"msg"</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">else</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BUILD_FAILED</span><span class="p">,</span> <span class="s2">"msg"</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="kc">True</span><span class="p">,</span> <span class="n">build_id</span><span class="o">=</span><span class="n">build_id</span><span class="p">)</span>
|
||||
|
||||
@ -1789,152 +1970,203 @@
|
||||
<span class="sd">"""Return the list of failed composes"""</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">failed</span><span class="o">=</span><span class="n">build_status</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"COMPOSER_CFG"</span><span class="p">],</span> <span class="s2">"FAILED"</span><span class="p">))</span>
|
||||
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/compose/status"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'uuids'</span><span class="p">:</span> <span class="s2">""</span><span class="p">})</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/compose/status/<uuids>"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"uuids"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no UUIDs given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_compose_status</span><span class="p">(</span><span class="n">uuids</span><span class="p">):</span>
|
||||
<span class="sd">"""Return the status of the listed uuids"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">uuids</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">results</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">errors</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">uuid</span> <span class="ow">in</span> <span class="p">[</span><span class="n">n</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">uuids</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">","</span><span class="p">)]:</span>
|
||||
<span class="n">details</span> <span class="o">=</span> <span class="n">uuid_status</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"COMPOSER_CFG"</span><span class="p">],</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">details</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="n">results</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">details</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_UUID</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid build uuid"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">})</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">uuids</span><span class="o">=</span><span class="n">results</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">uuids</span><span class="o">=</span><span class="n">results</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</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/compose/cancel"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'uuid'</span><span class="p">:</span> <span class="s2">""</span><span class="p">},</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s2">"DELETE"</span><span class="p">])</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/compose/cancel/<uuid>"</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s2">"DELETE"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"uuid"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no UUID given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_compose_cancel</span><span class="p">(</span><span class="n">uuid</span><span class="p">):</span>
|
||||
<span class="sd">"""Cancel a running compose and delete its results directory"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">uuid</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">status</span> <span class="o">=</span> <span class="n">uuid_status</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"COMPOSER_CFG"</span><span class="p">],</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">status</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid build uuid"</span> <span class="o">%</span> <span class="n">uuid</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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_UUID</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid build uuid"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">status</span><span class="p">[</span><span class="s2">"queue_status"</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">"WAITING"</span><span class="p">,</span> <span class="s2">"RUNNING"</span><span class="p">]:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="s2">"Build </span><span class="si">%s</span><span class="s2"> is not in WAITING or RUNNING."</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">])</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BUILD_IN_WRONG_STATE</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Build </span><span class="si">%s</span><span class="s2"> is not in WAITING or RUNNING."</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">}])</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">uuid_cancel</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"COMPOSER_CFG"</span><span class="p">],</span> <span class="n">uuid</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">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="s2">"</span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">uuid</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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">COMPOSE_ERROR</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">uuid</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">else</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">uuid</span><span class="o">=</span><span class="n">uuid</span><span class="p">)</span>
|
||||
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/compose/delete"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'uuids'</span><span class="p">:</span> <span class="s2">""</span><span class="p">},</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s2">"DELETE"</span><span class="p">])</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/compose/delete/<uuids>"</span><span class="p">,</span> <span class="n">methods</span><span class="o">=</span><span class="p">[</span><span class="s2">"DELETE"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"uuids"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no UUIDs given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_compose_delete</span><span class="p">(</span><span class="n">uuids</span><span class="p">):</span>
|
||||
<span class="sd">"""Delete the compose results for the listed uuids"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">uuids</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">results</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">errors</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">uuid</span> <span class="ow">in</span> <span class="p">[</span><span class="n">n</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">uuids</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">","</span><span class="p">)]:</span>
|
||||
<span class="n">status</span> <span class="o">=</span> <span class="n">uuid_status</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"COMPOSER_CFG"</span><span class="p">],</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">status</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid build uuid"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_UUID</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid build uuid"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">})</span>
|
||||
<span class="k">elif</span> <span class="n">status</span><span class="p">[</span><span class="s2">"queue_status"</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">"FINISHED"</span><span class="p">,</span> <span class="s2">"FAILED"</span><span class="p">]:</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"Build </span><span class="si">%s</span><span class="s2"> is not in FINISHED or FAILED."</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BUILD_IN_WRONG_STATE</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Build </span><span class="si">%s</span><span class="s2"> is not in FINISHED or FAILED."</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">})</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">uuid_delete</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"COMPOSER_CFG"</span><span class="p">],</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"</span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">uuid</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)))</span>
|
||||
<span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">COMPOSE_ERROR</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2">: </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">uuid</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))})</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">results</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"uuid"</span><span class="p">:</span><span class="n">uuid</span><span class="p">,</span> <span class="s2">"status"</span><span class="p">:</span><span class="kc">True</span><span class="p">})</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">uuids</span><span class="o">=</span><span class="n">results</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</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/compose/info"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'uuid'</span><span class="p">:</span> <span class="s2">""</span><span class="p">})</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/compose/info/<uuid>"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"uuid"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"no UUID given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_compose_info</span><span class="p">(</span><span class="n">uuid</span><span class="p">):</span>
|
||||
<span class="sd">"""Return detailed info about a compose"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">uuid</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">info</span> <span class="o">=</span> <span class="n">uuid_info</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"COMPOSER_CFG"</span><span class="p">],</span> <span class="n">uuid</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">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">COMPOSE_ERROR</span><span class="p">,</span> <span class="s2">"msg"</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="o">**</span><span class="n">info</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">info</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_UUID</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid build uuid"</span> <span class="o">%</span> <span class="n">uuid</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="o">**</span><span class="n">info</span><span class="p">)</span>
|
||||
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/compose/metadata"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'uuid'</span><span class="p">:</span> <span class="s2">""</span><span class="p">})</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/compose/metadata/<uuid>"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"uuid"</span><span class="p">,</span><span class="s2">""</span><span class="p">,</span> <span class="s2">"no UUID given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_compose_metadata</span><span class="p">(</span><span class="n">uuid</span><span class="p">):</span>
|
||||
<span class="sd">"""Return a tar of the metadata for the build"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">uuid</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">status</span> <span class="o">=</span> <span class="n">uuid_status</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"COMPOSER_CFG"</span><span class="p">],</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">status</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid build uuid"</span> <span class="o">%</span> <span class="n">uuid</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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_UUID</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid build uuid"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
<span class="k">if</span> <span class="n">status</span><span class="p">[</span><span class="s2">"queue_status"</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">"FINISHED"</span><span class="p">,</span> <span class="s2">"FAILED"</span><span class="p">]:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="s2">"Build </span><span class="si">%s</span><span class="s2"> not in FINISHED or FAILED state."</span> <span class="o">%</span> <span class="n">uuid</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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BUILD_IN_WRONG_STATE</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Build </span><span class="si">%s</span><span class="s2"> not in FINISHED or FAILED state."</span> <span class="o">%</span> <span class="n">uuid</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">Response</span><span class="p">(</span><span class="n">uuid_tar</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"COMPOSER_CFG"</span><span class="p">],</span> <span class="n">uuid</span><span class="p">,</span> <span class="n">metadata</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">image</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">logs</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span>
|
||||
<span class="n">mimetype</span><span class="o">=</span><span class="s2">"application/x-tar"</span><span class="p">,</span>
|
||||
<span class="n">headers</span><span class="o">=</span><span class="p">[(</span><span class="s2">"Content-Disposition"</span><span class="p">,</span> <span class="s2">"attachment; filename=</span><span class="si">%s</span><span class="s2">-metadata.tar;"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">)],</span>
|
||||
<span class="n">direct_passthrough</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||||
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/compose/results"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'uuid'</span><span class="p">:</span> <span class="s2">""</span><span class="p">})</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/compose/results/<uuid>"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"uuid"</span><span class="p">,</span><span class="s2">""</span><span class="p">,</span> <span class="s2">"no UUID given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_compose_results</span><span class="p">(</span><span class="n">uuid</span><span class="p">):</span>
|
||||
<span class="sd">"""Return a tar of the metadata and the results for the build"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">uuid</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">status</span> <span class="o">=</span> <span class="n">uuid_status</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"COMPOSER_CFG"</span><span class="p">],</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">status</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid build uuid"</span> <span class="o">%</span> <span class="n">uuid</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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_UUID</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid build uuid"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
<span class="k">elif</span> <span class="n">status</span><span class="p">[</span><span class="s2">"queue_status"</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">"FINISHED"</span><span class="p">,</span> <span class="s2">"FAILED"</span><span class="p">]:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="s2">"Build </span><span class="si">%s</span><span class="s2"> not in FINISHED or FAILED state."</span> <span class="o">%</span> <span class="n">uuid</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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BUILD_IN_WRONG_STATE</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Build </span><span class="si">%s</span><span class="s2"> not in FINISHED or FAILED state."</span> <span class="o">%</span> <span class="n">uuid</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">Response</span><span class="p">(</span><span class="n">uuid_tar</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"COMPOSER_CFG"</span><span class="p">],</span> <span class="n">uuid</span><span class="p">,</span> <span class="n">metadata</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">image</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">logs</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span>
|
||||
<span class="n">mimetype</span><span class="o">=</span><span class="s2">"application/x-tar"</span><span class="p">,</span>
|
||||
<span class="n">headers</span><span class="o">=</span><span class="p">[(</span><span class="s2">"Content-Disposition"</span><span class="p">,</span> <span class="s2">"attachment; filename=</span><span class="si">%s</span><span class="s2">.tar;"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">)],</span>
|
||||
<span class="n">direct_passthrough</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||||
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/compose/logs"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'uuid'</span><span class="p">:</span> <span class="s2">""</span><span class="p">})</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/compose/logs/<uuid>"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"uuid"</span><span class="p">,</span><span class="s2">""</span><span class="p">,</span> <span class="s2">"no UUID given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_compose_logs</span><span class="p">(</span><span class="n">uuid</span><span class="p">):</span>
|
||||
<span class="sd">"""Return a tar of the metadata for the build"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">uuid</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">status</span> <span class="o">=</span> <span class="n">uuid_status</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"COMPOSER_CFG"</span><span class="p">],</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">status</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid build uuid"</span> <span class="o">%</span> <span class="n">uuid</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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_UUID</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid build uuid"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
<span class="k">elif</span> <span class="n">status</span><span class="p">[</span><span class="s2">"queue_status"</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">"FINISHED"</span><span class="p">,</span> <span class="s2">"FAILED"</span><span class="p">]:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="s2">"Build </span><span class="si">%s</span><span class="s2"> not in FINISHED or FAILED state."</span> <span class="o">%</span> <span class="n">uuid</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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BUILD_IN_WRONG_STATE</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Build </span><span class="si">%s</span><span class="s2"> not in FINISHED or FAILED state."</span> <span class="o">%</span> <span class="n">uuid</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">Response</span><span class="p">(</span><span class="n">uuid_tar</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"COMPOSER_CFG"</span><span class="p">],</span> <span class="n">uuid</span><span class="p">,</span> <span class="n">metadata</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">image</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">logs</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span>
|
||||
<span class="n">mimetype</span><span class="o">=</span><span class="s2">"application/x-tar"</span><span class="p">,</span>
|
||||
<span class="n">headers</span><span class="o">=</span><span class="p">[(</span><span class="s2">"Content-Disposition"</span><span class="p">,</span> <span class="s2">"attachment; filename=</span><span class="si">%s</span><span class="s2">-logs.tar;"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">)],</span>
|
||||
<span class="n">direct_passthrough</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
||||
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/compose/image"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'uuid'</span><span class="p">:</span> <span class="s2">""</span><span class="p">})</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/compose/image/<uuid>"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"uuid"</span><span class="p">,</span><span class="s2">""</span><span class="p">,</span> <span class="s2">"no UUID given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_compose_image</span><span class="p">(</span><span class="n">uuid</span><span class="p">):</span>
|
||||
<span class="sd">"""Return the output image for the build"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">uuid</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="n">status</span> <span class="o">=</span> <span class="n">uuid_status</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"COMPOSER_CFG"</span><span class="p">],</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">status</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid build uuid"</span> <span class="o">%</span> <span class="n">uuid</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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_UUID</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid build uuid"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
<span class="k">elif</span> <span class="n">status</span><span class="p">[</span><span class="s2">"queue_status"</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">"FINISHED"</span><span class="p">,</span> <span class="s2">"FAILED"</span><span class="p">]:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="s2">"Build </span><span class="si">%s</span><span class="s2"> not in FINISHED or FAILED state."</span> <span class="o">%</span> <span class="n">uuid</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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BUILD_IN_WRONG_STATE</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Build </span><span class="si">%s</span><span class="s2"> not in FINISHED or FAILED state."</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">image_name</span><span class="p">,</span> <span class="n">image_path</span> <span class="o">=</span> <span class="n">uuid_image</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"COMPOSER_CFG"</span><span class="p">],</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># Make sure it really exists</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">image_path</span><span class="p">):</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="s2">"Build </span><span class="si">%s</span><span class="s2"> is missing image file </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">uuid</span><span class="p">,</span> <span class="n">image_name</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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BUILD_MISSING_FILE</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Build </span><span class="si">%s</span><span class="s2"> is missing image file </span><span class="si">%s</span><span class="s2">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">uuid</span><span class="p">,</span> <span class="n">image_name</span><span class="p">)}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="c1"># Make the image name unique</span>
|
||||
<span class="n">image_name</span> <span class="o">=</span> <span class="n">uuid</span> <span class="o">+</span> <span class="s2">"-"</span> <span class="o">+</span> <span class="n">image_name</span>
|
||||
<span class="c1"># XXX - Will mime type guessing work for all our output?</span>
|
||||
<span class="k">return</span> <span class="n">send_file</span><span class="p">(</span><span class="n">image_path</span><span class="p">,</span> <span class="n">as_attachment</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">attachment_filename</span><span class="o">=</span><span class="n">image_name</span><span class="p">,</span> <span class="n">add_etags</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
|
||||
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/compose/log"</span><span class="p">,</span> <span class="n">defaults</span><span class="o">=</span><span class="p">{</span><span class="s1">'uuid'</span><span class="p">:</span> <span class="s2">""</span><span class="p">})</span>
|
||||
<span class="nd">@api</span><span class="o">.</span><span class="n">route</span><span class="p">(</span><span class="s2">"/api/v0/compose/log/<uuid>"</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="s2">"*"</span><span class="p">)</span>
|
||||
<span class="nd">@checkparams</span><span class="p">([(</span><span class="s2">"uuid"</span><span class="p">,</span><span class="s2">""</span><span class="p">,</span> <span class="s2">"no UUID given"</span><span class="p">)])</span>
|
||||
<span class="k">def</span> <span class="nf">v0_compose_log_tail</span><span class="p">(</span><span class="n">uuid</span><span class="p">):</span>
|
||||
<span class="sd">"""Return the end of the main anaconda.log, defaults to 1Mbytes"""</span>
|
||||
<span class="k">if</span> <span class="n">VALID_API_STRING</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">uuid</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">INVALID_CHARS</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Invalid characters in API path"</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="n">size</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</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="s2">"size"</span><span class="p">,</span> <span class="s2">"1024"</span><span class="p">))</span>
|
||||
<span class="k">except</span> <span class="ne">ValueError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">COMPOSE_ERROR</span><span class="p">,</span> <span class="s2">"msg"</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="n">status</span> <span class="o">=</span> <span class="n">uuid_status</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"COMPOSER_CFG"</span><span class="p">],</span> <span class="n">uuid</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">status</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid build uuid"</span> <span class="o">%</span> <span class="n">uuid</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="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">UNKNOWN_UUID</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%s</span><span class="s2"> is not a valid build uuid"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">}]),</span> <span class="mi">400</span>
|
||||
<span class="k">elif</span> <span class="n">status</span><span class="p">[</span><span class="s2">"queue_status"</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"WAITING"</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="s2">"Build </span><span class="si">%s</span><span class="s2"> has not started yet. No logs to view"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">])</span>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">BUILD_IN_WRONG_STATE</span><span class="p">,</span> <span class="s2">"msg"</span><span class="p">:</span> <span class="s2">"Build </span><span class="si">%s</span><span class="s2"> has not started yet. No logs to view"</span> <span class="o">%</span> <span class="n">uuid</span><span class="p">}])</span>
|
||||
<span class="k">try</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">Response</span><span class="p">(</span><span class="n">uuid_log</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">config</span><span class="p">[</span><span class="s2">"COMPOSER_CFG"</span><span class="p">],</span> <span class="n">uuid</span><span class="p">,</span> <span class="n">size</span><span class="p">),</span> <span class="n">direct_passthrough</span><span class="o">=</span><span class="kc">True</span><span class="p">)</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="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)]),</span> <span class="mi">400</span></div>
|
||||
<span class="k">return</span> <span class="n">jsonify</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">errors</span><span class="o">=</span><span class="p">[{</span><span class="s2">"id"</span><span class="p">:</span> <span class="n">COMPOSE_ERROR</span><span class="p">,</span> <span class="s2">"msg"</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></div>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
@ -1969,7 +2201,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.api.workspace — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.api.workspace — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -288,7 +288,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.base — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.base — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -256,7 +256,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.buildstamp — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.buildstamp — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -250,7 +250,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.cmdline — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.cmdline — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -390,7 +390,7 @@
|
||||
|
||||
<span class="c1"># Group of arguments to pass to qemu</span>
|
||||
<span class="n">virt_group</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">add_argument_group</span><span class="p">(</span><span class="s2">"qemu arguments"</span><span class="p">)</span>
|
||||
<span class="n">virt_group</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--ram"</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">"MEMORY"</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="mi">1024</span><span class="p">,</span>
|
||||
<span class="n">virt_group</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--ram"</span><span class="p">,</span> <span class="n">metavar</span><span class="o">=</span><span class="s2">"MEMORY"</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="mi">2048</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Memory to allocate for installer in megabytes."</span><span class="p">)</span>
|
||||
<span class="n">virt_group</span><span class="o">.</span><span class="n">add_argument</span><span class="p">(</span><span class="s2">"--vcpus"</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
|
||||
<span class="n">help</span><span class="o">=</span><span class="s2">"Passed to qemu -smp command"</span><span class="p">)</span>
|
||||
@ -491,7 +491,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.creator — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.creator — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -903,7 +903,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.decorators — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.decorators — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -219,7 +219,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.discinfo — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.discinfo — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -228,7 +228,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.dnfhelper — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.dnfhelper — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -298,7 +298,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.executils — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.executils — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -536,7 +536,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.imgutils — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.imgutils — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -336,13 +336,34 @@
|
||||
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">"Unable to setup </span><span class="si">%s</span><span class="s2"> on </span><span class="si">%s</span><span class="s2">"</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">'''Attach a loop device to the given file. Return the loop device name.</span>
|
||||
<span class="sd"> Raises CalledProcessError if losetup fails.'''</span>
|
||||
<span class="n">dev</span> <span class="o">=</span> <span class="n">runcmd_output</span><span class="p">([</span><span class="s2">"losetup"</span><span class="p">,</span> <span class="s2">"--find"</span><span class="p">,</span> <span class="s2">"--show"</span><span class="p">,</span> <span class="n">outfile</span><span class="p">])</span>
|
||||
<span class="sd">"""Attach a loop device to the given file. Return the loop device name.</span>
|
||||
|
||||
<span class="c1"># Sometimes the loop device isn'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></div>
|
||||
<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"> """</span>
|
||||
<span class="n">retries</span> <span class="o">=</span> <span class="mi">0</span>
|
||||
<span class="k">while</span> <span class="kc">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="s2">"losetup"</span><span class="p">,</span> <span class="s2">"--find"</span><span class="p">,</span> <span class="s2">"--show"</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="c1"># Sometimes the loop device isn'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="c1"># 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="c1"># 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="s2">"loop_attach failed, retries exhausted."</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="s2">"Try </span><span class="si">%d</span><span class="s2"> failed, </span><span class="si">%s</span><span class="s2"> did not appear."</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">'''Detach the given loop device. Return False on failure.'''</span>
|
||||
@ -708,7 +729,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.installer — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.installer — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -792,7 +792,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.ltmpl — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.ltmpl — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -960,7 +960,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.monitor — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.monitor — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -191,6 +191,26 @@
|
||||
<span class="sd"> for patterns that would indicate that the installation failed.</span>
|
||||
<span class="sd"> self.server.log_error is set True when this happens.</span>
|
||||
<span class="sd"> """</span>
|
||||
|
||||
<span class="n">simple_tests</span> <span class="o">=</span> <span class="p">[</span>
|
||||
<span class="s2">"Traceback ("</span><span class="p">,</span>
|
||||
<span class="s2">"traceback script(s) have been run"</span><span class="p">,</span>
|
||||
<span class="s2">"Out of memory:"</span><span class="p">,</span>
|
||||
<span class="s2">"Call Trace:"</span><span class="p">,</span>
|
||||
<span class="s2">"insufficient disk space:"</span><span class="p">,</span>
|
||||
<span class="s2">"Not enough disk space to download the packages"</span><span class="p">,</span>
|
||||
<span class="s2">"error populating transaction after"</span><span class="p">,</span>
|
||||
<span class="s2">"crashed on signal"</span><span class="p">,</span>
|
||||
<span class="s2">"packaging: Missed: NoSuchPackage"</span><span class="p">,</span>
|
||||
<span class="s2">"packaging: Installation failed"</span><span class="p">,</span>
|
||||
<span class="s2">"The following error occurred while installing. This is a fatal error"</span>
|
||||
<span class="p">]</span>
|
||||
|
||||
<span class="n">re_tests</span> <span class="o">=</span> <span class="p">[</span>
|
||||
<span class="sa">r</span><span class="s2">"packaging: base repo .* not valid"</span><span class="p">,</span>
|
||||
<span class="sa">r</span><span class="s2">"packaging: .* requires .*"</span>
|
||||
<span class="p">]</span>
|
||||
|
||||
<div class="viewcode-block" id="LogRequestHandler.setup"><a class="viewcode-back" href="../../pylorax.html#pylorax.monitor.LogRequestHandler.setup">[docs]</a> <span class="k">def</span> <span class="nf">setup</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""Start writing to self.server.log_path"""</span>
|
||||
|
||||
@ -256,25 +276,13 @@
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">if</span> <span class="s2">"IGNORED"</span> <span class="ow">in</span> <span class="n">line</span><span class="p">:</span>
|
||||
<span class="k">return</span>
|
||||
<span class="n">simple_tests</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"Traceback ("</span><span class="p">,</span>
|
||||
<span class="s2">"Out of memory:"</span><span class="p">,</span>
|
||||
<span class="s2">"Call Trace:"</span><span class="p">,</span>
|
||||
<span class="s2">"insufficient disk space:"</span><span class="p">,</span>
|
||||
<span class="s2">"Not enough disk space to download the packages"</span><span class="p">,</span>
|
||||
<span class="s2">"error populating transaction after"</span><span class="p">,</span>
|
||||
<span class="s2">"traceback script(s) have been run"</span><span class="p">,</span>
|
||||
<span class="s2">"crashed on signal"</span><span class="p">,</span>
|
||||
<span class="s2">"packaging: Missed: NoSuchPackage"</span><span class="p">,</span>
|
||||
<span class="s2">"packaging: Installation failed"</span><span class="p">,</span>
|
||||
<span class="s2">"The following error occurred while installing. This is a fatal error"</span><span class="p">]</span>
|
||||
<span class="n">re_tests</span> <span class="o">=</span> <span class="p">[</span><span class="sa">r</span><span class="s2">"packaging: base repo .* not valid"</span><span class="p">,</span>
|
||||
<span class="sa">r</span><span class="s2">"packaging: .* requires .*"</span><span class="p">]</span>
|
||||
<span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">simple_tests</span><span class="p">:</span>
|
||||
|
||||
<span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">simple_tests</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">line</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">log_error</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">error_line</span> <span class="o">=</span> <span class="n">line</span>
|
||||
<span class="k">return</span>
|
||||
<span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">re_tests</span><span class="p">:</span>
|
||||
<span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">re_tests</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">re</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">t</span><span class="p">,</span> <span class="n">line</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">log_error</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">error_line</span> <span class="o">=</span> <span class="n">line</span>
|
||||
@ -325,7 +333,7 @@
|
||||
<span class="sd"> This needs to be running before the virt-install runs, it expects</span>
|
||||
<span class="sd"> there to be a listener on the port used for the virtio log port.</span>
|
||||
<span class="sd"> """</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">log_path</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">host</span><span class="o">=</span><span class="s2">"localhost"</span><span class="p">,</span> <span class="n">port</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">timeout</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">log_path</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">host</span><span class="o">=</span><span class="s2">"localhost"</span><span class="p">,</span> <span class="n">port</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">timeout</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">log_request_handler_class</span><span class="o">=</span><span class="n">LogRequestHandler</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Start a thread to monitor the logs.</span>
|
||||
|
||||
@ -339,7 +347,7 @@
|
||||
<span class="sd"> If log_path isn't set then it only monitors the logs, instead of</span>
|
||||
<span class="sd"> also writing them to disk.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">server</span> <span class="o">=</span> <span class="n">LogServer</span><span class="p">(</span><span class="n">log_path</span><span class="p">,</span> <span class="p">(</span><span class="n">host</span><span class="p">,</span> <span class="n">port</span><span class="p">),</span> <span class="n">LogRequestHandler</span><span class="p">,</span> <span class="n">timeout</span><span class="o">=</span><span class="n">timeout</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">server</span> <span class="o">=</span> <span class="n">LogServer</span><span class="p">(</span><span class="n">log_path</span><span class="p">,</span> <span class="p">(</span><span class="n">host</span><span class="p">,</span> <span class="n">port</span><span class="p">),</span> <span class="n">log_request_handler_class</span><span class="p">,</span> <span class="n">timeout</span><span class="o">=</span><span class="n">timeout</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">host</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">port</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">server_address</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">log_path</span> <span class="o">=</span> <span class="n">log_path</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">server_thread</span> <span class="o">=</span> <span class="n">threading</span><span class="o">.</span><span class="n">Thread</span><span class="p">(</span><span class="n">target</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">server</span><span class="o">.</span><span class="n">handle_request</span><span class="p">)</span>
|
||||
@ -384,7 +392,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.mount — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.mount — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -291,7 +291,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.sysutils — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.sysutils — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -297,7 +297,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.treebuilder — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.treebuilder — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -589,7 +589,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax.treeinfo — Lorax 28.14 documentation</title>
|
||||
<title>pylorax.treeinfo — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -246,7 +246,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'../../',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -27,7 +27,7 @@ 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 chance the
|
||||
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``.
|
||||
|
@ -22,7 +22,13 @@ 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.
|
||||
the system is rebooted. This will cause some delay in responding to the first
|
||||
request from the UI or `composer-cli`.
|
||||
|
||||
.. note::
|
||||
|
||||
If you want lorax-composer to respond immediately to the first request you can
|
||||
start and enable `lorax-composer.service` instead of `lorax-composer.socket`
|
||||
|
||||
Quickstart
|
||||
----------
|
||||
@ -31,8 +37,13 @@ Quickstart
|
||||
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. 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/``
|
||||
&& sudo systemctl start lorax-composer.socket``.
|
||||
|
||||
NOTE: You can also run it directly with ``lorax-composer /path/to/blueprints``. However,
|
||||
``lorax-composer`` does not react well to being started both on the command line and via
|
||||
socket activation at the same time. It is therefore recommended that you run it directly
|
||||
on the command line only for testing or development purposes. For real use or development
|
||||
of other projects that simply use the API, you should stick to socket activation only.
|
||||
|
||||
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``
|
||||
@ -120,7 +131,9 @@ when it is written to disk. It should be short and descriptive.
|
||||
``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.0.1`` when the existing blueprint ``version`` is ``0.0.1`` will result in the new blueprint being stored as ``version 0.0.1``.
|
||||
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]]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@ -135,6 +148,18 @@ 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``.
|
||||
|
||||
[[groups]]
|
||||
~~~~~~~~~~
|
||||
|
||||
These entries describe a group of packages to be installed into the image. Package groups are
|
||||
defined in the repository metadata. Each group has a descriptive name used primarily for display
|
||||
in user interfaces and an ID more commonly used in kickstart files. Here, the ID is the expected
|
||||
way of listing a group.
|
||||
|
||||
Groups have three different ways of categorizing their packages: mandatory, default, and optional.
|
||||
For purposes of blueprints, mandatory and default packages will be installed. There is no mechanism
|
||||
for selecting optional packages.
|
||||
|
||||
Customizations
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -70,7 +70,9 @@ jQuery.fn.highlightText = function(text, className) {
|
||||
if (node.nodeType === 3) {
|
||||
var val = node.nodeValue;
|
||||
var pos = val.toLowerCase().indexOf(text);
|
||||
if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) {
|
||||
if (pos >= 0 &&
|
||||
!jQuery(node.parentNode).hasClass(className) &&
|
||||
!jQuery(node.parentNode).hasClass("nohighlight")) {
|
||||
var span;
|
||||
var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
|
||||
if (isInSVG) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '',
|
||||
VERSION: '28.14',
|
||||
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
|
||||
VERSION: '28.17',
|
||||
LANGUAGE: 'None',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>composer-cli — Lorax 28.14 documentation</title>
|
||||
<title>composer-cli — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -247,6 +247,8 @@ group. They do not need to be root, but all of the <a class="reference external"
|
||||
<dd>List the supported output types.</dd>
|
||||
<dt>compose status</dt>
|
||||
<dd>List the status of all running and finished composes.</dd>
|
||||
<dt>compose list [waiting|running|finished|failed]</dt>
|
||||
<dd>List basic information about composes.</dd>
|
||||
<dt>compose log <UUID> [<SIZE>]</dt>
|
||||
<dd>Show the last SIZE kB of the compose log.</dd>
|
||||
<dt>compose cancel <UUID></dt>
|
||||
@ -310,6 +312,7 @@ TO-COMMIT can be a commit hash, NEWEST, or WORKSPACE</dd>
|
||||
<dt>sources delete <SOURCE-NAME></dt>
|
||||
<dd>Delete a package source.</dd>
|
||||
</dl>
|
||||
<p>status show Show API server status.</p>
|
||||
</p>
|
||||
</div>
|
||||
<div class="section" id="edit-a-blueprint">
|
||||
@ -318,7 +321,7 @@ TO-COMMIT can be a commit hash, NEWEST, or WORKSPACE</dd>
|
||||
<span class="pre">list</span></code>, pick one and save it to the local directory by running <code class="docutils literal notranslate"><span class="pre">composer-cli</span>
|
||||
<span class="pre">blueprints</span> <span class="pre">save</span> <span class="pre">http-server</span></code>. 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 chance the
|
||||
<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 <code class="docutils literal notranslate"><span class="pre">composer-cli</span> <span class="pre">blueprints</span> <span class="pre">push</span> <span class="pre">http-server.toml</span></code>. You can verify that it was
|
||||
saved by viewing the changelog - <code class="docutils literal notranslate"><span class="pre">composer-cli</span> <span class="pre">blueprints</span> <span class="pre">changes</span> <span class="pre">http-server</span></code>.</p>
|
||||
@ -392,7 +395,7 @@ save the qcow2 image as <code class="docutils literal notranslate"><span class="
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'./',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Index — Lorax 28.14 documentation</title>
|
||||
<title>Index — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -214,6 +214,8 @@
|
||||
<li><a href="pylorax.html#pylorax.base.BaseLoraxClass">BaseLoraxClass (class in pylorax.base)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.html#pylorax.ArchData.bcj_arch">bcj_arch (pylorax.ArchData attribute)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.api.html#pylorax.api.v0.blueprint_exists">blueprint_exists() (in module pylorax.api.v0)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.html#pylorax.ltmpl.brace_expand">brace_expand() (in module pylorax.ltmpl)</a>
|
||||
</li>
|
||||
@ -402,6 +404,8 @@
|
||||
<li><a href="pylorax.html#pylorax.treebuilder.generate_module_info">generate_module_info() (in module pylorax.treebuilder)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.html#pylorax.creator.get_arch">get_arch() (in module pylorax.creator)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.api.html#pylorax.api.dnfbase.get_base_object">get_base_object() (in module pylorax.api.dnfbase)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.html#pylorax.get_buildarch">get_buildarch() (in module pylorax)</a>
|
||||
</li>
|
||||
@ -428,6 +432,8 @@
|
||||
<li><a href="pylorax.api.html#pylorax.api.recipes.gfile">gfile() (in module pylorax.api.recipes)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.api.html#pylorax.api.server.GitLock">GitLock (class in pylorax.api.server)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.api.html#pylorax.api.recipes.Recipe.group_names">group_names (pylorax.api.recipes.Recipe attribute)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
</tr></table>
|
||||
@ -707,13 +713,15 @@
|
||||
</li>
|
||||
<li><a href="pylorax.api.html#module-pylorax.api.cmdline">pylorax.api.cmdline (module)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="pylorax.api.html#module-pylorax.api.compose">pylorax.api.compose (module)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="pylorax.api.html#module-pylorax.api.config">pylorax.api.config (module)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.api.html#module-pylorax.api.crossdomain">pylorax.api.crossdomain (module)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.api.html#module-pylorax.api.dnfbase">pylorax.api.dnfbase (module)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.api.html#module-pylorax.api.projects">pylorax.api.projects (module)</a>
|
||||
</li>
|
||||
@ -781,6 +789,8 @@
|
||||
<h2 id="R">R</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="pylorax.html#pylorax.monitor.LogRequestHandler.re_tests">re_tests (pylorax.monitor.LogRequestHandler attribute)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.api.html#pylorax.api.recipes.read_commit">read_commit() (in module pylorax.api.recipes)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.api.html#pylorax.api.recipes.read_commit_spec">read_commit_spec() (in module pylorax.api.recipes)</a>
|
||||
@ -808,6 +818,8 @@
|
||||
<li><a href="pylorax.api.html#pylorax.api.recipes.RecipeError">RecipeError</a>
|
||||
</li>
|
||||
<li><a href="pylorax.api.html#pylorax.api.recipes.RecipeFileError">RecipeFileError</a>
|
||||
</li>
|
||||
<li><a href="pylorax.api.html#pylorax.api.recipes.RecipeGroup">RecipeGroup (class in pylorax.api.recipes)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.api.html#pylorax.api.recipes.RecipeModule">RecipeModule (class in pylorax.api.recipes)</a>
|
||||
</li>
|
||||
@ -820,11 +832,11 @@
|
||||
</li>
|
||||
</ul></li>
|
||||
<li><a href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.removefrom">removefrom() (pylorax.ltmpl.LoraxTemplateRunner method)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.removekmod">removekmod() (pylorax.ltmpl.LoraxTemplateRunner method)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.removekmod">removekmod() (pylorax.ltmpl.LoraxTemplateRunner method)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.html#pylorax.ltmpl.LoraxTemplateRunner.removepkg">removepkg() (pylorax.ltmpl.LoraxTemplateRunner method)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.html#pylorax.sysutils.replace">replace() (in module pylorax.sysutils)</a>
|
||||
@ -884,6 +896,8 @@
|
||||
<li><a href="pylorax.html#pylorax.setup_logging">setup_logging() (in module pylorax)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.html#pylorax.monitor.LogMonitor.shutdown">shutdown() (pylorax.monitor.LogMonitor method)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.html#pylorax.monitor.LogRequestHandler.simple_tests">simple_tests (pylorax.monitor.LogRequestHandler attribute)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.html#pylorax.decorators.singleton">singleton() (in module pylorax.decorators)</a>
|
||||
</li>
|
||||
@ -923,10 +937,12 @@
|
||||
</li>
|
||||
<li><a href="pylorax.html#pylorax.Lorax.templatedir">templatedir (pylorax.Lorax attribute)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.html#pylorax.monitor.LogServer.timeout">timeout (pylorax.monitor.LogServer attribute)</a>
|
||||
<li><a href="pylorax.api.html#pylorax.api.compose.test_templates">test_templates() (in module pylorax.api.compose)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="pylorax.html#pylorax.monitor.LogServer.timeout">timeout (pylorax.monitor.LogServer attribute)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.api.html#pylorax.api.recipes.Recipe.toml">toml() (pylorax.api.recipes.Recipe method)</a>
|
||||
</li>
|
||||
<li><a href="pylorax.html#pylorax.sysutils.touch">touch() (in module pylorax.sysutils)</a>
|
||||
@ -1054,7 +1070,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'./',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Welcome to Lorax’s documentation! — Lorax 28.14 documentation</title>
|
||||
<title>Welcome to Lorax’s documentation! — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -227,7 +227,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'./',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Introduction to Lorax — Lorax 28.14 documentation</title>
|
||||
<title>Introduction to Lorax — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -250,7 +250,7 @@ upd-instroot and mk-images* scripts.</p>
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'./',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>livemedia-creator — Lorax 28.14 documentation</title>
|
||||
<title>livemedia-creator — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -486,7 +486,7 @@ you have the anaconda-tui package installed.</p>
|
||||
<tr><td class="option-group">
|
||||
<kbd>--ram</kbd></td>
|
||||
<td><p class="first">Memory to allocate for installer in megabytes.</p>
|
||||
<p class="last">Default: 1024</p>
|
||||
<p class="last">Default: 2048</p>
|
||||
</td></tr>
|
||||
<tr><td class="option-group">
|
||||
<kbd>--vcpus</kbd></td>
|
||||
@ -1148,7 +1148,7 @@ report bugs against the lorax component.</p>
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'./',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>lorax-composer — Lorax 28.14 documentation</title>
|
||||
<title>lorax-composer — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -102,6 +102,7 @@
|
||||
<li class="toctree-l2"><a class="reference internal" href="#composing-images">Composing Images</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#blueprints">Blueprints</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#packages-and-modules">[[packages]] and [[modules]]</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#groups">[[groups]]</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="#customizations">Customizations</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#customizations-sshkey">[[customizations.sshkey]]</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="#customizations-user">[[customizations.user]]</a></li>
|
||||
@ -209,7 +210,13 @@ systemd socket activation service. You will then need to enable it with <code cl
|
||||
<span class="pre">systemctl</span> <span class="pre">enable</span> <span class="pre">lorax-composer.socket</span> <span class="pre">&&</span> <span class="pre">sudo</span> <span class="pre">systemctl</span> <span class="pre">start</span>
|
||||
<span class="pre">lorax-composer.socket</span></code>. 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>
|
||||
the system is rebooted. This will cause some delay in responding to the first
|
||||
request from the UI or <cite>composer-cli</cite>.</p>
|
||||
<div class="admonition note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<p class="last">If you want lorax-composer to respond immediately to the first request you can
|
||||
start and enable <cite>lorax-composer.service</cite> instead of <cite>lorax-composer.socket</cite></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="quickstart">
|
||||
<h2>Quickstart<a class="headerlink" href="#quickstart" title="Permalink to this headline">¶</a></h2>
|
||||
@ -218,9 +225,13 @@ the system is rebooted.</p>
|
||||
<li>Remove any pre-existing socket directory with <code class="docutils literal notranslate"><span class="pre">rm</span> <span class="pre">-rf</span> <span class="pre">/run/weldr/</span></code>
|
||||
A new directory with correct permissions will be created the first time the server runs.</li>
|
||||
<li>Enable the socket activation with <code class="docutils literal notranslate"><span class="pre">systemctl</span> <span class="pre">enable</span> <span class="pre">lorax-composer.socket</span>
|
||||
<span class="pre">&&</span> <span class="pre">sudo</span> <span class="pre">systemctl</span> <span class="pre">start</span> <span class="pre">lorax-composer.socket</span></code> or run it directly with
|
||||
<code class="docutils literal notranslate"><span class="pre">lorax-composer</span> <span class="pre">/path/to/blueprints/</span></code></li>
|
||||
<span class="pre">&&</span> <span class="pre">sudo</span> <span class="pre">systemctl</span> <span class="pre">start</span> <span class="pre">lorax-composer.socket</span></code>.</li>
|
||||
</ol>
|
||||
<p>NOTE: You can also run it directly with <code class="docutils literal notranslate"><span class="pre">lorax-composer</span> <span class="pre">/path/to/blueprints</span></code>. However,
|
||||
<code class="docutils literal notranslate"><span class="pre">lorax-composer</span></code> does not react well to being started both on the command line and via
|
||||
socket activation at the same time. It is therefore recommended that you run it directly
|
||||
on the command line only for testing or development purposes. For real use or development
|
||||
of other projects that simply use the API, you should stick to socket activation only.</p>
|
||||
<p>The <code class="docutils literal notranslate"><span class="pre">/path/to/blueprints/</span></code> directory is where the blueprints’ git repo will
|
||||
be created, and all the blueprints created with the <code class="docutils literal notranslate"><span class="pre">/api/v0/blueprints/new</span></code>
|
||||
route will be stored. If there are blueprint <code class="docutils literal notranslate"><span class="pre">.toml</span></code> files in the top level
|
||||
@ -368,7 +379,9 @@ when it is written to disk. It should be short and descriptive.</p>
|
||||
<p><code class="docutils literal notranslate"><span class="pre">version</span></code> is a <a class="reference external" href="https://semver.org/">semver compatible</a> version number. If
|
||||
a new blueprint is uploaded with the same <code class="docutils literal notranslate"><span class="pre">version</span></code> the server will
|
||||
automatically bump the PATCH level of the <code class="docutils literal notranslate"><span class="pre">version</span></code>. If the <code class="docutils literal notranslate"><span class="pre">version</span></code>
|
||||
doesn’t match it will be used as is. eg. Uploading a blueprint with <code class="docutils literal notranslate"><span class="pre">version</span></code> set to <code class="docutils literal notranslate"><span class="pre">0.0.1</span></code> when the existing blueprint <code class="docutils literal notranslate"><span class="pre">version</span></code> is <code class="docutils literal notranslate"><span class="pre">0.0.1</span></code> will result in the new blueprint being stored as <code class="docutils literal notranslate"><span class="pre">version</span> <span class="pre">0.0.1</span></code>.</p>
|
||||
doesn’t match it will be used as is. eg. Uploading a blueprint with <code class="docutils literal notranslate"><span class="pre">version</span></code>
|
||||
set to <code class="docutils literal notranslate"><span class="pre">0.1.0</span></code> when the existing blueprint <code class="docutils literal notranslate"><span class="pre">version</span></code> is <code class="docutils literal notranslate"><span class="pre">0.0.1</span></code> will
|
||||
result in the new blueprint being stored as <code class="docutils literal notranslate"><span class="pre">version</span> <span class="pre">0.1.0</span></code>.</p>
|
||||
<div class="section" id="packages-and-modules">
|
||||
<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>
|
||||
@ -379,6 +392,16 @@ character matching.</p>
|
||||
that is planned for a future release. And currently there are no differences
|
||||
between <code class="docutils literal notranslate"><span class="pre">packages</span></code> and <code class="docutils literal notranslate"><span class="pre">modules</span></code> in <code class="docutils literal notranslate"><span class="pre">lorax-composer</span></code>.</p>
|
||||
</div>
|
||||
<div class="section" id="groups">
|
||||
<h3>[[groups]]<a class="headerlink" href="#groups" title="Permalink to this headline">¶</a></h3>
|
||||
<p>These entries describe a group of packages to be installed into the image. Package groups are
|
||||
defined in the repository metadata. Each group has a descriptive name used primarily for display
|
||||
in user interfaces and an ID more commonly used in kickstart files. Here, the ID is the expected
|
||||
way of listing a group.</p>
|
||||
<p>Groups have three different ways of categorizing their packages: mandatory, default, and optional.
|
||||
For purposes of blueprints, mandatory and default packages will be installed. There is no mechanism
|
||||
for selecting optional packages.</p>
|
||||
</div>
|
||||
<div class="section" id="customizations">
|
||||
<h3>Customizations<a class="headerlink" href="#customizations" title="Permalink to this headline">¶</a></h3>
|
||||
<p>The <code class="docutils literal notranslate"><span class="pre">[[customizations]]</span></code> section can be used to configure the hostname of the final image. eg.:</p>
|
||||
@ -558,7 +581,7 @@ conflict with any other package sources, otherwise depsolving will fail.</p>
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'./',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Lorax — Lorax 28.14 documentation</title>
|
||||
<title>Lorax — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -568,7 +568,7 @@ should) select the specific template directory by passing <code class="docutils
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'./',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax — Lorax 28.14 documentation</title>
|
||||
<title>pylorax — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -171,7 +171,7 @@
|
||||
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.compose">pylorax.api.compose module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.config">pylorax.api.config module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.crossdomain">pylorax.api.crossdomain module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#pylorax-api-dnfbase-module">pylorax.api.dnfbase module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.dnfbase">pylorax.api.dnfbase module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.projects">pylorax.api.projects module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.queue">pylorax.api.queue module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.recipes">pylorax.api.recipes module</a></li>
|
||||
@ -250,7 +250,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'./',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
Binary file not shown.
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Product and Updates Images — Lorax 28.14 documentation</title>
|
||||
<title>Product and Updates Images — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -222,7 +222,7 @@ command or the installpkgs paramater of <a class="reference internal" href="pylo
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'./',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Python Module Index — Lorax 28.14 documentation</title>
|
||||
<title>Python Module Index — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -195,6 +195,11 @@
|
||||
<td>   
|
||||
<a href="pylorax.api.html#module-pylorax.api.crossdomain"><code class="xref">pylorax.api.crossdomain</code></a></td><td>
|
||||
<em></em></td></tr>
|
||||
<tr class="cg-1">
|
||||
<td></td>
|
||||
<td>   
|
||||
<a href="pylorax.api.html#module-pylorax.api.dnfbase"><code class="xref">pylorax.api.dnfbase</code></a></td><td>
|
||||
<em></em></td></tr>
|
||||
<tr class="cg-1">
|
||||
<td></td>
|
||||
<td>   
|
||||
@ -345,7 +350,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'./',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>pylorax package — Lorax 28.14 documentation</title>
|
||||
<title>pylorax package — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -201,7 +201,7 @@
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.config">pylorax.api.config module</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.crossdomain">pylorax.api.crossdomain module</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="pylorax.api.html#pylorax-api-dnfbase-module">pylorax.api.dnfbase module</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.dnfbase">pylorax.api.dnfbase module</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.projects">pylorax.api.projects module</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.queue">pylorax.api.queue module</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="pylorax.api.html#module-pylorax.api.recipes">pylorax.api.recipes module</a></li>
|
||||
@ -264,7 +264,7 @@
|
||||
<dl class="class">
|
||||
<dt id="pylorax.base.BaseLoraxClass">
|
||||
<em class="property">class </em><code class="descclassname">pylorax.base.</code><code class="descname">BaseLoraxClass</code><a class="reference internal" href="_modules/pylorax/base.html#BaseLoraxClass"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.BaseLoraxClass" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dl class="method">
|
||||
<dt id="pylorax.base.BaseLoraxClass.pcritical">
|
||||
<code class="descname">pcritical</code><span class="sig-paren">(</span><em>msg</em>, <em>fobj=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/base.html#BaseLoraxClass.pcritical"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.BaseLoraxClass.pcritical" title="Permalink to this definition">¶</a></dt>
|
||||
@ -295,7 +295,7 @@
|
||||
<dl class="class">
|
||||
<dt id="pylorax.base.DataHolder">
|
||||
<em class="property">class </em><code class="descclassname">pylorax.base.</code><code class="descname">DataHolder</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/base.html#DataHolder"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.DataHolder" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a></p>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a></p>
|
||||
<dl class="method">
|
||||
<dt id="pylorax.base.DataHolder.copy">
|
||||
<code class="descname">copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → a shallow copy of D<a class="reference internal" href="_modules/pylorax/base.html#DataHolder.copy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.base.DataHolder.copy" title="Permalink to this definition">¶</a></dt>
|
||||
@ -309,7 +309,7 @@
|
||||
<dl class="class">
|
||||
<dt id="pylorax.buildstamp.BuildStamp">
|
||||
<em class="property">class </em><code class="descclassname">pylorax.buildstamp.</code><code class="descname">BuildStamp</code><span class="sig-paren">(</span><em>product</em>, <em>version</em>, <em>bugurl</em>, <em>isfinal</em>, <em>buildarch</em>, <em>variant=''</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/buildstamp.html#BuildStamp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.buildstamp.BuildStamp" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dl class="method">
|
||||
<dt id="pylorax.buildstamp.BuildStamp.write">
|
||||
<code class="descname">write</code><span class="sig-paren">(</span><em>outfile</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/buildstamp.html#BuildStamp.write"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.buildstamp.BuildStamp.write" title="Permalink to this definition">¶</a></dt>
|
||||
@ -338,7 +338,7 @@
|
||||
<dl class="class">
|
||||
<dt id="pylorax.creator.FakeDNF">
|
||||
<em class="property">class </em><code class="descclassname">pylorax.creator.</code><code class="descname">FakeDNF</code><span class="sig-paren">(</span><em>conf</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/creator.html#FakeDNF"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.creator.FakeDNF" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<p>A minimal DNF object suitable for passing to RuntimeBuilder</p>
|
||||
<p>lmc uses RuntimeBuilder to run the arch specific iso creation
|
||||
templates, so the the installroot config value is the important part of
|
||||
@ -360,14 +360,14 @@ this. Everything else should be a nop.</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>opts</strong> (<em>argparse options</em>) – options passed to livemedia-creator</li>
|
||||
<li><strong>ks</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Path to the kickstart to use for the installation</li>
|
||||
<li><strong>ks</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Path to the kickstart to use for the installation</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Disk size in MiB</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.6)">int</a></p>
|
||||
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)">int</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -383,9 +383,9 @@ this. Everything else should be a nop.</p>
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||
<li><strong>images_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Path of directory with images to be used</li>
|
||||
<li><strong>live_image_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Name of live rootfs image file</li>
|
||||
<li><strong>add_args</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.6)"><em>list</em></a>) – Arguments to be added to initrd= pxe config</li>
|
||||
<li><strong>images_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Path of directory with images to be used</li>
|
||||
<li><strong>live_image_name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Name of live rootfs image file</li>
|
||||
<li><strong>add_args</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.7)"><em>list</em></a>) – Arguments to be added to initrd= pxe config</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@ -401,13 +401,13 @@ this. Everything else should be a nop.</p>
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>phys_root</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Path to physical root</td>
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>phys_root</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Path to physical root</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Relative path of ostree deployment root</td>
|
||||
</tr>
|
||||
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)">str</a></td>
|
||||
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)">str</a></td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#Exception" title="(in Python v3.6)"><strong>Exception</strong></a> – More than one deployment roots were found</td>
|
||||
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/exceptions.html#Exception" title="(in Python v3.7)"><strong>Exception</strong></a> – More than one deployment roots were found</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -423,7 +423,7 @@ this. Everything else should be a nop.</p>
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Arch of first kernel found at mount_dir/boot/ or i386</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)">str</a></td>
|
||||
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)">str</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -439,7 +439,7 @@ this. Everything else should be a nop.</p>
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">True if disk_img is in /proc/mounts</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.6)">bool</a></td>
|
||||
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)">bool</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -454,17 +454,17 @@ this. Everything else should be a nop.</p>
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||
<li><strong>disk_img</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Full path of the disk image</li>
|
||||
<li><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Name of the appliance, passed to the template</li>
|
||||
<li><strong>template</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Full path of Mako template</li>
|
||||
<li><strong>outfile</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Full path of file to write, using template</li>
|
||||
<li><strong>networks</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.6)"><em>list</em></a>) – List of networks(str) from the kickstart</li>
|
||||
<li><strong>ram</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.6)"><em>int</em></a>) – Ram, in MiB, passed to template. Default is 1024</li>
|
||||
<li><strong>vcpus</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.6)"><em>int</em></a>) – CPUs, passed to template. Default is 1</li>
|
||||
<li><strong>arch</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – CPU architecture. Default is ‘x86_64’</li>
|
||||
<li><strong>title</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Title, passed to template. Default is ‘Linux’</li>
|
||||
<li><strong>project</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Project, passed to template. Default is ‘Linux’</li>
|
||||
<li><strong>releasever</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Release version, passed to template. Default is 29</li>
|
||||
<li><strong>disk_img</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Full path of the disk image</li>
|
||||
<li><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Name of the appliance, passed to the template</li>
|
||||
<li><strong>template</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Full path of Mako template</li>
|
||||
<li><strong>outfile</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Full path of file to write, using template</li>
|
||||
<li><strong>networks</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.7)"><em>list</em></a>) – List of networks(str) from the kickstart</li>
|
||||
<li><strong>ram</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) – Ram, in MiB, passed to template. Default is 1024</li>
|
||||
<li><strong>vcpus</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) – CPUs, passed to template. Default is 1</li>
|
||||
<li><strong>arch</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – CPU architecture. Default is ‘x86_64’</li>
|
||||
<li><strong>title</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Title, passed to template. Default is ‘Linux’</li>
|
||||
<li><strong>project</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Project, passed to template. Default is ‘Linux’</li>
|
||||
<li><strong>releasever</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Release version, passed to template. Default is 29</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@ -482,14 +482,14 @@ this. Everything else should be a nop.</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>opts</strong> (<em>argparse options</em>) – options passed to livemedia-creator</li>
|
||||
<li><strong>ks</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Path to the kickstart to use for the installation</li>
|
||||
<li><strong>ks</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Path to the kickstart to use for the installation</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Path of the image created</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)">str</a></p>
|
||||
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)">str</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -507,15 +507,15 @@ this. Everything else should be a nop.</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>opts</strong> (<em>argparse options</em>) – options passed to livemedia-creator</li>
|
||||
<li><strong>work_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Directory for storing results</li>
|
||||
<li><strong>disk_img</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Path to disk image (fsimage or partitioned)</li>
|
||||
<li><strong>work_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Directory for storing results</li>
|
||||
<li><strong>disk_img</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Path to disk image (fsimage or partitioned)</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Path of directory with created images or None</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)">str</a></p>
|
||||
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)">str</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -535,8 +535,8 @@ it will return None and log the error.</p>
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||
<li><strong>opts</strong> (<em>argparse options</em>) – options passed to livemedia-creator</li>
|
||||
<li><strong>mount_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Directory tree to compress</li>
|
||||
<li><strong>work_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Output compressed image to work_dir+images/install.img</li>
|
||||
<li><strong>mount_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Directory tree to compress</li>
|
||||
<li><strong>work_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Output compressed image to work_dir+images/install.img</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@ -564,9 +564,9 @@ root=live:CDLABEL=<volid> rd.live.image</li>
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||
<li><strong>opts</strong> (<em>argparse options</em>) – options passed to livemedia-creator</li>
|
||||
<li><strong>mount_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Directory tree to compress</li>
|
||||
<li><strong>work_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Output compressed image to work_dir+images/install.img</li>
|
||||
<li><strong>size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.6)"><em>int</em></a>) – Size of disk image, in GiB</li>
|
||||
<li><strong>mount_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Directory tree to compress</li>
|
||||
<li><strong>work_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Output compressed image to work_dir+images/install.img</li>
|
||||
<li><strong>size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) – Size of disk image, in GiB</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@ -583,16 +583,16 @@ root=live:CDLABEL=<volid> rd.live.image</li>
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||
<li><strong>disk_img</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Path to the unpartitioned filesystem disk image</li>
|
||||
<li><strong>work_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Output compressed image to work_dir+images/install.img</li>
|
||||
<li><strong>compression</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Compression type to use</li>
|
||||
<li><strong>disk_img</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Path to the unpartitioned filesystem disk image</li>
|
||||
<li><strong>work_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Output compressed image to work_dir+images/install.img</li>
|
||||
<li><strong>compression</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Compression type to use</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">True if squashfs creation was successful. False if there was an error.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.6)">bool</a></p>
|
||||
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)">bool</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -623,8 +623,8 @@ type img_mount: imgutils.PartitionMount</p>
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||
<li><strong>opts</strong> (<em>argparse options</em>) – options passed to livemedia-creator</li>
|
||||
<li><strong>sys_root_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Path to root of the system</li>
|
||||
<li><strong>results_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Path of directory for storing results</li>
|
||||
<li><strong>sys_root_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Path to root of the system</li>
|
||||
<li><strong>results_dir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Path of directory for storing results</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@ -665,7 +665,7 @@ See the cmdline –help for livemedia-creator for the possible options</p>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">tuple of compression type and args</td>
|
||||
</tr>
|
||||
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#tuple" title="(in Python v3.6)">tuple</a></td>
|
||||
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#tuple" title="(in Python v3.7)">tuple</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -685,7 +685,7 @@ See the cmdline –help for livemedia-creator for the possible options</p>
|
||||
<dl class="class">
|
||||
<dt id="pylorax.discinfo.DiscInfo">
|
||||
<em class="property">class </em><code class="descclassname">pylorax.discinfo.</code><code class="descname">DiscInfo</code><span class="sig-paren">(</span><em>release</em>, <em>basearch</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/discinfo.html#DiscInfo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.discinfo.DiscInfo" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dl class="method">
|
||||
<dt id="pylorax.discinfo.DiscInfo.write">
|
||||
<code class="descname">write</code><span class="sig-paren">(</span><em>outfile</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/discinfo.html#DiscInfo.write"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.discinfo.DiscInfo.write" title="Permalink to this definition">¶</a></dt>
|
||||
@ -739,7 +739,7 @@ See the cmdline –help for livemedia-creator for the possible options</p>
|
||||
<dl class="class">
|
||||
<dt id="pylorax.executils.ExecProduct">
|
||||
<em class="property">class </em><code class="descclassname">pylorax.executils.</code><code class="descname">ExecProduct</code><span class="sig-paren">(</span><em>rc</em>, <em>stdout</em>, <em>stderr</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/executils.html#ExecProduct"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.executils.ExecProduct" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
@ -872,8 +872,8 @@ variable name, the old value is overwritten.</p>
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||
<li><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – The name of the environment variable</li>
|
||||
<li><strong>value</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – The value of the environment variable</li>
|
||||
<li><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The name of the environment variable</li>
|
||||
<li><strong>value</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The value of the environment variable</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@ -921,25 +921,25 @@ last.</p>
|
||||
<dl class="class">
|
||||
<dt id="pylorax.imgutils.DMDev">
|
||||
<em class="property">class </em><code class="descclassname">pylorax.imgutils.</code><code class="descname">DMDev</code><span class="sig-paren">(</span><em>dev</em>, <em>size</em>, <em>name=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#DMDev"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.DMDev" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="class">
|
||||
<dt id="pylorax.imgutils.LoopDev">
|
||||
<em class="property">class </em><code class="descclassname">pylorax.imgutils.</code><code class="descname">LoopDev</code><span class="sig-paren">(</span><em>filename</em>, <em>size=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#LoopDev"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.LoopDev" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="class">
|
||||
<dt id="pylorax.imgutils.Mount">
|
||||
<em class="property">class </em><code class="descclassname">pylorax.imgutils.</code><code class="descname">Mount</code><span class="sig-paren">(</span><em>dev</em>, <em>opts=''</em>, <em>mnt=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#Mount"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.Mount" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="class">
|
||||
<dt id="pylorax.imgutils.PartitionMount">
|
||||
<em class="property">class </em><code class="descclassname">pylorax.imgutils.</code><code class="descname">PartitionMount</code><span class="sig-paren">(</span><em>disk_img</em>, <em>mount_ok=None</em>, <em>submount=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#PartitionMount"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.PartitionMount" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<p>Mount a partitioned image file using kpartx</p>
|
||||
</dd></dl>
|
||||
|
||||
@ -970,8 +970,8 @@ raises CalledProcessError if copy fails.</p>
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||
<li><strong>compression</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Compression type</li>
|
||||
<li><strong>basename</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Base filename</li>
|
||||
<li><strong>compression</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Compression type</li>
|
||||
<li><strong>basename</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Base filename</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@ -1020,8 +1020,11 @@ Raises RuntimeError if more than one loop is associated</p>
|
||||
<dl class="function">
|
||||
<dt id="pylorax.imgutils.loop_attach">
|
||||
<code class="descclassname">pylorax.imgutils.</code><code class="descname">loop_attach</code><span class="sig-paren">(</span><em>outfile</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/imgutils.html#loop_attach"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.imgutils.loop_attach" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Attach a loop device to the given file. Return the loop device name.
|
||||
Raises CalledProcessError if losetup fails.</p>
|
||||
<dd><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">
|
||||
@ -1081,11 +1084,11 @@ disk image.</p>
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||
<li><strong>diskimage</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – The full path to partitioned disk image with a /</li>
|
||||
<li><strong>fsimage</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – The full path of the output fs image file</li>
|
||||
<li><strong>img_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.6)"><em>int</em></a>) – Optional size of the fsimage in MiB or None to make
|
||||
<li><strong>diskimage</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The full path to partitioned disk image with a /</li>
|
||||
<li><strong>fsimage</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The full path of the output fs image file</li>
|
||||
<li><strong>img_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) – Optional size of the fsimage in MiB or None to make
|
||||
it as small as possible</li>
|
||||
<li><strong>label</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – The label to apply to the image. Defaults to “Anaconda”</li>
|
||||
<li><strong>label</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The label to apply to the image. Defaults to “Anaconda”</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@ -1125,11 +1128,11 @@ in options.</p>
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||
<li><strong>rootdir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Root directory</li>
|
||||
<li><strong>outfile</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Path of output image file</li>
|
||||
<li><strong>label</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Filesystem label</li>
|
||||
<li><strong>size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.6)"><em>int</em></a>) – Size of the image in GiB, if None computed automatically</li>
|
||||
<li><strong>sysroot</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – path to system (deployment) root relative to physical root</li>
|
||||
<li><strong>rootdir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Root directory</li>
|
||||
<li><strong>outfile</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Path of output image file</li>
|
||||
<li><strong>label</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Filesystem label</li>
|
||||
<li><strong>size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) – Size of the image in GiB, if None computed automatically</li>
|
||||
<li><strong>sysroot</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – path to system (deployment) root relative to physical root</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@ -1184,13 +1187,13 @@ raises CalledProcessError if umount fails.</p>
|
||||
<dl class="exception">
|
||||
<dt id="pylorax.installer.InstallError">
|
||||
<em class="property">exception </em><code class="descclassname">pylorax.installer.</code><code class="descname">InstallError</code><a class="reference internal" href="_modules/pylorax/installer.html#InstallError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.installer.InstallError" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/exceptions.html#Exception" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></a></p>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/exceptions.html#Exception" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></a></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="class">
|
||||
<dt id="pylorax.installer.QEMUInstall">
|
||||
<em class="property">class </em><code class="descclassname">pylorax.installer.</code><code class="descname">QEMUInstall</code><span class="sig-paren">(</span><em>opts</em>, <em>iso</em>, <em>ks_paths</em>, <em>disk_img</em>, <em>img_size=2048</em>, <em>kernel_args=None</em>, <em>memory=1024</em>, <em>vcpus=None</em>, <em>vnc=None</em>, <em>arch=None</em>, <em>log_check=None</em>, <em>virtio_host='127.0.0.1'</em>, <em>virtio_port=6080</em>, <em>image_type=None</em>, <em>boot_uefi=False</em>, <em>ovmf_path=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/installer.html#QEMUInstall"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.installer.QEMUInstall" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<p>Run qemu using an iso and a kickstart</p>
|
||||
<dl class="attribute">
|
||||
<dt id="pylorax.installer.QEMUInstall.QEMU_CMDS">
|
||||
@ -1207,7 +1210,7 @@ raises CalledProcessError if umount fails.</p>
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>dirinstall_path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Path where anaconda mounts things</td>
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>dirinstall_path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Path where anaconda mounts things</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">True if cleanups were successful. False if any of them failed.</td>
|
||||
</tr>
|
||||
@ -1228,15 +1231,15 @@ other mountpoints.</p>
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||
<li><strong>initrd</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Path to initrd</li>
|
||||
<li><strong>files</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.6)"><em>list</em></a>) – list of file paths to add</li>
|
||||
<li><strong>initrd</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Path to initrd</li>
|
||||
<li><strong>files</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.7)"><em>list</em></a>) – list of file paths to add</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Path to a new initrd</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)">str</a></p>
|
||||
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)">str</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -1257,8 +1260,8 @@ cpio archive.</p>
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||
<li><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Path to metadata.json file</li>
|
||||
<li><strong>size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.6)"><em>int</em></a>) – Disk size in MiB</li>
|
||||
<li><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Path to metadata.json file</li>
|
||||
<li><strong>size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) – Disk size in MiB</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@ -1275,16 +1278,16 @@ cpio archive.</p>
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||
<li><strong>start</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.6)"><em>int</em></a>) – Starting port number</li>
|
||||
<li><strong>end</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.6)"><em>int</em></a>) – Ending port number</li>
|
||||
<li><strong>host</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Host IP to search</li>
|
||||
<li><strong>start</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) – Starting port number</li>
|
||||
<li><strong>end</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) – Ending port number</li>
|
||||
<li><strong>host</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Host IP to search</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">First free port or -1 if none found</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.6)">int</a></p>
|
||||
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)">int</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -1301,8 +1304,8 @@ cpio archive.</p>
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||
<li><strong>opts</strong> (<em>argparse options</em>) – options passed to livemedia-creator</li>
|
||||
<li><strong>disk_img</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – The full path to the disk image to be created</li>
|
||||
<li><strong>disk_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.6)"><em>int</em></a>) – The size of the disk_img in MiB</li>
|
||||
<li><strong>disk_img</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The full path to the disk image to be created</li>
|
||||
<li><strong>disk_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) – The size of the disk_img in MiB</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@ -1344,8 +1347,8 @@ When an error is detected the process is terminated and this returns True</p>
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||
<li><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Path to metadata.json file</li>
|
||||
<li><strong>size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.6)"><em>int</em></a>) – Disk size in MiB</li>
|
||||
<li><strong>path</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Path to metadata.json file</li>
|
||||
<li><strong>size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) – Disk size in MiB</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@ -1365,9 +1368,9 @@ metadata file are set correctly. All other values are left untouched.</p>
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||
<li><strong>opts</strong> (<em>argparse options</em>) – options passed to livemedia-creator</li>
|
||||
<li><strong>install_log</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – The path to write the log from qemu</li>
|
||||
<li><strong>disk_img</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – The full path to the disk image to be created</li>
|
||||
<li><strong>disk_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.6)"><em>int</em></a>) – The size of the disk_img in MiB</li>
|
||||
<li><strong>install_log</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The path to write the log from qemu</li>
|
||||
<li><strong>disk_img</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – The full path to the disk image to be created</li>
|
||||
<li><strong>disk_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.7)"><em>int</em></a>) – The size of the disk_img in MiB</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@ -1383,7 +1386,7 @@ image and then optionally, based on the opts passed, creates tarfile.</p>
|
||||
<dl class="class">
|
||||
<dt id="pylorax.ltmpl.LoraxTemplate">
|
||||
<em class="property">class </em><code class="descclassname">pylorax.ltmpl.</code><code class="descname">LoraxTemplate</code><span class="sig-paren">(</span><em>directories=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplate" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dl class="method">
|
||||
<dt id="pylorax.ltmpl.LoraxTemplate.parse">
|
||||
<code class="descname">parse</code><span class="sig-paren">(</span><em>template_file</em>, <em>variables</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplate.parse"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplate.parse" title="Permalink to this definition">¶</a></dt>
|
||||
@ -1394,7 +1397,7 @@ image and then optionally, based on the opts passed, creates tarfile.</p>
|
||||
<dl class="class">
|
||||
<dt id="pylorax.ltmpl.LoraxTemplateRunner">
|
||||
<em class="property">class </em><code class="descclassname">pylorax.ltmpl.</code><code class="descname">LoraxTemplateRunner</code><span class="sig-paren">(</span><em>inroot</em>, <em>outroot</em>, <em>dbo=None</em>, <em>fatalerrors=True</em>, <em>templatedir=None</em>, <em>defaults=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/ltmpl.html#LoraxTemplateRunner"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.ltmpl.LoraxTemplateRunner" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<p>This class parses and executes Lorax templates. Sample usage:</p>
|
||||
<blockquote>
|
||||
<div><p># install a bunch of packages
|
||||
@ -1799,8 +1802,8 @@ Example:</p>
|
||||
<span id="pylorax-monitor-module"></span><h2>pylorax.monitor module<a class="headerlink" href="#module-pylorax.monitor" title="Permalink to this headline">¶</a></h2>
|
||||
<dl class="class">
|
||||
<dt id="pylorax.monitor.LogMonitor">
|
||||
<em class="property">class </em><code class="descclassname">pylorax.monitor.</code><code class="descname">LogMonitor</code><span class="sig-paren">(</span><em>log_path=None</em>, <em>host='localhost'</em>, <em>port=0</em>, <em>timeout=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/monitor.html#LogMonitor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.monitor.LogMonitor" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<em class="property">class </em><code class="descclassname">pylorax.monitor.</code><code class="descname">LogMonitor</code><span class="sig-paren">(</span><em>log_path=None</em>, <em>host='localhost'</em>, <em>port=0</em>, <em>timeout=None</em>, <em>log_request_handler_class=<class 'pylorax.monitor.LogRequestHandler'></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/monitor.html#LogMonitor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.monitor.LogMonitor" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<p>Setup a server to monitor the logs output by the installation</p>
|
||||
<p>This needs to be running before the virt-install runs, it expects
|
||||
there to be a listener on the port used for the virtio log port.</p>
|
||||
@ -1815,7 +1818,7 @@ there to be a listener on the port used for the virtio log port.</p>
|
||||
<dl class="class">
|
||||
<dt id="pylorax.monitor.LogRequestHandler">
|
||||
<em class="property">class </em><code class="descclassname">pylorax.monitor.</code><code class="descname">LogRequestHandler</code><span class="sig-paren">(</span><em>request</em>, <em>client_address</em>, <em>server</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/monitor.html#LogRequestHandler"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.monitor.LogRequestHandler" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/socketserver.html#socketserver.BaseRequestHandler" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">socketserver.BaseRequestHandler</span></code></a></p>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/socketserver.html#socketserver.BaseRequestHandler" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">socketserver.BaseRequestHandler</span></code></a></p>
|
||||
<p>Handle monitoring and saving the logfiles from the virtual install</p>
|
||||
<p>Incoming data is written to self.server.log_path and each line is checked
|
||||
for patterns that would indicate that the installation failed.
|
||||
@ -1842,25 +1845,35 @@ errors that indicate that the install failed.</p>
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>line</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – log line to check for failure</td>
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>line</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – log line to check for failure</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>If the line contains IGNORED it will be skipped.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
<dt id="pylorax.monitor.LogRequestHandler.re_tests">
|
||||
<code class="descname">re_tests</code><em class="property"> = ['packaging: base repo .* not valid', 'packaging: .* requires .*']</em><a class="headerlink" href="#pylorax.monitor.LogRequestHandler.re_tests" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="pylorax.monitor.LogRequestHandler.setup">
|
||||
<code class="descname">setup</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/monitor.html#LogRequestHandler.setup"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.monitor.LogRequestHandler.setup" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Start writing to self.server.log_path</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
<dt id="pylorax.monitor.LogRequestHandler.simple_tests">
|
||||
<code class="descname">simple_tests</code><em class="property"> = ['Traceback (', 'traceback script(s) have been run', 'Out of memory:', 'Call Trace:', 'insufficient disk space:', 'Not enough disk space to download the packages', 'error populating transaction after', 'crashed on signal', 'packaging: Missed: NoSuchPackage', 'packaging: Installation failed', 'The following error occurred while installing. This is a fatal error']</em><a class="headerlink" href="#pylorax.monitor.LogRequestHandler.simple_tests" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
||||
<dl class="class">
|
||||
<dt id="pylorax.monitor.LogServer">
|
||||
<em class="property">class </em><code class="descclassname">pylorax.monitor.</code><code class="descname">LogServer</code><span class="sig-paren">(</span><em>log_path</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/monitor.html#LogServer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.monitor.LogServer" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/socketserver.html#socketserver.TCPServer" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">socketserver.TCPServer</span></code></a></p>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/socketserver.html#socketserver.TCPServer" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">socketserver.TCPServer</span></code></a></p>
|
||||
<p>A TCP Server that listens for log data</p>
|
||||
<dl class="method">
|
||||
<dt id="pylorax.monitor.LogServer.log_check">
|
||||
@ -1872,7 +1885,7 @@ errors that indicate that the install failed.</p>
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">True if there has been an error</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.6)">bool</a></td>
|
||||
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.7)">bool</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -1891,7 +1904,7 @@ errors that indicate that the install failed.</p>
|
||||
<dl class="class">
|
||||
<dt id="pylorax.mount.IsoMountpoint">
|
||||
<em class="property">class </em><code class="descclassname">pylorax.mount.</code><code class="descname">IsoMountpoint</code><span class="sig-paren">(</span><em>iso_path</em>, <em>initrd_path=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/mount.html#IsoMountpoint"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.mount.IsoMountpoint" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<p>Mount the iso and check to make sure the vmlinuz and initrd.img files exist</p>
|
||||
<p>Also check the iso for a a stage2 image and set a flag and extract the
|
||||
iso’s label.</p>
|
||||
@ -1958,7 +1971,7 @@ iso’s label.</p>
|
||||
<dl class="class">
|
||||
<dt id="pylorax.treebuilder.RuntimeBuilder">
|
||||
<em class="property">class </em><code class="descclassname">pylorax.treebuilder.</code><code class="descname">RuntimeBuilder</code><span class="sig-paren">(</span><em>product</em>, <em>arch</em>, <em>dbo</em>, <em>templatedir=None</em>, <em>installpkgs=None</em>, <em>excludepkgs=None</em>, <em>add_templates=None</em>, <em>add_template_vars=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#RuntimeBuilder"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.RuntimeBuilder" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<p>Builds the anaconda runtime image.</p>
|
||||
<dl class="method">
|
||||
<dt id="pylorax.treebuilder.RuntimeBuilder.cleanup">
|
||||
@ -2018,7 +2031,7 @@ iso’s label.</p>
|
||||
<dl class="class">
|
||||
<dt id="pylorax.treebuilder.TreeBuilder">
|
||||
<em class="property">class </em><code class="descclassname">pylorax.treebuilder.</code><code class="descname">TreeBuilder</code><span class="sig-paren">(</span><em>product</em>, <em>arch</em>, <em>inroot</em>, <em>outroot</em>, <em>runtime</em>, <em>isolabel</em>, <em>domacboot=True</em>, <em>doupgrade=True</em>, <em>templatedir=None</em>, <em>add_templates=None</em>, <em>add_template_vars=None</em>, <em>workdir=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treebuilder.html#TreeBuilder"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treebuilder.TreeBuilder" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<p>Builds the arch-specific boot images.
|
||||
inroot should be the installtree root (the newly-built runtime dir)</p>
|
||||
<dl class="method">
|
||||
@ -2105,7 +2118,7 @@ name of the kernel.</p>
|
||||
<dl class="class">
|
||||
<dt id="pylorax.treeinfo.TreeInfo">
|
||||
<em class="property">class </em><code class="descclassname">pylorax.treeinfo.</code><code class="descname">TreeInfo</code><span class="sig-paren">(</span><em>product</em>, <em>version</em>, <em>variant</em>, <em>basearch</em>, <em>packagedir=''</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treeinfo.html#TreeInfo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treeinfo.TreeInfo" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.6)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
|
||||
<dl class="method">
|
||||
<dt id="pylorax.treeinfo.TreeInfo.add_section">
|
||||
<code class="descname">add_section</code><span class="sig-paren">(</span><em>section</em>, <em>data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pylorax/treeinfo.html#TreeInfo.add_section"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.treeinfo.TreeInfo.add_section" title="Permalink to this definition">¶</a></dt>
|
||||
@ -2179,11 +2192,11 @@ Otherwise use the sharedir</p>
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>templatedir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – Top directory to search for templates</td>
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>templatedir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)"><em>str</em></a>) – Top directory to search for templates</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Path to templates</td>
|
||||
</tr>
|
||||
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)">str</a></td>
|
||||
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.7)">str</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -2207,7 +2220,7 @@ lowest numbered directory entry is returned.</p>
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||
<li><strong>logfile</strong> (<em>string</em>) – filename to write the log to</li>
|
||||
<li><strong>theLogger</strong> (<a class="reference external" href="https://docs.python.org/3/library/logging.html#logging.Logger" title="(in Python v3.6)"><em>logging.Logger</em></a>) – top-level logger</li>
|
||||
<li><strong>theLogger</strong> (<a class="reference external" href="https://docs.python.org/3/library/logging.html#logging.Logger" title="(in Python v3.7)"><em>logging.Logger</em></a>) – top-level logger</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@ -2260,7 +2273,7 @@ lowest numbered directory entry is returned.</p>
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'./',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>Search — Lorax 28.14 documentation</title>
|
||||
<title>Search — Lorax 28.17 documentation</title>
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
|
||||
<div class="version">
|
||||
28.14
|
||||
28.17
|
||||
</div>
|
||||
|
||||
|
||||
@ -198,7 +198,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT:'./',
|
||||
VERSION:'28.14',
|
||||
VERSION:'28.17',
|
||||
LANGUAGE:'None',
|
||||
COLLAPSE_INDEX:false,
|
||||
FILE_SUFFIX:'.html',
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user