<h1>api Package<aclass="headerlink"href="#api-package"title="Permalink to this headline">¶</a></h1>
<divclass="section"id="id1">
<h2><ttclass="xref py py-mod docutils literal"><spanclass="pre">api</span></tt> Package<aclass="headerlink"href="#id1"title="Permalink to this headline">¶</a></h2>
<ttclass="descclassname">pylorax.api.</tt><ttclass="descname">crossdomain</tt><big>(</big><em>origin</em>, <em>methods=None</em>, <em>headers=None</em>, <em>max_age=21600</em>, <em>attach_to_all=True</em>, <em>automatic_options=True</em><big>)</big><aclass="headerlink"href="#pylorax.api.crossdomain"title="Permalink to this definition">¶</a></dt>
<spanid="compose-module"></span><h2><ttclass="xref py py-mod docutils literal"><spanclass="pre">compose</span></tt> Module<aclass="headerlink"href="#module-pylorax.api.compose"title="Permalink to this headline">¶</a></h2>
<p>Setup for composing an image</p>
<divclass="section"id="adding-new-output-types">
<h3>Adding New Output Types<aclass="headerlink"href="#adding-new-output-types"title="Permalink to this headline">¶</a></h3>
<p>The new output type must add a kickstart template to ./share/composer/ where the
name of the kickstart (without the trailing .ks) matches the entry in compose_args.</p>
<p>The kickstart should not have any url or repo entries, these will be added at build
time. The %packages section should be the last thing, and while it can contain mandatory
packages required by the output type, it should not have the trailing %end because the
package NEVRAs will be appended to it at build time.</p>
<p>compose_args should have a name matching the kickstart, and it should set the novirt_install
parameters needed to generate the desired output. Other types should be set to False.</p>
<dlclass="function">
<dtid="pylorax.api.compose.compose_args">
<ttclass="descclassname">pylorax.api.compose.</tt><ttclass="descname">compose_args</tt><big>(</big><em>compose_type</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/compose.html#compose_args"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.compose.compose_args"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the settings to pass to novirt_install for the compose type</p>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><strong>compose_type</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The type of compose to create, from <cite>compose_types()</cite></td>
</tr>
</tbody>
</table>
<p>This will return a dict of options that match the ArgumentParser options for livemedia-creator.
These are the ones the define the type of output, it’s filename, etc.
Other options will be filled in by <cite>make_compose()</cite></p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.compose.compose_types">
<ttclass="descclassname">pylorax.api.compose.</tt><ttclass="descname">compose_types</tt><big>(</big><em>share_dir</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/compose.html#compose_types"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.compose.compose_types"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a list of the supported output types</p>
<ttclass="descclassname">pylorax.api.compose.</tt><ttclass="descname">move_compose_results</tt><big>(</big><em>cfg</em>, <em>results_dir</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/compose.html#move_compose_results"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.compose.move_compose_results"title="Permalink to this definition">¶</a></dt>
<dd><p>Move the final image to the results_dir and cleanup the unneeded compose files</p>
<li><strong>results_dir</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – Directory to put the results into</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.compose.repo_to_ks">
<ttclass="descclassname">pylorax.api.compose.</tt><ttclass="descname">repo_to_ks</tt><big>(</big><em>r</em>, <em>url='url'</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/compose.html#repo_to_ks"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.compose.repo_to_ks"title="Permalink to this definition">¶</a></dt>
<dd><p>Return a kickstart line with the correct args.</p>
<p>Set url to “baseurl” if it is a repo, leave it as “url” for the installation url.</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.compose.start_build">
<ttclass="descclassname">pylorax.api.compose.</tt><ttclass="descname">start_build</tt><big>(</big><em>cfg</em>, <em>yumlock</em>, <em>gitlock</em>, <em>branch</em>, <em>recipe_name</em>, <em>compose_type</em>, <em>test_mode=0</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/compose.html#start_build"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.compose.start_build"title="Permalink to this definition">¶</a></dt>
<li><strong>yumlock</strong> (<em>YumLock</em>) – Lock and YumBase for depsolving</li>
<li><strong>recipe</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The recipe to build</li>
<li><strong>compose_type</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The type of output to create from the recipe</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">Unique ID for the build that can be used to track its status</p>
<spanid="config-module"></span><h2><ttclass="xref py py-mod docutils literal"><spanclass="pre">config</span></tt> Module<aclass="headerlink"href="#module-pylorax.api.config"title="Permalink to this headline">¶</a></h2>
<dlclass="class">
<dtid="pylorax.api.config.ComposerConfig">
<emclass="property">class </em><ttclass="descclassname">pylorax.api.config.</tt><ttclass="descname">ComposerConfig</tt><big>(</big><em>defaults=None</em>, <em>dict_type=<class 'collections.OrderedDict'></em>, <em>allow_no_value=False</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/config.html#ComposerConfig"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.config.ComposerConfig"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">get_default</tt><big>(</big><em>section</em>, <em>option</em>, <em>default</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/config.html#ComposerConfig.get_default"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.config.ComposerConfig.get_default"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.config.configure">
<ttclass="descclassname">pylorax.api.config.</tt><ttclass="descname">configure</tt><big>(</big><em>conf_file='/etc/lorax/composer.conf'</em>, <em>root_dir='/'</em>, <em>test_config=False</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/config.html#configure"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.config.configure"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><ulclass="first last simple">
<li><strong>conf_file</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – Path to the config file overriding the default settings</li>
<li><strong>root_dir</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – Directory to prepend to paths, defaults to /</li>
<li><strong>test_config</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#bool"title="(in Python v2.7)"><em>bool</em></a>) – Set to True to skip reading conf_file</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.config.make_queue_dirs">
<ttclass="descclassname">pylorax.api.config.</tt><ttclass="descname">make_queue_dirs</tt><big>(</big><em>conf</em>, <em>gid</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/config.html#make_queue_dirs"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.config.make_queue_dirs"title="Permalink to this definition">¶</a></dt>
<li><strong>conf</strong> (<em>ComposerConfig</em>) – The configuration to use</li>
<li><strong>gid</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#int"title="(in Python v2.7)"><em>int</em></a>) – Group ID that has access to the queue directories</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">list of errors</p>
</td>
</tr>
<trclass="field-odd field"><thclass="field-name">Return type:</th><tdclass="field-body"><pclass="first last">list of str</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.config.make_yum_dirs">
<ttclass="descclassname">pylorax.api.config.</tt><ttclass="descname">make_yum_dirs</tt><big>(</big><em>conf</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/config.html#make_yum_dirs"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.config.make_yum_dirs"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><strong>conf</strong> (<em>ComposerConfig</em>) – The configuration to use</td>
<spanid="crossdomain-module"></span><h2><ttclass="xref py py-mod docutils literal"><spanclass="pre">crossdomain</span></tt> Module<aclass="headerlink"href="#module-pylorax.api.crossdomain"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="pylorax.api.crossdomain.crossdomain">
<ttclass="descclassname">pylorax.api.crossdomain.</tt><ttclass="descname">crossdomain</tt><big>(</big><em>origin</em>, <em>methods=None</em>, <em>headers=None</em>, <em>max_age=21600</em>, <em>attach_to_all=True</em>, <em>automatic_options=True</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/crossdomain.html#crossdomain"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.crossdomain.crossdomain"title="Permalink to this definition">¶</a></dt>
<spanid="projects-module"></span><h2><ttclass="xref py py-mod docutils literal"><spanclass="pre">projects</span></tt> Module<aclass="headerlink"href="#module-pylorax.api.projects"title="Permalink to this headline">¶</a></h2>
<dlclass="exception">
<dtid="pylorax.api.projects.ProjectsError">
<emclass="property">exception </em><ttclass="descclassname">pylorax.api.projects.</tt><ttclass="descname">ProjectsError</tt><aclass="reference internal"href="_modules/pylorax/api/projects.html#ProjectsError"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.projects.ProjectsError"title="Permalink to this definition">¶</a></dt>
<ttclass="descclassname">pylorax.api.projects.</tt><ttclass="descname">api_changelog</tt><big>(</big><em>changelog</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/projects.html#api_changelog"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.projects.api_changelog"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><strong>changelog</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#tuple"title="(in Python v2.7)"><em>tuple</em></a>) – A list of time, author, string tuples.</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body">The most recent changelog text or “”</td>
<p>This returns only the most recent changelog entry.</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.projects.api_time">
<ttclass="descclassname">pylorax.api.projects.</tt><ttclass="descname">api_time</tt><big>(</big><em>t</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/projects.html#api_time"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.projects.api_time"title="Permalink to this definition">¶</a></dt>
<ttclass="descclassname">pylorax.api.projects.</tt><ttclass="descname">dep_evra</tt><big>(</big><em>dep</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/projects.html#dep_evra"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.projects.dep_evra"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the epoch:version-release.arch for the dep</p>
<ttclass="descclassname">pylorax.api.projects.</tt><ttclass="descname">dep_nevra</tt><big>(</big><em>dep</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/projects.html#dep_nevra"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.projects.dep_nevra"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the name-epoch:version-release.arch</p>
<ttclass="descclassname">pylorax.api.projects.</tt><ttclass="descname">estimate_size</tt><big>(</big><em>packages</em>, <em>block_size=4096</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/projects.html#estimate_size"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.projects.estimate_size"title="Permalink to this definition">¶</a></dt>
<dd><p>Estimate the installed size of a package list</p>
<li><strong>packages</strong> (<em>list of TransactionMember objects</em>) – The packages to be installed</li>
<li><strong>block_size</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#int"title="(in Python v2.7)"><em>int</em></a>) – The block size to use for rounding up file sizes.</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">The estimated size of installed packages</p>
<ttclass="descclassname">pylorax.api.projects.</tt><ttclass="descname">modules_info</tt><big>(</big><em>yb</em>, <em>module_names</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/projects.html#modules_info"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.projects.modules_info"title="Permalink to this definition">¶</a></dt>
<dd><p>Return details about a module, including dependencies</p>
<li><strong>yb</strong> (<em>YumBase</em>) – yum base object</li>
<li><strong>module_names</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – Names of the modules to get info about</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">List of dicts with module details and dependencies.</p>
</td>
</tr>
<trclass="field-odd field"><thclass="field-name">Return type:</th><tdclass="field-body"><pclass="first last">list of dicts</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.projects.modules_list">
<ttclass="descclassname">pylorax.api.projects.</tt><ttclass="descname">modules_list</tt><big>(</big><em>yb</em>, <em>module_names</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/projects.html#modules_list"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.projects.modules_list"title="Permalink to this definition">¶</a></dt>
<li><strong>yb</strong> (<em>YumBase</em>) – yum base object</li>
<li><strong>offset</strong>– Number of modules to skip</li>
<li><strong>limit</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#int"title="(in Python v2.7)"><em>int</em></a>) – Maximum number of modules to return</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">List of module information and total count</p>
</td>
</tr>
<trclass="field-odd field"><thclass="field-name">Return type:</th><tdclass="field-body"><pclass="first last">tuple of a list of dicts and an Int</p>
</td>
</tr>
</tbody>
</table>
<p>Modules don’t exist in RHEL7 so this only returns projects
and sets the type to “rpm”</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.projects.projects_depsolve">
<ttclass="descclassname">pylorax.api.projects.</tt><ttclass="descname">projects_depsolve</tt><big>(</big><em>yb</em>, <em>project_names</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/projects.html#projects_depsolve"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.projects.projects_depsolve"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the dependencies for a list of projects</p>
<li><strong>yb</strong> (<em>YumBase</em>) – yum base object</li>
<li><strong>project_names</strong> (<em>List of Strings</em>) – The projects to find the dependencies for</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">NEVRA’s of the project and its dependencies</p>
</td>
</tr>
<trclass="field-odd field"><thclass="field-name">Return type:</th><tdclass="field-body"><pclass="first last">list of dicts</p>
<ttclass="descclassname">pylorax.api.projects.</tt><ttclass="descname">projects_depsolve_with_size</tt><big>(</big><em>yb</em>, <em>project_names</em>, <em>with_core=True</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/projects.html#projects_depsolve_with_size"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.projects.projects_depsolve_with_size"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the dependencies and installed size for a list of projects</p>
<li><strong>yb</strong> (<em>YumBase</em>) – yum base object</li>
<li><strong>project_names</strong> (<em>List of Strings</em>) – The projects to find the dependencies for</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">installed size and a list of NEVRA’s of the project and its dependencies</p>
</td>
</tr>
<trclass="field-odd field"><thclass="field-name">Return type:</th><tdclass="field-body"><pclass="first last">tuple of (int, list of dicts)</p>
<ttclass="descclassname">pylorax.api.projects.</tt><ttclass="descname">projects_info</tt><big>(</big><em>yb</em>, <em>project_names</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/projects.html#projects_info"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.projects.projects_info"title="Permalink to this definition">¶</a></dt>
<li><strong>yb</strong> (<em>YumBase</em>) – yum base object</li>
<li><strong>project_names</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – List of names of projects to get info about</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">List of project info dicts with yaps_to_project as well as epoch, version, release, etc.</p>
</td>
</tr>
<trclass="field-odd field"><thclass="field-name">Return type:</th><tdclass="field-body"><pclass="first last">list of dicts</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.projects.projects_list">
<ttclass="descclassname">pylorax.api.projects.</tt><ttclass="descname">projects_list</tt><big>(</big><em>yb</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/projects.html#projects_list"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.projects.projects_list"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><strong>yb</strong> (<em>YumBase</em>) – yum base object</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body">List of project info dicts with name, summary, description, homepage, upstream_vcs</td>
</tr>
<trclass="field-odd field"><thclass="field-name">Return type:</th><tdclass="field-body">list of dicts</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.projects.tm_to_dep">
<ttclass="descclassname">pylorax.api.projects.</tt><ttclass="descname">tm_to_dep</tt><big>(</big><em>tm</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/projects.html#tm_to_dep"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.projects.tm_to_dep"title="Permalink to this definition">¶</a></dt>
<dd><p>Extract the info from a TransactionMember object</p>
<ttclass="descclassname">pylorax.api.projects.</tt><ttclass="descname">yaps_to_module</tt><big>(</big><em>yaps</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/projects.html#yaps_to_module"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.projects.yaps_to_module"title="Permalink to this definition">¶</a></dt>
<dd><p>Extract the name from a YumAvailablePackageSqlite object</p>
<p>group_type is hard-coded to “rpm”</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.projects.yaps_to_project">
<ttclass="descclassname">pylorax.api.projects.</tt><ttclass="descname">yaps_to_project</tt><big>(</big><em>yaps</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/projects.html#yaps_to_project"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.projects.yaps_to_project"title="Permalink to this definition">¶</a></dt>
<dd><p>Extract the details from a YumAvailablePackageSqlite object</p>
<ttclass="descclassname">pylorax.api.projects.</tt><ttclass="descname">yaps_to_project_info</tt><big>(</big><em>yaps</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/projects.html#yaps_to_project_info"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.projects.yaps_to_project_info"title="Permalink to this definition">¶</a></dt>
<dd><p>Extract the details from a YumAvailablePackageSqlite object</p>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><strong>yaps</strong> (<em>YumAvailablePackageSqlite</em>) – Yum object with package details</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body">A dict with the project details, as well as epoch, release, arch, build_time, changelog, ...</td>
<spanid="queue-module"></span><h2><ttclass="xref py py-mod docutils literal"><spanclass="pre">queue</span></tt> Module<aclass="headerlink"href="#module-pylorax.api.queue"title="Permalink to this headline">¶</a></h2>
<p>Functions to monitor compose queue and run anaconda</p>
<dlclass="function">
<dtid="pylorax.api.queue.build_status">
<ttclass="descclassname">pylorax.api.queue.</tt><ttclass="descname">build_status</tt><big>(</big><em>cfg</em>, <em>status_filter=None</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/queue.html#build_status"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.queue.build_status"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the details of finished or failed builds</p>
<li><strong>status_filter</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – What builds to return. None == all, “FINISHED”, or “FAILED”</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">A list of the build details (from compose_details)</p>
</td>
</tr>
<trclass="field-odd field"><thclass="field-name">Return type:</th><tdclass="field-body"><pclass="first last">list of dicts</p>
</td>
</tr>
</tbody>
</table>
<p>This returns a list of build details for each of the matching builds on the
system. It does not return the status of builds that have not been finished.
Use queue_status() for those.</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.queue.compose_detail">
<ttclass="descclassname">pylorax.api.queue.</tt><ttclass="descname">compose_detail</tt><big>(</big><em>results_dir</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/queue.html#compose_detail"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.queue.compose_detail"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><strong>results_dir</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The directory containing the metadata and results for the build</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body">A dictionary with details about the compose</td>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body">IOError if it cannot read the directory, STATUS, or blueprint file.</td>
<ttclass="descclassname">pylorax.api.queue.</tt><ttclass="descname">get_compose_type</tt><big>(</big><em>results_dir</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/queue.html#get_compose_type"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.queue.get_compose_type"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><strong>results_dir</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The directory containing the metadata and results for the build</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body">The type of compose (eg. ‘tar’)</td>
<ttclass="descclassname">pylorax.api.queue.</tt><ttclass="descname">get_image_name</tt><big>(</big><em>uuid_dir</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/queue.html#get_image_name"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.queue.get_image_name"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the filename and full path of the build’s image file</p>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><strong>uuid</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The UUID of the build</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body">The image filename and full path</td>
</tr>
<trclass="field-odd field"><thclass="field-name">Return type:</th><tdclass="field-body">tuple of strings</td>
</tr>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body">RuntimeError if there was a problem (eg. invalid uuid, missing config file)</td>
<ttclass="descclassname">pylorax.api.queue.</tt><ttclass="descname">make_compose</tt><big>(</big><em>cfg</em>, <em>results_dir</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/queue.html#make_compose"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.queue.make_compose"title="Permalink to this definition">¶</a></dt>
<dd><p>Run anaconda with the final-kickstart.ks from results_dir</p>
<li><strong>results_dir</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The directory containing the metadata and results for the build</li>
<trclass="field-odd field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">May raise various exceptions</p>
</td>
</tr>
</tbody>
</table>
<p>This takes the final-kickstart.ks, and the settings in config.toml and runs Anaconda
in no-virt mode (directly on the host operating system). Exceptions should be caught
at the higer level.</p>
<p>If there is a failure, the build artifacts will be cleaned up, and any logs will be
moved into logs/anaconda/ and their ownership will be set to the user from the cfg
object.</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.queue.monitor">
<ttclass="descclassname">pylorax.api.queue.</tt><ttclass="descname">monitor</tt><big>(</big><em>cfg</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/queue.html#monitor"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.queue.monitor"title="Permalink to this definition">¶</a></dt>
<dd><p>Monitor the queue for new compose requests</p>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body">Does not return</td>
</tr>
</tbody>
</table>
<p>The queue has 2 subdirectories, new and run. When a compose is ready to be run
a symlink to the uniquely named results directory should be placed in ./queue/new/</p>
<p>When the it is ready to be run (it is checked every 30 seconds or after a previous
compose is finished) the symlink will be moved into ./queue/run/ and a STATUS file
will be created in the results directory.</p>
<p>STATUS can contain one of: RUNNING, FINISHED, FAILED</p>
<p>If the system is restarted while a compose is running it will move any old symlinks
from ./queue/run/ to ./queue/new/ and rerun them.</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.queue.queue_status">
<ttclass="descclassname">pylorax.api.queue.</tt><ttclass="descname">queue_status</tt><big>(</big><em>cfg</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/queue.html#queue_status"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.queue.queue_status"title="Permalink to this definition">¶</a></dt>
<dd><p>Return details about what is in the queue.</p>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body">A list of the new composes, and a list of the running composes</td>
<p>This returns a dict with 2 lists. “new” is the list of uuids that are waiting to be built,
and “run” has the uuids that are being built (currently limited to 1 at a time).</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.queue.start_queue_monitor">
<ttclass="descclassname">pylorax.api.queue.</tt><ttclass="descname">start_queue_monitor</tt><big>(</big><em>cfg</em>, <em>uid</em>, <em>gid</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/queue.html#start_queue_monitor"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.queue.start_queue_monitor"title="Permalink to this definition">¶</a></dt>
<dd><p>Start the queue monitor as a mp process</p>
<li><strong>uid</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#int"title="(in Python v2.7)"><em>int</em></a>) – User ID that owns the queue</li>
<li><strong>gid</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#int"title="(in Python v2.7)"><em>int</em></a>) – Group ID that owns the queue</li>
<ttclass="descclassname">pylorax.api.queue.</tt><ttclass="descname">uuid_cancel</tt><big>(</big><em>cfg</em>, <em>uuid</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/queue.html#uuid_cancel"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.queue.uuid_cancel"title="Permalink to this definition">¶</a></dt>
<li><strong>uuid</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The UUID of the build</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">True if it was canceled and deleted</p>
<p>Only call this if the build status is WAITING or RUNNING</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.queue.uuid_delete">
<ttclass="descclassname">pylorax.api.queue.</tt><ttclass="descname">uuid_delete</tt><big>(</big><em>cfg</em>, <em>uuid</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/queue.html#uuid_delete"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.queue.uuid_delete"title="Permalink to this definition">¶</a></dt>
<dd><p>Delete all of the results from a compose</p>
<li><strong>uuid</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The UUID of the build</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">True if it was deleted</p>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">This will raise an error if the delete failed</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.queue.uuid_image">
<ttclass="descclassname">pylorax.api.queue.</tt><ttclass="descname">uuid_image</tt><big>(</big><em>cfg</em>, <em>uuid</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/queue.html#uuid_image"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.queue.uuid_image"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the filename and full path of the build’s image file</p>
<li><strong>uuid</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The UUID of the build</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">The image filename and full path</p>
</td>
</tr>
<trclass="field-odd field"><thclass="field-name">Return type:</th><tdclass="field-body"><pclass="first">tuple of strings</p>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">RuntimeError if there was a problem (eg. invalid uuid, missing config file)</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.queue.uuid_info">
<ttclass="descclassname">pylorax.api.queue.</tt><ttclass="descname">uuid_info</tt><big>(</big><em>cfg</em>, <em>uuid</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/queue.html#uuid_info"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.queue.uuid_info"title="Permalink to this definition">¶</a></dt>
<dd><p>Return information about the composition</p>
<li><strong>uuid</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The UUID of the build</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">dictionary of information about the composition</p>
<li>deps - The NEVRA of all of the dependencies used in the composition</li>
<li>compose_type - The type of output generated (tar, iso, etc.)</li>
<li>queue_status - The final status of the composition (FINISHED or FAILED)</li>
</ul>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.queue.uuid_log">
<ttclass="descclassname">pylorax.api.queue.</tt><ttclass="descname">uuid_log</tt><big>(</big><em>cfg</em>, <em>uuid</em>, <em>size=1024</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/queue.html#uuid_log"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.queue.uuid_log"title="Permalink to this definition">¶</a></dt>
<dd><p>Return <cite>size</cite> kbytes from the end of the anaconda.log</p>
<li><strong>uuid</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The UUID of the build</li>
<li><strong>size</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#int"title="(in Python v2.7)"><em>int</em></a>) – Number of kbytes to read. Default is 1024</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">Up to <cite>size</cite> kbytes from the end of the log</p>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">RuntimeError if there was a problem (eg. no log file available)</p>
</td>
</tr>
</tbody>
</table>
<p>This function tries to return lines from the end of the log, it will
attempt to start on a line boundry, and may return less than <cite>size</cite> kbytes.</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.queue.uuid_status">
<ttclass="descclassname">pylorax.api.queue.</tt><ttclass="descname">uuid_status</tt><big>(</big><em>cfg</em>, <em>uuid</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/queue.html#uuid_status"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.queue.uuid_status"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the details of a specific UUID compose</p>
<li><strong>uuid</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The UUID of the build</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">Details about the build</p>
</td>
</tr>
<trclass="field-odd field"><thclass="field-name">Return type:</th><tdclass="field-body"><pclass="first last">dict or None</p>
</td>
</tr>
</tbody>
</table>
<p>Returns the same dict as <cite>compose_details()</cite></p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.queue.uuid_tar">
<ttclass="descclassname">pylorax.api.queue.</tt><ttclass="descname">uuid_tar</tt><big>(</big><em>cfg</em>, <em>uuid</em>, <em>metadata=False</em>, <em>image=False</em>, <em>logs=False</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/queue.html#uuid_tar"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.queue.uuid_tar"title="Permalink to this definition">¶</a></dt>
<li><strong>uuid</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The UUID of the build</li>
<li><strong>metadata</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#bool"title="(in Python v2.7)"><em>bool</em></a>) – Set to true to include all the metadata needed to reproduce the build</li>
<li><strong>image</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#bool"title="(in Python v2.7)"><em>bool</em></a>) – Set to true to include the output image</li>
<li><strong>logs</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#bool"title="(in Python v2.7)"><em>bool</em></a>) – Set to true to include the logs from the build</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">A stream of bytes from tar</p>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">RuntimeError if there was a problem (eg. missing config file)</p>
</td>
</tr>
</tbody>
</table>
<p>This yields an uncompressed tar’s data to the caller. It includes
the selected data to the caller by returning the Popen stdout from the tar process.</p>
<spanid="recipes-module"></span><h2><ttclass="xref py py-mod docutils literal"><spanclass="pre">recipes</span></tt> Module<aclass="headerlink"href="#module-pylorax.api.recipes"title="Permalink to this headline">¶</a></h2>
<dlclass="class">
<dtid="pylorax.api.recipes.CommitDetails">
<emclass="property">class </em><ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">CommitDetails</tt><big>(</big><em>commit</em>, <em>timestamp</em>, <em>message</em>, <em>revision=None</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#CommitDetails"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.CommitDetails"title="Permalink to this definition">¶</a></dt>
<emclass="property">exception </em><ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">CommitTimeValError</tt><aclass="reference internal"href="_modules/pylorax/api/recipes.html#CommitTimeValError"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.CommitTimeValError"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">Recipe</tt><big>(</big><em>name</em>, <em>description</em>, <em>version</em>, <em>modules</em>, <em>packages</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#Recipe"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.Recipe"title="Permalink to this definition">¶</a></dt>
<p>This is a subclass of dict that enforces the constructor arguments
and adds a .filename property to return the recipe’s filename,
and a .toml() function to return the recipe as a TOML string.</p>
<dlclass="method">
<dtid="pylorax.api.recipes.Recipe.bump_version">
<ttclass="descname">bump_version</tt><big>(</big><em>old_version=None</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#Recipe.bump_version"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.Recipe.bump_version"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><strong>old_version</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – An optional old version number</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body">The new version number or None</td>
If there is no old version the new version is checked and returned
If there is no new version, but there is a old one, bump its patch level
If the old and new versions are the same, bump the patch level
If they are different, check and return the new version</p>
</dd></dl>
<dlclass="attribute">
<dtid="pylorax.api.recipes.Recipe.filename">
<ttclass="descname">filename</tt><aclass="reference internal"href="_modules/pylorax/api/recipes.html#Recipe.filename"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.Recipe.filename"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the Recipe’s filename</p>
<p>Replaces spaces in the name with ‘-‘ and appends .toml</p>
</dd></dl>
<dlclass="method">
<dtid="pylorax.api.recipes.Recipe.freeze">
<ttclass="descname">freeze</tt><big>(</big><em>deps</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#Recipe.freeze"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.Recipe.freeze"title="Permalink to this definition">¶</a></dt>
<dd><p>Return a new Recipe with full module and package NEVRA</p>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><strong>deps</strong> (<em>list(</em>) – A list of dependency NEVRA to use to fill in the modules and packages</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body">A new Recipe object</td>
<ttclass="descname">module_names</tt><aclass="reference internal"href="_modules/pylorax/api/recipes.html#Recipe.module_names"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.Recipe.module_names"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the names of the modules</p>
</dd></dl>
<dlclass="attribute">
<dtid="pylorax.api.recipes.Recipe.package_names">
<ttclass="descname">package_names</tt><aclass="reference internal"href="_modules/pylorax/api/recipes.html#Recipe.package_names"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.Recipe.package_names"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the names of the packages</p>
</dd></dl>
<dlclass="method">
<dtid="pylorax.api.recipes.Recipe.toml">
<ttclass="descname">toml</tt><big>(</big><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#Recipe.toml"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.Recipe.toml"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the Recipe in TOML format</p>
</dd></dl>
</dd></dl>
<dlclass="exception">
<dtid="pylorax.api.recipes.RecipeError">
<emclass="property">exception </em><ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">RecipeError</tt><aclass="reference internal"href="_modules/pylorax/api/recipes.html#RecipeError"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.RecipeError"title="Permalink to this definition">¶</a></dt>
<emclass="property">exception </em><ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">RecipeFileError</tt><aclass="reference internal"href="_modules/pylorax/api/recipes.html#RecipeFileError"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.RecipeFileError"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">RecipeModule</tt><big>(</big><em>name</em>, <em>version</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#RecipeModule"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.RecipeModule"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">RecipePackage</tt><big>(</big><em>name</em>, <em>version</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#RecipePackage"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.RecipePackage"title="Permalink to this definition">¶</a></dt>
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">commit_recipe</tt><big>(</big><em>repo</em>, <em>branch</em>, <em>recipe</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#commit_recipe"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.commit_recipe"title="Permalink to this definition">¶</a></dt>
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">commit_recipe_directory</tt><big>(</big><em>repo</em>, <em>branch</em>, <em>directory</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#commit_recipe_directory"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.commit_recipe_directory"title="Permalink to this definition">¶</a></dt>
<li><strong>directory</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The directory of *.toml recipes to commit</li>
<trclass="field-odd field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">Can raise errors from Ggit or RecipeFileError</p>
</td>
</tr>
</tbody>
</table>
<p>Files with Toml or RecipeFileErrors will be skipped, and the remainder will
be tried.</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.commit_recipe_file">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">commit_recipe_file</tt><big>(</big><em>repo</em>, <em>branch</em>, <em>filename</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#commit_recipe_file"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.commit_recipe_file"title="Permalink to this definition">¶</a></dt>
<li><strong>filename</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – Path to the recipe file to commit</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">OId of the new commit</p>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">Can raise errors from Ggit or RecipeFileError</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.delete_file">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">delete_file</tt><big>(</big><em>repo</em>, <em>branch</em>, <em>filename</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#delete_file"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.delete_file"title="Permalink to this definition">¶</a></dt>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">Can raise errors from Ggit</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.delete_recipe">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">delete_recipe</tt><big>(</big><em>repo</em>, <em>branch</em>, <em>recipe_name</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#delete_recipe"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.delete_recipe"title="Permalink to this definition">¶</a></dt>
<li><strong>recipe_name</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – Recipe name to delete</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">OId of the new commit</p>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">Can raise errors from Ggit</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.diff_items">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">diff_items</tt><big>(</big><em>title</em>, <em>old_items</em>, <em>new_items</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#diff_items"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.diff_items"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the differences between two lists of dicts.</p>
<li><strong>title</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – Title of the entry</li>
<li><strong>old_items</strong> (<em>list(dict)</em>) – List of item dicts with “name” field</li>
<li><strong>new_items</strong> (<em>list(dict)</em>) – List of item dicts with “name” field</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">List of diff dicts with old/new entries</p>
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">find_commit_tag</tt><big>(</big><em>repo</em>, <em>branch</em>, <em>filename</em>, <em>commit_id</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#find_commit_tag"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.find_commit_tag"title="Permalink to this definition">¶</a></dt>
<dd><p>Find the tag that matches the commit_id</p>
<li><strong>filename</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – filename to revert</li>
<li><strong>commit_id</strong> (<em>Git.OId</em>) – The commit id to check</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">The tag or None if there isn’t one</p>
</td>
</tr>
<trclass="field-odd field"><thclass="field-name">Return type:</th><tdclass="field-body"><pclass="first last">str or None</p>
</td>
</tr>
</tbody>
</table>
<p>There should be only 1 tag pointing to a commit, but there may not
be a tag at all.</p>
<p>The tag will look like: ‘refs/tags/<branch>/<filename>/r<revision>’</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.find_name">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">find_name</tt><big>(</big><em>name</em>, <em>lst</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#find_name"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.find_name"title="Permalink to this definition">¶</a></dt>
<dd><p>Find the dict matching the name in a list and return it.</p>
<li><strong>name</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – Name to search for</li>
<li><strong>lst</strong>– List of dict’s with “name” field</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">First dict with matching name, or None</p>
</td>
</tr>
<trclass="field-odd field"><thclass="field-name">Return type:</th><tdclass="field-body"><pclass="first last">dict or None</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.get_commit_details">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">get_commit_details</tt><big>(</big><em>commit</em>, <em>revision=None</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#get_commit_details"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.get_commit_details"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the details about a specific commit.</p>
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">get_revision_from_tag</tt><big>(</big><em>tag</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#get_revision_from_tag"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.get_revision_from_tag"title="Permalink to this definition">¶</a></dt>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><strong>tag</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The tag to exract the revision from</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body">The integer revision or None</td>
</tr>
<trclass="field-odd field"><thclass="field-name">Return type:</th><tdclass="field-body">int or None</td>
</tr>
</tbody>
</table>
<p>The revision is the part after the r in ‘branch/filename/rXXX’</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.gfile">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">gfile</tt><big>(</big><em>path</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#gfile"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.gfile"title="Permalink to this definition">¶</a></dt>
<dd><p>Convert a string path to GFile for use with Git</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.head_commit">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">head_commit</tt><big>(</big><em>repo</em>, <em>branch</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#head_commit"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.head_commit"title="Permalink to this definition">¶</a></dt>
<dd><p>Get the branch’s HEAD Commit Object</p>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">Can raise errors from Ggit</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.is_commit_tag">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">is_commit_tag</tt><big>(</big><em>repo</em>, <em>commit_id</em>, <em>tag</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#is_commit_tag"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.is_commit_tag"title="Permalink to this definition">¶</a></dt>
<dd><p>Check to see if a tag points to a specific commit.</p>
<li><strong>repo</strong> (<em>Git.Repository</em>) – Open repository</li>
<li><strong>commit_id</strong> (<em>Git.OId</em>) – The commit id to check</li>
<li><strong>tag</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The tag to check</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">True if the tag points to the commit, False otherwise</p>
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">is_parent_diff</tt><big>(</big><em>repo</em>, <em>filename</em>, <em>tree</em>, <em>parent</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#is_parent_diff"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.is_parent_diff"title="Permalink to this definition">¶</a></dt>
<dd><p>Check to see if the commit is different from its parents</p>
<li><strong>repo</strong> (<em>Git.Repository</em>) – Open repository</li>
<li><strong>filename</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – filename to revert</li>
<li><strong>tree</strong> (<em>Git.Tree</em>) – The commit’s tree</li>
<li><strong>parent</strong> (<em>Git.Commit</em>) – The commit’s parent commit</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Retuns :</th><tdclass="field-body"><pclass="first">True if filename in the commit is different from its parents</p>
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">list_branch_files</tt><big>(</big><em>repo</em>, <em>branch</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#list_branch_files"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.list_branch_files"title="Permalink to this definition">¶</a></dt>
<dd><p>Return a sorted list of the files on the branch HEAD</p>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">Can raise errors from Ggit</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.list_commit_files">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">list_commit_files</tt><big>(</big><em>repo</em>, <em>commit</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#list_commit_files"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.list_commit_files"title="Permalink to this definition">¶</a></dt>
<dd><p>Return a sorted list of the files on a commit</p>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">Can raise errors from Ggit</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.list_commits">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">list_commits</tt><big>(</big><em>repo</em>, <em>branch</em>, <em>filename</em>, <em>limit=0</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#list_commits"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.list_commits"title="Permalink to this definition">¶</a></dt>
<dd><p>List the commit history of a file on a branch.</p>
<li><strong>filename</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – filename to revert</li>
<li><strong>limit</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#int"title="(in Python v2.7)"><em>int</em></a>) – Number of commits to return (0=all)</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">A list of commit details</p>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">Can raise errors from Ggit</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.open_or_create_repo">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">open_or_create_repo</tt><big>(</big><em>path</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#open_or_create_repo"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.open_or_create_repo"title="Permalink to this definition">¶</a></dt>
<dd><p>Open an existing repo, or create a new one</p>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body">Can raise errors from Ggit</td>
</tr>
</tbody>
</table>
<p>A bare git repo will be created in the git directory of the specified path.
If a repo already exists it will be opened and returned instead of
creating a new one.</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.prepare_commit">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">prepare_commit</tt><big>(</big><em>repo</em>, <em>branch</em>, <em>builder</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#prepare_commit"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.prepare_commit"title="Permalink to this definition">¶</a></dt>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">Can raise errors from Ggit</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.read_commit">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">read_commit</tt><big>(</big><em>repo</em>, <em>branch</em>, <em>filename</em>, <em>commit=None</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#read_commit"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.read_commit"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the contents of a file on a specific branch or commit.</p>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">Can raise errors from Ggit</p>
</td>
</tr>
</tbody>
</table>
<p>If no commit is passed the master:filename is returned, otherwise it will be
commit:filename</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.read_commit_spec">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">read_commit_spec</tt><big>(</big><em>repo</em>, <em>spec</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#read_commit_spec"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.read_commit_spec"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the raw content of the blob specified by the spec</p>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">Can raise errors from Ggit</p>
</td>
</tr>
</tbody>
</table>
<p>eg. To read the README file from master the spec is “master:README”</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.read_recipe_and_id">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">read_recipe_and_id</tt><big>(</big><em>repo</em>, <em>branch</em>, <em>recipe_name</em>, <em>commit=None</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#read_recipe_and_id"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.read_recipe_and_id"title="Permalink to this definition">¶</a></dt>
<dd><p>Read a recipe commit and its id from git</p>
<li><strong>recipe_name</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – Recipe name to read</li>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">Can raise errors from Ggit</p>
</td>
</tr>
</tbody>
</table>
<p>If no commit is passed the master:filename is returned, otherwise it will be
commit:filename</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.read_recipe_commit">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">read_recipe_commit</tt><big>(</big><em>repo</em>, <em>branch</em>, <em>recipe_name</em>, <em>commit=None</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#read_recipe_commit"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.read_recipe_commit"title="Permalink to this definition">¶</a></dt>
<dd><p>Read a recipe commit from git and return a Recipe object</p>
<li><strong>recipe_name</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – Recipe name to read</li>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">Can raise errors from Ggit</p>
</td>
</tr>
</tbody>
</table>
<p>If no commit is passed the master:filename is returned, otherwise it will be
commit:filename</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.recipe_diff">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">recipe_diff</tt><big>(</big><em>old_recipe</em>, <em>new_recipe</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#recipe_diff"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.recipe_diff"title="Permalink to this definition">¶</a></dt>
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">recipe_filename</tt><big>(</big><em>name</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#recipe_filename"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.recipe_filename"title="Permalink to this definition">¶</a></dt>
<dd><p>Return the toml filename for a recipe</p>
<p>Replaces spaces with ‘-‘ and appends ‘.toml’</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.recipe_from_dict">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">recipe_from_dict</tt><big>(</big><em>recipe_dict</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#recipe_from_dict"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.recipe_from_dict"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a Recipe object from a plain dict.</p>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><strong>recipe_dict</strong> (<aclass="reference external"href="https://docs.python.org/2/library/stdtypes.html#dict"title="(in Python v2.7)"><em>dict</em></a>) – A plain dict of the recipe</td>
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">recipe_from_file</tt><big>(</big><em>recipe_path</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#recipe_from_file"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.recipe_from_file"title="Permalink to this definition">¶</a></dt>
<dd><p>Return a recipe file as a Recipe object</p>
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">recipe_from_toml</tt><big>(</big><em>recipe_str</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#recipe_from_toml"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.recipe_from_toml"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a Recipe object from a toml string.</p>
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">revert_file</tt><big>(</big><em>repo</em>, <em>branch</em>, <em>filename</em>, <em>commit</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#revert_file"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.revert_file"title="Permalink to this definition">¶</a></dt>
<dd><p>Revert the contents of a file to that of a previous commit</p>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">Can raise errors from Ggit</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.revert_recipe">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">revert_recipe</tt><big>(</big><em>repo</em>, <em>branch</em>, <em>recipe_name</em>, <em>commit</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#revert_recipe"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.revert_recipe"title="Permalink to this definition">¶</a></dt>
<dd><p>Revert the contents of a recipe to that of a previous commit</p>
<li><strong>recipe_name</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – Recipe name to revert</li>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">Can raise errors from Ggit</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.tag_file_commit">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">tag_file_commit</tt><big>(</big><em>repo</em>, <em>branch</em>, <em>filename</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#tag_file_commit"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.tag_file_commit"title="Permalink to this definition">¶</a></dt>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">Can raise errors from Ggit</p>
</td>
</tr>
</tbody>
</table>
<p>This uses git tags, of the form <cite>refs/tags/<branch>/<filename>/r<revision></cite>
Only the most recent recipe commit can be tagged to prevent out of order tagging.
Revisions start at 1 and increment for each new commit that is tagged.
If the commit has already been tagged it will return false.</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.tag_recipe_commit">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">tag_recipe_commit</tt><big>(</big><em>repo</em>, <em>branch</em>, <em>recipe_name</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#tag_recipe_commit"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.tag_recipe_commit"title="Permalink to this definition">¶</a></dt>
<li><strong>recipe_name</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – Recipe name to tag</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">Tag id or None if it failed.</p>
<trclass="field-even field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">Can raise errors from Ggit</p>
</td>
</tr>
</tbody>
</table>
<p>Uses tag_file_commit()</p>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.recipes.write_commit">
<ttclass="descclassname">pylorax.api.recipes.</tt><ttclass="descname">write_commit</tt><big>(</big><em>repo</em>, <em>branch</em>, <em>filename</em>, <em>message</em>, <em>content</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/recipes.html#write_commit"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.recipes.write_commit"title="Permalink to this definition">¶</a></dt>
<dd><p>Make a new commit to a repository’s branch</p>
<li><strong>filename</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – full path of the file to add</li>
<li><strong>message</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The commit message</li>
<li><strong>content</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The data to write</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">OId of the new commit</p>
<spanid="server-module"></span><h2><ttclass="xref py py-mod docutils literal"><spanclass="pre">server</span></tt> Module<aclass="headerlink"href="#module-pylorax.api.server"title="Permalink to this headline">¶</a></h2>
<dlclass="class">
<dtid="pylorax.api.server.GitLock">
<emclass="property">class </em><ttclass="descclassname">pylorax.api.server.</tt><ttclass="descname">GitLock</tt><aclass="headerlink"href="#pylorax.api.server.GitLock"title="Permalink to this definition">¶</a></dt>
<ttclass="descname">dir</tt><aclass="headerlink"href="#pylorax.api.server.GitLock.dir"title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for field number 2</p>
</dd></dl>
<dlclass="attribute">
<dtid="pylorax.api.server.GitLock.lock">
<ttclass="descname">lock</tt><aclass="headerlink"href="#pylorax.api.server.GitLock.lock"title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for field number 1</p>
</dd></dl>
<dlclass="attribute">
<dtid="pylorax.api.server.GitLock.repo">
<ttclass="descname">repo</tt><aclass="headerlink"href="#pylorax.api.server.GitLock.repo"title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for field number 0</p>
</dd></dl>
</dd></dl>
</div>
<divclass="section"id="module-pylorax.api.v0">
<spanid="v0-module"></span><h2><ttclass="xref py py-mod docutils literal"><spanclass="pre">v0</span></tt> Module<aclass="headerlink"href="#module-pylorax.api.v0"title="Permalink to this headline">¶</a></h2>
<p>Setup v0 of the API server</p>
<p>v0_api() must be called to setup the API routes for Flask</p>
<divclass="section"id="status-responses">
<h3>Status Responses<aclass="headerlink"href="#status-responses"title="Permalink to this headline">¶</a></h3>
<p>Some requests only return a status/error response.</p>
<blockquote>
<div><p>The response will be a status response with <cite>status</cite> set to true, or an
error response with it set to false and an error message included.</p>
<h4><cite>/api/v0/blueprints/info/<blueprint_names></cite><aclass="headerlink"href="#api-v0-blueprints-info-blueprint-names"title="Permalink to this headline">¶</a></h4>
<spanclass="s">"description"</span><spanclass="p">:</span><spanclass="s">"An example GlusterFS server with samba"</span><spanclass="p">,</span>
<h4><cite>/api/v0/blueprints/changes/<blueprint_names>[?offset=0&limit=20]</cite><aclass="headerlink"href="#api-v0-blueprints-changes-blueprint-names-offset-0-limit-20"title="Permalink to this headline">¶</a></h4>
<spanclass="s">"message"</span><spanclass="p">:</span><spanclass="s">"blueprint glusterfs, version 0.0.6 saved."</span><spanclass="p">,</span>
<spanclass="s">"message"</span><spanclass="p">:</span><spanclass="s">"blueprint glusterfs, version 0.0.5 saved."</span><spanclass="p">,</span>
<spanclass="s">"message"</span><spanclass="p">:</span><spanclass="s">"blueprint glusterfs, version 0.0.4 saved."</span><spanclass="p">,</span>
<spanclass="s">"message"</span><spanclass="p">:</span><spanclass="s">"blueprint glusterfs, version 0.0.3 saved."</span><spanclass="p">,</span>
<spanclass="s">"message"</span><spanclass="p">:</span><spanclass="s">"blueprint glusterfs, version 0.0.2 saved."</span><spanclass="p">,</span>
<spanclass="s">"message"</span><spanclass="p">:</span><spanclass="s">"blueprint glusterfs, version 0.0.1 saved."</span><spanclass="p">,</span>
<h4>DELETE <cite>/api/v0/blueprints/delete/<blueprint_name></cite><aclass="headerlink"href="#delete-api-v0-blueprints-delete-blueprint-name"title="Permalink to this headline">¶</a></h4>
<h4>POST <cite>/api/v0/blueprints/workspace</cite><aclass="headerlink"href="#post-api-v0-blueprints-workspace"title="Permalink to this headline">¶</a></h4>
<h4>DELETE <cite>/api/v0/blueprints/workspace/<blueprint_name></cite><aclass="headerlink"href="#delete-api-v0-blueprints-workspace-blueprint-name"title="Permalink to this headline">¶</a></h4>
<h4>POST <cite>/api/v0/blueprints/undo/<blueprint_name>/<commit></cite><aclass="headerlink"href="#post-api-v0-blueprints-undo-blueprint-name-commit"title="Permalink to this headline">¶</a></h4>
<h4>POST <cite>/api/v0/blueprints/tag/<blueprint_name></cite><aclass="headerlink"href="#post-api-v0-blueprints-tag-blueprint-name"title="Permalink to this headline">¶</a></h4>
<h4><cite>/api/v0/blueprints/diff/<blueprint_name>/<from_commit>/<to_commit></cite><aclass="headerlink"href="#api-v0-blueprints-diff-blueprint-name-from-commit-to-commit"title="Permalink to this headline">¶</a></h4>
<h4><cite>/api/v0/blueprints/freeze/<blueprint_names></cite><aclass="headerlink"href="#api-v0-blueprints-freeze-blueprint-names"title="Permalink to this headline">¶</a></h4>
<spanclass="s">"description"</span><spanclass="p">:</span><spanclass="s">"An example GlusterFS server with samba"</span><spanclass="p">,</span>
<h4><cite>/api/v0/blueprints/depsolve/<blueprint_names></cite><aclass="headerlink"href="#api-v0-blueprints-depsolve-blueprint-names"title="Permalink to this headline">¶</a></h4>
<h4><cite>/api/v0/projects/list[?offset=0&limit=20]</cite><aclass="headerlink"href="#api-v0-projects-list-offset-0-limit-20"title="Permalink to this headline">¶</a></h4>
<blockquote>
<div><p>List all of the available projects. By default this returns the first 20 items,
but this can be changed by setting the <cite>offset</cite> and <cite>limit</cite> arguments.</p>
<p>Example:</p>
<divclass="highlight-python"><pre>{
"limit": 20,
"offset": 0,
"projects": [
{
"description": "0 A.D. (pronounced "zero ey-dee") is a ...",
"homepage": "http://play0ad.com",
"name": "0ad",
"summary": "Cross-Platform RTS Game of Ancient Warfare",
<h4><cite>/api/v0/projects/info/<project_names></cite><aclass="headerlink"href="#api-v0-projects-info-project-names"title="Permalink to this headline">¶</a></h4>
<blockquote>
<div><p>Return information about the comma-separated list of projects. It includes the description
of the package along with the list of available builds.</p>
<spanclass="s">"description"</span><spanclass="p">:</span><spanclass="s">"The GNU tar program saves many ..."</span><spanclass="p">,</span>
<h4><cite>/api/v0/projects/depsolve/<project_names></cite><aclass="headerlink"href="#api-v0-projects-depsolve-project-names"title="Permalink to this headline">¶</a></h4>
<blockquote>
<div><p>Depsolve the comma-separated list of projects and return the list of NEVRAs needed
<h4><cite>/api/v0/modules/list[?offset=0&limit=20]</cite><aclass="headerlink"href="#api-v0-modules-list-offset-0-limit-20"title="Permalink to this headline">¶</a></h4>
<blockquote>
<div><p>Return a list of all of the available modules. This includes the name and the
group_type, which is always “rpm” for lorax-composer. By default this returns
the first 20 items. This can be changed by setting the <cite>offset</cite> and <cite>limit</cite>
<h4><cite>/api/v0/modules/list/<module_names>[?offset=0&limit=20]</cite><aclass="headerlink"href="#api-v0-modules-list-module-names-offset-0-limit-20"title="Permalink to this headline">¶</a></h4>
<blockquote>
<div><p>Return the list of comma-separated modules. Output is the same as <cite>/modules/list</cite></p>
<h4><cite>/api/v0/modules/info/<module_names></cite><aclass="headerlink"href="#api-v0-modules-info-module-names"title="Permalink to this headline">¶</a></h4>
<blockquote>
<div><p>Return the module’s dependencies, and the information about the module.</p>
<spanclass="s">"description"</span><spanclass="p">:</span><spanclass="s">"The GNU tar program saves ..."</span><spanclass="p">,</span>
<h4><cite>/api/v0/compose/status/<uuids></cite><aclass="headerlink"href="#api-v0-compose-status-uuids"title="Permalink to this headline">¶</a></h4>
<blockquote>
<div><p>Return the details for each of the comma-separated list of uuids.</p>
<h4>DELETE <cite>/api/v0/blueprints/cancel/<uuid></cite><aclass="headerlink"href="#delete-api-v0-blueprints-cancel-uuid"title="Permalink to this headline">¶</a></h4>
<h4>DELETE <cite>/api/v0/compose/delete/<uuids></cite><aclass="headerlink"href="#delete-api-v0-compose-delete-uuids"title="Permalink to this headline">¶</a></h4>
<blockquote>
<div><p>Delete the list of comma-separated uuids from the compose results.</p>
<h4><cite>/api/v0/compose/metadata/<uuid></cite><aclass="headerlink"href="#api-v0-compose-metadata-uuid"title="Permalink to this headline">¶</a></h4>
<blockquote>
<div><p>Returns a .tar of the metadata used for the build. This includes all the
information needed to reproduce the build, including the final kickstart
populated with repository and package NEVRA.</p>
<p>The mime type is set to ‘application/x-tar’ and the filename is set to
UUID-metadata.tar</p>
<p>The .tar is uncompressed, but is not large.</p>
<h4><cite>/api/v0/compose/results/<uuid></cite><aclass="headerlink"href="#api-v0-compose-results-uuid"title="Permalink to this headline">¶</a></h4>
<blockquote>
<div><p>Returns a .tar of the metadata, logs, and output image of the build. This
includes all the information needed to reproduce the build, including the
final kickstart populated with repository and package NEVRA. The output image
is already in compressed form so the returned tar is not compressed.</p>
<p>The mime type is set to ‘application/x-tar’ and the filename is set to
UUID.tar</p>
</div></blockquote>
</div>
<divclass="section"id="api-v0-compose-logs-uuid">
<h4><cite>/api/v0/compose/logs/<uuid></cite><aclass="headerlink"href="#api-v0-compose-logs-uuid"title="Permalink to this headline">¶</a></h4>
<blockquote>
<div><p>Returns a .tar of the anaconda build logs. The tar is not compressed, but is
not large.</p>
<p>The mime type is set to ‘application/x-tar’ and the filename is set to
<h4><cite>/api/v0/compose/log/<uuid>[?size=kbytes]</cite><aclass="headerlink"href="#api-v0-compose-log-uuid-size-kbytes"title="Permalink to this headline">¶</a></h4>
<blockquote>
<div><p>Returns the end of the anaconda.log. The size parameter is optional and defaults to 1Mbytes
if it is not included. The returned data is raw text from the end of the logfile, starting on
a line boundry.</p>
<p>Example:</p>
<divclass="highlight-python"><pre>12:59:24,222 INFO anaconda: Running Thread: AnaConfigurationThread (140629395244800)
12:59:24,223 INFO anaconda: Configuring installed system
12:59:24,912 INFO anaconda: Configuring installed system
12:59:24,912 INFO anaconda: Creating users
12:59:24,913 INFO anaconda: Clearing libuser.conf at /tmp/libuser.Dyy8Gj
12:59:25,154 INFO anaconda: Creating users
12:59:25,155 INFO anaconda: Configuring addons
12:59:25,155 INFO anaconda: Configuring addons
12:59:25,155 INFO anaconda: Generating initramfs
12:59:49,467 INFO anaconda: Generating initramfs
12:59:49,467 INFO anaconda: Running post-installation scripts
12:59:49,467 INFO anaconda: Running kickstart %%post script(s)
12:59:50,782 INFO anaconda: All kickstart %%post script(s) have been run
12:59:50,782 INFO anaconda: Running post-installation scripts
12:59:50,784 INFO anaconda: Thread Done: AnaConfigurationThread (140629395244800)</pre>
</div>
</div></blockquote>
<dlclass="function">
<dtid="pylorax.api.v0.take_limits">
<ttclass="descclassname">pylorax.api.v0.</tt><ttclass="descname">take_limits</tt><big>(</big><em>iterable</em>, <em>offset</em>, <em>limit</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/v0.html#take_limits"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.v0.take_limits"title="Permalink to this definition">¶</a></dt>
<dd><p>Apply offset and limit to an iterable object</p>
<li><strong>iterable</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#iter"title="(in Python v2.7)"><em>iter</em></a>) – The object to limit</li>
<li><strong>offset</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#int"title="(in Python v2.7)"><em>int</em></a>) – The number of items to skip</li>
<li><strong>limit</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#int"title="(in Python v2.7)"><em>int</em></a>) – The total number of items to return</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first last">A subset of the iterable</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.v0.v0_api">
<ttclass="descclassname">pylorax.api.v0.</tt><ttclass="descname">v0_api</tt><big>(</big><em>api</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/v0.html#v0_api"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.v0.v0_api"title="Permalink to this definition">¶</a></dt>
<spanid="workspace-module"></span><h2><ttclass="xref py py-mod docutils literal"><spanclass="pre">workspace</span></tt> Module<aclass="headerlink"href="#module-pylorax.api.workspace"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="pylorax.api.workspace.workspace_delete">
<ttclass="descclassname">pylorax.api.workspace.</tt><ttclass="descname">workspace_delete</tt><big>(</big><em>repo</em>, <em>branch</em>, <em>recipe_name</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/workspace.html#workspace_delete"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.workspace.workspace_delete"title="Permalink to this definition">¶</a></dt>
<li><strong>recipe_name</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The name of the recipe</li>
<trclass="field-odd field"><thclass="field-name">Raises :</th><tdclass="field-body"><pclass="first last">IO related errors</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="function">
<dtid="pylorax.api.workspace.workspace_dir">
<ttclass="descclassname">pylorax.api.workspace.</tt><ttclass="descname">workspace_dir</tt><big>(</big><em>repo</em>, <em>branch</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/workspace.html#workspace_dir"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.workspace.workspace_dir"title="Permalink to this definition">¶</a></dt>
<dd><p>Create the workspace’s path from a Repository and branch</p>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">The path to the branch’s workspace directory</p>
<ttclass="descclassname">pylorax.api.workspace.</tt><ttclass="descname">workspace_read</tt><big>(</big><em>repo</em>, <em>branch</em>, <em>recipe_name</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/workspace.html#workspace_read"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.workspace.workspace_read"title="Permalink to this definition">¶</a></dt>
<dd><p>Read a Recipe from the branch’s workspace</p>
<li><strong>recipe_name</strong> (<aclass="reference external"href="https://docs.python.org/2/library/functions.html#str"title="(in Python v2.7)"><em>str</em></a>) – The name of the recipe</li>
</ul>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first">The workspace copy of the recipe, or None if it doesn’t exist</p>
</td>
</tr>
<trclass="field-odd field"><thclass="field-name">Return type:</th><tdclass="field-body"><pclass="first">Recipe or None</p>
<ttclass="descclassname">pylorax.api.workspace.</tt><ttclass="descname">workspace_write</tt><big>(</big><em>repo</em>, <em>branch</em>, <em>recipe</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/workspace.html#workspace_write"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.workspace.workspace_write"title="Permalink to this definition">¶</a></dt>
<spanid="yumbase-module"></span><h2><ttclass="xref py py-mod docutils literal"><spanclass="pre">yumbase</span></tt> Module<aclass="headerlink"href="#module-pylorax.api.yumbase"title="Permalink to this headline">¶</a></h2>
<dlclass="function">
<dtid="pylorax.api.yumbase.get_base_object">
<ttclass="descclassname">pylorax.api.yumbase.</tt><ttclass="descname">get_base_object</tt><big>(</big><em>conf</em><big>)</big><aclass="reference internal"href="_modules/pylorax/api/yumbase.html#get_base_object"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#pylorax.api.yumbase.get_base_object"title="Permalink to this definition">¶</a></dt>
<dd><p>Get the Yum object with settings from the config file</p>