<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Developing for Packages — Bcfg2 1.3.0 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '1.3.0', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <script type="text/javascript" src="../_static/sidebar.js"></script> <link rel="shortcut icon" href="../_static/favicon.ico"/> <link rel="top" title="Bcfg2 1.3.0 documentation" href="../index.html" /> <link rel="up" title="Bcfg2 Plugin development" href="plugins.html" /> <link rel="next" title="Environment setup for development" href="setup.html" /> <link rel="prev" title="Cfg Handler Development" href="cfg.html" /> <link rel="stylesheet" href="../_static/bcfg2.css" type=""/> </head> <body> <div style="text-align: left; padding: 10px 10px 15px 15px"> <a href="../index.html"><img src="../_static/bcfg2_logo.png" border="0" alt="sampledoc"/></a> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="setup.html" title="Environment setup for development" accesskey="N">next</a> |</li> <li class="right" > <a href="cfg.html" title="Cfg Handler Development" accesskey="P">previous</a> |</li> <li><a href="../index.html">home</a> | </li> <!--<li><a href="../search.html">search</a> | </li>--> <li><a href="../help/index.html">help</a> | </li> <li><a href="../contents.html">documentation </a> »</li> <li><a href="../contents.html" >Bcfg2 documentation 1.3.0</a> »</li> <li><a href="index.html" >Bcfg2 Development</a> »</li> <li><a href="plugins.html" accesskey="U">Bcfg2 Plugin development</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="developing-for-packages"> <span id="development-packages"></span><h1>Developing for Packages<a class="headerlink" href="#developing-for-packages" title="Permalink to this headline">¶</a></h1> <p>The <a class="reference internal" href="../server/plugins/generators/packages.html#server-plugins-generators-packages"><em>Packages</em></a> plugin offers multiple backends to support different types of software repositories. New backends can be written to handle new types of software repositories.</p> <p>Each new Packages backend must be contained in its own module in <tt class="docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages</span></tt>. Each module must implement two classes: A <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection</span></tt></a> subclass called <tt class="docutils literal"><span class="pre"><module>Collection</span></tt>, and a <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source" title="Bcfg2.Server.Plugins.Packages.Source.Source"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source</span></tt></a> subclass called <tt class="docutils literal"><span class="pre"><module>Source</span></tt>. E.g., the <a class="reference internal" href="#module-Bcfg2.Server.Plugins.Packages.Yum" title="Bcfg2.Server.Plugins.Packages.Yum"><tt class="xref py py-mod docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Yum</span></tt></a> backend has <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection" title="Bcfg2.Server.Plugins.Packages.Yum.YumCollection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Yum.YumCollection</span></tt></a> and <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource" title="Bcfg2.Server.Plugins.Packages.Yum.YumSource"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Yum.YumSource</span></tt></a> objects. These interfaces are explained in detail below.</p> <div class="section" id="module-Bcfg2.Server.Plugins.Packages.Collection"> <span id="the-collection-object"></span><h2>The Collection Object<a class="headerlink" href="#module-Bcfg2.Server.Plugins.Packages.Collection" title="Permalink to this headline">¶</a></h2> <p><tt class="docutils literal"><span class="pre">Collection</span></tt> objects represent the set of <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source" title="Bcfg2.Server.Plugins.Packages.Source.Source"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source</span></tt></a> objects that apply to a given client, and can be used to query all software repositories for a client in aggregate. In some cases this can give faster or more accurate results.</p> <p>In most cases, <tt class="docutils literal"><span class="pre">Collection</span></tt> methods have been designed to defer the call to the Sources in the <tt class="docutils literal"><span class="pre">Collection</span></tt> and aggregate the results as appropriate. The simplest <tt class="docutils literal"><span class="pre">Collection</span></tt> implemention is thus often a simple subclass that adds no additional functionality.</p> <div class="section" id="overriding-methods"> <h3>Overriding Methods<a class="headerlink" href="#overriding-methods" title="Permalink to this headline">¶</a></h3> <p>As noted above, the <tt class="docutils literal"><span class="pre">Collection</span></tt> object is written expressly so that you can subclass it and override no methods or attributes, and it will work by deferring all calls to the Source objects it contains. There are thus three approaches to writing a <tt class="docutils literal"><span class="pre">Collection</span></tt> subclass:</p> <ol class="arabic simple"> <li>Keep the superclass almost entirely intact and defer to the <tt class="docutils literal"><span class="pre">Source</span></tt> objects inside it. For an example of this kind of <tt class="docutils literal"><span class="pre">Collection</span></tt> object, see <a class="reference internal" href="#module-Bcfg2.Server.Plugins.Packages.Apt" title="Bcfg2.Server.Plugins.Packages.Apt"><tt class="xref py py-mod docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Apt</span></tt></a>.</li> <li>Keep <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.complete" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.complete"><tt class="xref py py-func docutils literal"><span class="pre">Collection.complete()</span></tt></a> intact, and override the methods it calls: <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.is_package" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.is_package"><tt class="xref py py-func docutils literal"><span class="pre">Collection.is_package()</span></tt></a>, <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.is_virtual_package" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.is_virtual_package"><tt class="xref py py-func docutils literal"><span class="pre">Collection.is_virtual_package()</span></tt></a>, <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_deps" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_deps"><tt class="xref py py-func docutils literal"><span class="pre">Collection.get_deps()</span></tt></a>, <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_provides" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_provides"><tt class="xref py py-func docutils literal"><span class="pre">Collection.get_provides()</span></tt></a>, <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_vpkgs" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_vpkgs"><tt class="xref py py-func docutils literal"><span class="pre">Collection.get_vpkgs()</span></tt></a>, and <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.setup_data" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.setup_data"><tt class="xref py py-func docutils literal"><span class="pre">Collection.setup_data()</span></tt></a>. There are no examples of this kind of <tt class="docutils literal"><span class="pre">Collection</span></tt> subclass yet.</li> <li>Provide your own implementation of <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.complete" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.complete"><tt class="xref py py-func docutils literal"><span class="pre">Collection.complete()</span></tt></a>, in which case you do not have to override the above methods. You may want to override <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.packages_from_entry" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.packages_from_entry"><tt class="xref py py-func docutils literal"><span class="pre">Collection.packages_from_entry()</span></tt></a>, <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.packages_to_entry" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.packages_to_entry"><tt class="xref py py-func docutils literal"><span class="pre">Collection.packages_to_entry()</span></tt></a>, and <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_new_packages" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_new_packages"><tt class="xref py py-func docutils literal"><span class="pre">Collection.get_new_packages()</span></tt></a>. For an example of this kind of <tt class="docutils literal"><span class="pre">Collection</span></tt> object, see <tt class="xref py py-mod docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.yum</span></tt>.</li> </ol> <p>In either case, you may want to override <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_groups" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_groups"><tt class="xref py py-func docutils literal"><span class="pre">Collection.get_groups()</span></tt></a>, <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_group" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_group"><tt class="xref py py-func docutils literal"><span class="pre">Collection.get_group()</span></tt></a>, <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_essential" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_essential"><tt class="xref py py-func docutils literal"><span class="pre">Collection.get_essential()</span></tt></a>, <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_config" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_config"><tt class="xref py py-func docutils literal"><span class="pre">Collection.get_config()</span></tt></a>, <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.filter_unknown" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.filter_unknown"><tt class="xref py py-func docutils literal"><span class="pre">Collection.filter_unknown()</span></tt></a>, and <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.build_extra_structures" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.build_extra_structures"><tt class="xref py py-func docutils literal"><span class="pre">Collection.build_extra_structures()</span></tt></a>.</p> </div> <div class="section" id="conversion-between-package-objects-and-xml-entries"> <span id="pkg-objects"></span><h3>Conversion Between Package Objects and XML Entries<a class="headerlink" href="#conversion-between-package-objects-and-xml-entries" title="Permalink to this headline">¶</a></h3> <p>Collection objects have to translate Bcfg2 entries, <tt class="xref py py-class docutils literal"><span class="pre">lxml.etree._Element</span></tt> objects, into objects suitable for use by the backend for resolving dependencies. This is handled by two functions:</p> <ul class="simple"> <li><a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.packages_from_entry" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.packages_from_entry"><tt class="xref py py-func docutils literal"><span class="pre">Collection.packages_from_entry()</span></tt></a> is called to translate an XML entry into a list of packages;</li> <li><a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.packages_to_entry" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.packages_to_entry"><tt class="xref py py-func docutils literal"><span class="pre">Collection.packages_to_entry()</span></tt></a> is called to translate a list of packages back into an XML entry.</li> </ul> <p>Because of this translation layer, the return type of any functions below that return packages (e.g., <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_group" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_group"><tt class="xref py py-func docutils literal"><span class="pre">Collection.get_group()</span></tt></a>) is actually indeterminate; they must return an object suitable for passing to <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.packages_to_entry" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.packages_to_entry"><tt class="xref py py-func docutils literal"><span class="pre">Collection.packages_to_entry()</span></tt></a>. Similarly, functions that take a package as an argument (e.g., <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.is_package" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.is_package"><tt class="xref py py-func docutils literal"><span class="pre">Collection.is_package()</span></tt></a>) take the appropriate package object. In the documentation below, the actual parameter return type (usually .``string``) used in this base implementation is noted, as well as this fact.</p> </div> <div class="section" id="the-collection-module"> <h3>The Collection Module<a class="headerlink" href="#the-collection-module" title="Permalink to this headline">¶</a></h3> <dl class="class"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection"> <em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugins.Packages.Collection.</tt><tt class="descname">Collection</tt><big>(</big><em>metadata</em>, <em>sources</em>, <em>cachepath</em>, <em>basepath</em>, <em>fam</em>, <em>debug=False</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">list</span></tt>, <a class="reference internal" href="plugins.html#Bcfg2.Server.Plugin.base.Debuggable" title="Bcfg2.Server.Plugin.base.Debuggable"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.base.Debuggable</span></tt></a></p> <p><tt class="docutils literal"><span class="pre">Collection</span></tt> objects represent the set of <a class="reference internal" href="#module-Bcfg2.Server.Plugins.Packages.Source" title="Bcfg2.Server.Plugins.Packages.Source"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source</span></tt></a> objects that apply to a given client, and can be used to query all software repositories for a client in aggregate. In some cases this can give faster or more accurate results.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) – The client metadata for this collection</li> <li><strong>sources</strong> (list of <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source" title="Bcfg2.Server.Plugins.Packages.Source.Source"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source</span></tt></a> objects) – A list of all sources known to the server that will be used to generate the list of sources that apply to this client</li> <li><strong>cachepath</strong> (<em>string</em>) – The filesystem path where cache and other temporary data will be stored</li> <li><strong>basepath</strong> (<em>string</em>) – The filesystem path to the Packages plugin directory, where more permanent data can be stored</li> <li><strong>fam</strong> (<a class="reference internal" href="fam.html#Bcfg2.Server.FileMonitor.FileMonitor" title="Bcfg2.Server.FileMonitor.FileMonitor"><em>Bcfg2.Server.FileMonitor.FileMonitor</em></a>) – A file monitor object to use if this Collection needs to monitor for file activity</li> <li><strong>debug</strong> (<em>bool</em>) – Enable debugging output</li> </ul> </td> </tr> </tbody> </table> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.__package_groups__"> <tt class="descname">__package_groups__</tt><em class="property"> = False</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.__package_groups__" title="Permalink to this definition">¶</a></dt> <dd><p>Whether or not this Packages backend supports package groups</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.basegroups"> <tt class="descname">basegroups</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.basegroups"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.basegroups" title="Permalink to this definition">¶</a></dt> <dd><p>Get a list of group names used by this Collection type in resolution of <a class="reference internal" href="../server/plugins/generators/packages.html#server-plugins-generators-packages-magic-groups"><em>“Magic Groups”</em></a>.</p> <p>The base implementation simply aggregates the results of <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.basegroups" title="Bcfg2.Server.Plugins.Packages.Source.Source.basegroups"><tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.basegroups</span></tt></a>.</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.build_extra_structures"> <tt class="descname">build_extra_structures</tt><big>(</big><em>independent</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.build_extra_structures"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.build_extra_structures" title="Permalink to this definition">¶</a></dt> <dd><p>Add additional entries to the <tt class="docutils literal"><span class="pre"><Independent/></span></tt> section of the final configuration. This can be used to handle, e.g., GPG keys and other entries besides packages that need to be handled for a complete client configuration.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>independent</strong> (<em>lxml.etree._Element</em>) – The XML tag to add extra entries to. This is modified in place.</td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.cachefiles"> <tt class="descname">cachefiles</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.cachefiles"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.cachefiles" title="Permalink to this definition">¶</a></dt> <dd><p>A list of the full path to all cachefiles used by this collection.</p> <p>The base implementation simply aggregates <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.cachefile" title="Bcfg2.Server.Plugins.Packages.Source.Source.cachefile"><tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.cachefile</span></tt></a> attributes.</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.cachekey"> <tt class="descname">cachekey</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.cachekey"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.cachekey" title="Permalink to this definition">¶</a></dt> <dd><p>A unique identifier for the set of sources contained in this <tt class="docutils literal"><span class="pre">Collection</span></tt> object. This is unique to a set of sources, <strong>not</strong> necessarily to the client, which lets clients with identical sources share cache data.</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.complete"> <tt class="descname">complete</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.complete"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.complete" title="Permalink to this definition">¶</a></dt> <dd><p>Build a complete list of all packages and their dependencies.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>packagelist</strong> (set of strings, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a>) – Set of initial packages computed from the specification.</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">tuple of sets - The first element contains a set of strings (but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a>) describing the complete package list, and the second element is a set of symbols whose dependencies could not be resolved.</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.filter_unknown"> <tt class="descname">filter_unknown</tt><big>(</big><em>unknown</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.filter_unknown"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.filter_unknown" title="Permalink to this definition">¶</a></dt> <dd><p>After <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.complete" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.complete"><tt class="xref py py-func docutils literal"><span class="pre">complete()</span></tt></a>, filter out packages that appear in the list of unknown packages but should not be presented to the user. E.g., packages that you expect to be unknown.</p> <p>The base implementation filters out packages that are expected to be unknown by any source in this collection.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>unknown</strong> (set of strings, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a>) – A set of unknown packages. The set should be modified in place.</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_additional_data"> <tt class="descname">get_additional_data</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.get_additional_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_additional_data" title="Permalink to this definition">¶</a></dt> <dd><p>Get additional <a class="reference internal" href="plugins.html#Bcfg2.Server.Plugin.interfaces.Connector" title="Bcfg2.Server.Plugin.interfaces.Connector"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.interfaces.Connector</span></tt></a> data to be supplied to <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Packages.get_additional_data" title="Bcfg2.Server.Plugins.Packages.Packages.get_additional_data"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Packages.get_additional_data()</span></tt></a> (and thence to client metadata objects).</p> <p>The base implementation simply aggregates <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.url_map" title="Bcfg2.Server.Plugins.Packages.Source.Source.url_map"><tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.url_map</span></tt></a> attributes.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">list of additional Connector data</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_config"> <tt class="descname">get_config</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.get_config"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_config" title="Permalink to this definition">¶</a></dt> <dd><p>Get the configuration for the package tool used by this source type. This should be a config appropriate for use on either the server (to resolve dependencies) or the client.</p> <p>Subclasses must override this method in order to be able to generate configs. By default it logs an error and returns the empty string.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">string</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_deps"> <tt class="descname">get_deps</tt><big>(</big><em>package</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.get_deps"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_deps" title="Permalink to this definition">¶</a></dt> <dd><p>Get a list of the dependencies of the given package.</p> <p>The base implementation simply aggregates the results of <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.get_deps" title="Bcfg2.Server.Plugins.Packages.Source.Source.get_deps"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.get_deps()</span></tt></a>.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>package</strong> (<em>string</em>) – The name of the symbol, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a></td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of strings, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a></td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_essential"> <tt class="descname">get_essential</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.get_essential"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_essential" title="Permalink to this definition">¶</a></dt> <dd><p>Get a list of packages that are essential to the repository.</p> <p>The base implementation simply aggregates <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.essentialpkgs" title="Bcfg2.Server.Plugins.Packages.Source.Source.essentialpkgs"><tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.essentialpkgs</span></tt></a> attributes</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">list of strings, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a></td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_group"> <tt class="descname">get_group</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.get_group"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_group" title="Permalink to this definition">¶</a></dt> <dd><p>Get the list of packages of the given type in a package group.</p> <p>The base implementation simply aggregates the results of <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.get_group" title="Bcfg2.Server.Plugins.Packages.Source.Source.get_group"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.get_group()</span></tt></a>.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>group</strong> (<em>string</em>) – The name of the group to query</li> <li><strong>ptype</strong> (<em>string</em>) – The type of packages to get, for backends that support multiple package types in package groups (e.g., “recommended,” “optional,” etc.)</li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">list of strings - package names, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a></p> </td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_groups"> <tt class="descname">get_groups</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.get_groups"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_groups" title="Permalink to this definition">¶</a></dt> <dd><p>Given a list of package group names, return a dict of <tt class="docutils literal"><span class="pre"><group</span> <span class="pre">name>:</span> <span class="pre"><list</span> <span class="pre">of</span> <span class="pre">packages></span></tt>. This method is provided since some backends may be able to query multiple groups at once faster than serially.</p> <p>The base implementation simply aggregates the results of <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.get_group" title="Bcfg2.Server.Plugins.Packages.Source.Source.get_group"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.get_group()</span></tt></a>.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>grouplist</strong> (<em>list of strings - group names</em>) – The list of groups to query</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">dict of <tt class="docutils literal"><span class="pre"><group</span> <span class="pre">name>:</span> <span class="pre"><list</span> <span class="pre">of</span> <span class="pre">packages></span></tt></td> </tr> </tbody> </table> <p>In this implementation the packages will be strings, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a>.</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_new_packages"> <tt class="descname">get_new_packages</tt><big>(</big><em>initial</em>, <em>complete</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.get_new_packages"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_new_packages" title="Permalink to this definition">¶</a></dt> <dd><p>Compute the difference between the complete package list (as returned by <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.complete" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.complete"><tt class="xref py py-func docutils literal"><span class="pre">complete()</span></tt></a>) and the initial package list computed from the specification. This is necessary because the format may be different between the two lists due to <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.packages_to_entry" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.packages_to_entry"><tt class="xref py py-func docutils literal"><span class="pre">packages_to_entry()</span></tt></a> and <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.packages_from_entry" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.packages_from_entry"><tt class="xref py py-func docutils literal"><span class="pre">packages_from_entry()</span></tt></a>. See <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a> for more details.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>initial</strong> (set of strings, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a>) – The initial package list</li> <li><strong>complete</strong> (set of strings, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a>) – The final package list</li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">set of strings, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a> - the set of packages that are in <tt class="docutils literal"><span class="pre">complete</span></tt> but not in <tt class="docutils literal"><span class="pre">initial</span></tt></p> </td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_provides"> <tt class="descname">get_provides</tt><big>(</big><em>package</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.get_provides"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_provides" title="Permalink to this definition">¶</a></dt> <dd><p>Get a list of all symbols provided by the given package.</p> <p>The base implementation simply aggregates the results of <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.get_provides" title="Bcfg2.Server.Plugins.Packages.Source.Source.get_provides"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.get_provides()</span></tt></a>.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>package</strong> (<em>string</em>) – The name of the package, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a></td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of strings, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a></td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_relevant_groups"> <tt class="descname">get_relevant_groups</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.get_relevant_groups"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_relevant_groups" title="Permalink to this definition">¶</a></dt> <dd><p>Get all groups that might be relevant to determining which sources apply to this collection’s client.</p> <p>The base implementation simply aggregates the results of <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.get_relevant_groups" title="Bcfg2.Server.Plugins.Packages.Source.Source.get_relevant_groups"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.get_relevant_groups()</span></tt></a></p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">list of strings - group names</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_vpkgs"> <tt class="descname">get_vpkgs</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.get_vpkgs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_vpkgs" title="Permalink to this definition">¶</a></dt> <dd><p>Get a list of all virtual packages provided by all sources.</p> <p>The base implementation simply aggregates the results of <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.get_vpkgs" title="Bcfg2.Server.Plugins.Packages.Source.Source.get_vpkgs"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.get_vpkgs()</span></tt></a>.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">list of strings, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a></td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.is_package"> <tt class="descname">is_package</tt><big>(</big><em>package</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.is_package"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.is_package" title="Permalink to this definition">¶</a></dt> <dd><p>Return True if a package is a package, False otherwise.</p> <p>The base implementation returns True if any Source object’s <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.is_package" title="Bcfg2.Server.Plugins.Packages.Source.Source.is_package"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.is_package()</span></tt></a> returns True.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>package</strong> (<em>string</em>) – The name of the package, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a></td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">bool</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.is_virtual_package"> <tt class="descname">is_virtual_package</tt><big>(</big><em>package</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.is_virtual_package"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.is_virtual_package" title="Permalink to this definition">¶</a></dt> <dd><p>Return True if a name is a virtual package (i.e., is a symbol provided by a real package), False otherwise.</p> <p>The base implementation returns True if any Source object’s <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.is_virtual_package" title="Bcfg2.Server.Plugins.Packages.Source.Source.is_virtual_package"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.is_virtual_package()</span></tt></a> returns True.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>package</strong> (<em>string</em>) – The name of the symbol, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a></td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">bool</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.magic_groups_match"> <tt class="descname">magic_groups_match</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.magic_groups_match"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.magic_groups_match" title="Permalink to this definition">¶</a></dt> <dd><p>Returns True if the client’s <a class="reference internal" href="../server/plugins/generators/packages.html#server-plugins-generators-packages-magic-groups"><em>“Magic Groups”</em></a> match the magic groups for any of the sources contained in this Collection.</p> <p>The base implementation returns True if any source <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.magic_groups_match" title="Bcfg2.Server.Plugins.Packages.Source.Source.magic_groups_match"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.magic_groups_match()</span></tt></a> returns True.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">bool</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.packages_from_entry"> <tt class="descname">packages_from_entry</tt><big>(</big><em>entry</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.packages_from_entry"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.packages_from_entry" title="Permalink to this definition">¶</a></dt> <dd><p>Given a Package or BoundPackage entry, get a list of the package(s) described by it in a format appropriate for passing to <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.complete" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.complete"><tt class="xref py py-func docutils literal"><span class="pre">complete()</span></tt></a>. By default, that’s just the name; only the <a class="reference internal" href="#module-Bcfg2.Server.Plugins.Packages.Yum" title="Bcfg2.Server.Plugins.Packages.Yum"><tt class="xref py py-mod docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Yum</span></tt></a> backend supports versions or other extended data. See <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a> for more details.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>entry</strong> (<em>lxml.etree._Element</em>) – The XML entry describing the package or packages.</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of strings, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a></td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.packages_to_entry"> <tt class="descname">packages_to_entry</tt><big>(</big><em>pkglist</em>, <em>entry</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.packages_to_entry"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.packages_to_entry" title="Permalink to this definition">¶</a></dt> <dd><p>Given a list of package objects as returned by <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.packages_from_entry" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.packages_from_entry"><tt class="xref py py-func docutils literal"><span class="pre">packages_from_entry()</span></tt></a> or <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.complete" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.complete"><tt class="xref py py-func docutils literal"><span class="pre">complete()</span></tt></a>, return an XML tree describing the BoundPackage entries that should be included in the client configuration. See <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a> for more details.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>pkglist</strong> (list of strings, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a>) – A list of packages as returned by <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.complete" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.complete"><tt class="xref py py-func docutils literal"><span class="pre">complete()</span></tt></a></li> <li><strong>entry</strong> (<em>lxml.etree._Element</em>) – The base XML entry to add all of the Package entries to. This should be modified in place.</li> </ul> </td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.setup_data"> <tt class="descname">setup_data</tt><big>(</big><em>force_update=False</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.setup_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.setup_data" title="Permalink to this definition">¶</a></dt> <dd><p>Do any collection-level data setup tasks. This is called when sources are loaded or reloaded by <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Packages" title="Bcfg2.Server.Plugins.Packages.Packages"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Packages</span></tt></a>.</p> <p>The base implementation is a no-op; the child <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source" title="Bcfg2.Server.Plugins.Packages.Source.Source"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source</span></tt></a> objects will handle all data setup.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>force_update</strong> (<em>bool</em>) – Ignore all local cache and setup data from its original upstream sources (i.e., the package repositories)</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.Collection.sourcelist"> <tt class="descname">sourcelist</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#Collection.sourcelist"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.sourcelist" title="Permalink to this definition">¶</a></dt> <dd><p>Get a human-readable list of sources in this collection, including some information about each source.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">string</td> </tr> </tbody> </table> </dd></dl> </dd></dl> <dl class="function"> <dt id="Bcfg2.Server.Plugins.Packages.Collection.get_collection_class"> <tt class="descclassname">Bcfg2.Server.Plugins.Packages.Collection.</tt><tt class="descname">get_collection_class</tt><big>(</big><em>source_type</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Collection.html#get_collection_class"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Collection.get_collection_class" title="Permalink to this definition">¶</a></dt> <dd><p>Given a source type, determine the class of Collection object that should be used to contain these sources. Note that <tt class="docutils literal"><span class="pre">source_type</span></tt> is <em>not</em> a <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source" title="Bcfg2.Server.Plugins.Packages.Source.Source"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source</span></tt></a> subclass; it’s the name of a source type as given in <tt class="docutils literal"><span class="pre">sources.xml</span></tt>.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>source_type</strong> (<em>string</em>) – The type of source, e.g., “yum” or “apt”</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">type - the Collection subclass that should be used to instantiate an object to contain sources of the given type.</td> </tr> </tbody> </table> </dd></dl> </div> </div> <div class="section" id="module-Bcfg2.Server.Plugins.Packages.Source"> <span id="the-source-object"></span><h2>The Source Object<a class="headerlink" href="#module-Bcfg2.Server.Plugins.Packages.Source" title="Permalink to this headline">¶</a></h2> <p><tt class="docutils literal"><span class="pre">Source</span></tt> objects represent a single <Source> tag in <tt class="docutils literal"><span class="pre">sources.xml</span></tt>. Note that a single Source tag can itself describe multiple repositories (if it uses the “url” attribute instead of “rawurl”), and so can the <tt class="docutils literal"><span class="pre">Source</span></tt> object. This can be the source (har har) of some confusion. See <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.sourcelist" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.sourcelist"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection.sourcelist()</span></tt></a> for the proper way to get all repos from a <tt class="docutils literal"><span class="pre">Source</span></tt> object.</p> <p>Source objects are aggregated into <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection</span></tt></a> objects, which are actually called by <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Packages" title="Bcfg2.Server.Plugins.Packages.Packages"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Packages</span></tt></a>. This way a more advanced subclass can query repositories in aggregate rather than individually, which may give faster or more accurate results.</p> <p>The base <tt class="docutils literal"><span class="pre">Source</span></tt> object must be subclassed to handle each repository type. How you subclass <tt class="docutils literal"><span class="pre">Source</span></tt> will depend on how you subclassed <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection</span></tt></a>; see <a class="reference internal" href="#module-Bcfg2.Server.Plugins.Packages.Collection" title="Bcfg2.Server.Plugins.Packages.Collection"><tt class="xref py py-mod docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection</span></tt></a> for more details on different methods for doing that.</p> <p>If you are using the stock (or a near-stock) <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection</span></tt></a> object, then you will need to implement the following methods and attributes in your <tt class="docutils literal"><span class="pre">Source</span></tt> subclass:</p> <ul class="simple"> <li><a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.urls" title="Bcfg2.Server.Plugins.Packages.Source.Source.urls"><tt class="xref py py-func docutils literal"><span class="pre">Source.urls()</span></tt></a></li> <li><a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.read_files" title="Bcfg2.Server.Plugins.Packages.Source.Source.read_files"><tt class="xref py py-func docutils literal"><span class="pre">Source.read_files()</span></tt></a></li> <li><a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.basegroups" title="Bcfg2.Server.Plugins.Packages.Source.Source.basegroups"><tt class="xref py py-attr docutils literal"><span class="pre">Source.basegroups</span></tt></a></li> </ul> <p>Additionally, you may want to consider overriding the following methods and attributes:</p> <ul class="simple"> <li><a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.is_virtual_package" title="Bcfg2.Server.Plugins.Packages.Source.Source.is_virtual_package"><tt class="xref py py-func docutils literal"><span class="pre">Source.is_virtual_package()</span></tt></a></li> <li><a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.get_group" title="Bcfg2.Server.Plugins.Packages.Source.Source.get_group"><tt class="xref py py-func docutils literal"><span class="pre">Source.get_group()</span></tt></a></li> <li><a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.unknown_filter" title="Bcfg2.Server.Plugins.Packages.Source.Source.unknown_filter"><tt class="xref py py-attr docutils literal"><span class="pre">Source.unknown_filter</span></tt></a></li> <li><a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.load_state" title="Bcfg2.Server.Plugins.Packages.Source.Source.load_state"><tt class="xref py py-attr docutils literal"><span class="pre">Source.load_state</span></tt></a></li> <li><a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.save_state" title="Bcfg2.Server.Plugins.Packages.Source.Source.save_state"><tt class="xref py py-attr docutils literal"><span class="pre">Source.save_state</span></tt></a></li> </ul> <p>For an example of this kind of <tt class="docutils literal"><span class="pre">Source</span></tt> object, see <a class="reference internal" href="#module-Bcfg2.Server.Plugins.Packages.Apt" title="Bcfg2.Server.Plugins.Packages.Apt"><tt class="xref py py-mod docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Apt</span></tt></a>.</p> <p>If you are overriding the <tt class="docutils literal"><span class="pre">Collection</span></tt> object in more depth, then you have more leeway in what you might want to override or implement in your <tt class="docutils literal"><span class="pre">Source</span></tt> subclass. For an example of this kind of <tt class="docutils literal"><span class="pre">Source</span></tt> object, see <a class="reference internal" href="#module-Bcfg2.Server.Plugins.Packages.Yum" title="Bcfg2.Server.Plugins.Packages.Yum"><tt class="xref py py-mod docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Yum</span></tt></a>.</p> <dl class="data"> <dt id="Bcfg2.Server.Plugins.Packages.Source.REPO_RE"> <tt class="descclassname">Bcfg2.Server.Plugins.Packages.Source.</tt><tt class="descname">REPO_RE</tt><em class="property"> = <_sre.SRE_Pattern object at 0xa25a198></em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.REPO_RE" title="Permalink to this definition">¶</a></dt> <dd><p>A regular expression used to determine the base name of a repo from its URL. This is used when generating repo configs and by <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.get_repo_name" title="Bcfg2.Server.Plugins.Packages.Source.Source.get_repo_name"><tt class="xref py py-func docutils literal"><span class="pre">Source.get_repo_name()</span></tt></a>. It handles <a class="reference external" href="http://www.pulpproject.org/">Pulp</a> and <a class="reference external" href="http://dag.wieers.com/home-made/mrepo/">mrepo</a> repositories specially, and otherwise grabs the last component of the URL (as delimited by slashes).</p> </dd></dl> <dl class="class"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source"> <em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugins.Packages.Source.</tt><tt class="descname">Source</tt><big>(</big><em>basepath</em>, <em>xsource</em>, <em>setup</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="plugins.html#Bcfg2.Server.Plugin.base.Debuggable" title="Bcfg2.Server.Plugin.base.Debuggable"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.base.Debuggable</span></tt></a></p> <p><tt class="docutils literal"><span class="pre">Source</span></tt> objects represent a single <Source> tag in <tt class="docutils literal"><span class="pre">sources.xml</span></tt>. Note that a single Source tag can itself describe multiple repositories (if it uses the “url” attribute instead of “rawurl”), and so can the <tt class="docutils literal"><span class="pre">Source</span></tt> object.</p> <p>Note that a number of the attributes of this object may be more or less specific to one backend (e.g., <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.essentialpkgs" title="Bcfg2.Server.Plugins.Packages.Source.Source.essentialpkgs"><tt class="xref py py-attr docutils literal"><span class="pre">essentialpkgs</span></tt></a>, <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.recommended" title="Bcfg2.Server.Plugins.Packages.Source.Source.recommended"><tt class="xref py py-attr docutils literal"><span class="pre">recommended</span></tt></a>, <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.gpgkeys" title="Bcfg2.Server.Plugins.Packages.Source.Source.gpgkeys"><tt class="xref py py-attr docutils literal"><span class="pre">gpgkeys</span></tt></a>, but they are included in the superclass to make the parsing of sources from XML more consistent, and to make it trivial for other backends to support those features.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>basepath</strong> (<em>string</em>) – The base filesystem path under which cache data for this source should be stored</li> <li><strong>xsource</strong> – The XML tag that describes this source</li> <li><strong>setup</strong> (<em>dict</em>) – A Bcfg2 options dict</li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body"><p class="first last"><a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.SourceInitError" title="Bcfg2.Server.Plugins.Packages.Source.SourceInitError"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.SourceInitError</span></tt></a></p> </td> </tr> </tbody> </table> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.applies"> <tt class="descname">applies</tt><big>(</big><em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.applies"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.applies" title="Permalink to this definition">¶</a></dt> <dd><p>Return true if this source applies to the given client, i.e., the client is in all necessary groups and <a class="reference internal" href="../server/plugins/generators/packages.html#server-plugins-generators-packages-magic-groups"><em>“Magic Groups”</em></a>.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) – The client metadata to check to see if this source applies</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">bool</td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.arches"> <tt class="descname">arches</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.arches" title="Permalink to this definition">¶</a></dt> <dd><p>A list of the arches supported by this source</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.basegroups"> <tt class="descname">basegroups</tt><em class="property"> = []</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.basegroups" title="Permalink to this definition">¶</a></dt> <dd><p>The list of <a class="reference internal" href="../server/plugins/generators/packages.html#server-plugins-generators-packages-magic-groups"><em>“Magic Groups”</em></a> that make sources of this type available to clients.</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.basepath"> <tt class="descname">basepath</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.basepath" title="Permalink to this definition">¶</a></dt> <dd><p>The base filesystem path under which cache data for this source should be stored</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.blacklist"> <tt class="descname">blacklist</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.blacklist" title="Permalink to this definition">¶</a></dt> <dd><p>A list of the the names of packages that are blacklisted from this source</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.cachefile"> <tt class="descname">cachefile</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.cachefile" title="Permalink to this definition">¶</a></dt> <dd><p>The file (or directory) used for this source’s cache data</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.cachekey"> <tt class="descname">cachekey</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.cachekey"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.cachekey" title="Permalink to this definition">¶</a></dt> <dd><p>A unique key for this source that will be used to generate <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.cachefile" title="Bcfg2.Server.Plugins.Packages.Source.Source.cachefile"><tt class="xref py py-attr docutils literal"><span class="pre">cachefile</span></tt></a> and other cache paths</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.client_options"> <tt class="descname">client_options</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.client_options" title="Permalink to this definition">¶</a></dt> <dd><p>A dict of repository options that will be included in the configuration generated for the client (if that is supported by the backend)</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.components"> <tt class="descname">components</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.components" title="Permalink to this definition">¶</a></dt> <dd><p>A list of the text of all ‘Component’ attributes of this source from XML</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.conditions"> <tt class="descname">conditions</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.conditions" title="Permalink to this definition">¶</a></dt> <dd><p>A list of predicates that are used to determine if this source applies to a given <tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Metadata.ClientMetadata</span></tt> object.</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.deps"> <tt class="descname">deps</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.deps" title="Permalink to this definition">¶</a></dt> <dd><p>A dict of <tt class="docutils literal"><span class="pre"><package</span> <span class="pre">name></span></tt> -> <tt class="docutils literal"><span class="pre"><list</span> <span class="pre">of</span> <span class="pre">dependencies></span></tt>. This will not necessarily be populated, particularly by backends that reimplement large portions of <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection</span></tt></a></p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.escape_url"> <tt class="descname">escape_url</tt><big>(</big><em>url</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.escape_url"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.escape_url" title="Permalink to this definition">¶</a></dt> <dd><p>Given a URL to a repository metadata file, return the full path to a file suitable for storing that file locally. This is acheived by replacing all forward slashes in the URL with <tt class="docutils literal"><span class="pre">@</span></tt>.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>url</strong> (<em>string</em>) – The URL to escape</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">string</td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.essential"> <tt class="descname">essential</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.essential" title="Permalink to this definition">¶</a></dt> <dd><p>Whether or not to include essential packages from this source</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.essentialpkgs"> <tt class="descname">essentialpkgs</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.essentialpkgs" title="Permalink to this definition">¶</a></dt> <dd><p>A set of package names that are deemed “essential” by this source</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.files"> <tt class="descname">files</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.files"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.files" title="Permalink to this definition">¶</a></dt> <dd><p>A list of files stored in the local cache by this backend.</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.filter_unknown"> <tt class="descname">filter_unknown</tt><big>(</big><em>unknown</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.filter_unknown"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.filter_unknown" title="Permalink to this definition">¶</a></dt> <dd><p>After <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.complete" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.complete"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection.complete()</span></tt></a>, filter out packages that appear in the list of unknown packages but should not be presented to the user. <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.unknown_filter" title="Bcfg2.Server.Plugins.Packages.Source.Source.unknown_filter"><tt class="xref py py-attr docutils literal"><span class="pre">unknown_filter</span></tt></a> is called to assess whether or not a package is expected to be unknown.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>unknown</strong> (<em>set of strings</em>) – A set of unknown packages. The set should be modified in place.</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.get_arches"> <tt class="descname">get_arches</tt><big>(</big><em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.get_arches"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.get_arches" title="Permalink to this definition">¶</a></dt> <dd><p>Get a list of architectures that the given client has and for which this source provides packages for. The return value will always include <tt class="docutils literal"><span class="pre">global</span></tt>.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) – The client metadata to get matching architectures for</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of strings</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.get_deps"> <tt class="descname">get_deps</tt><big>(</big><em>metadata</em>, <em>package</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.get_deps"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.get_deps" title="Permalink to this definition">¶</a></dt> <dd><p>Get a list of the dependencies of the given package.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>package</strong> (<em>string</em>) – The name of the symbol</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of strings</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.get_group"> <tt class="descname">get_group</tt><big>(</big><em>metadata</em>, <em>group</em>, <em>ptype=None</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.get_group"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.get_group" title="Permalink to this definition">¶</a></dt> <dd><p>Get the list of packages of the given type in a package group.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>group</strong> (<em>string</em>) – The name of the group to query</li> <li><strong>ptype</strong> (<em>string</em>) – The type of packages to get, for backends that support multiple package types in package groups (e.g., “recommended,” “optional,” etc.)</li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">list of strings - package names</p> </td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.get_provides"> <tt class="descname">get_provides</tt><big>(</big><em>metadata</em>, <em>package</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.get_provides"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.get_provides" title="Permalink to this definition">¶</a></dt> <dd><p>Get a list of all symbols provided by the given package.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>package</strong> (<em>string</em>) – The name of the package</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of strings</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.get_relevant_groups"> <tt class="descname">get_relevant_groups</tt><big>(</big><em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.get_relevant_groups"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.get_relevant_groups" title="Permalink to this definition">¶</a></dt> <dd><p>Get all groups that might be relevant to determining which sources apply to this collection’s client.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">list of strings - group names</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.get_repo_name"> <tt class="descname">get_repo_name</tt><big>(</big><em>url_map</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.get_repo_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.get_repo_name" title="Permalink to this definition">¶</a></dt> <dd><p>Try to find a sensible name for a repository. Since <tt class="docutils literal"><span class="pre">sources.xml</span></tt> doesn’t provide for repository names, we have to try to guess at the names when generating config files or doing other operations that require repository names. This function tries several approaches:</p> <ol class="arabic simple"> <li>First, if the map contains a <tt class="docutils literal"><span class="pre">component</span></tt> key, use that as the name.</li> <li>If not, then try to match the repository URL against <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.REPO_RE" title="Bcfg2.Server.Plugins.Packages.Source.REPO_RE"><tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.REPO_RE</span></tt></a>. If that succeeds, use the first matched group; additionally, if the Source tag that describes this repo is contained in a <tt class="docutils literal"><span class="pre"><Group></span></tt> tag, prepend that to the name.</li> <li>If <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.REPO_RE" title="Bcfg2.Server.Plugins.Packages.Source.REPO_RE"><tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.REPO_RE</span></tt></a> does not match the repository, and the Source tag that describes this repo is contained in a <tt class="docutils literal"><span class="pre"><Group></span></tt> tag, use the name of the group.</li> <li>Failing that, use the full URL to this repository, with the protocol and trailing slash stripped off if possible.</li> </ol> <p>Once that is done, all characters disallowed in yum source names are replaced by dashes. See below for the exact regex. The yum rules are used here because they are so restrictive.</p> <p><tt class="docutils literal"><span class="pre">get_repo_name</span></tt> is <strong>not</strong> guaranteed to return a unique name. If you require a unique name, then you will need to generate all repo names and make them unique through the approach of your choice, e.g., appending numbers to non-unique repository names. See <tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Yum.Source.get_repo_name()</span></tt> for an example.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>url_map</strong> (<em>dict</em>) – A single <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.url_map" title="Bcfg2.Server.Plugins.Packages.Source.Source.url_map"><tt class="xref py py-attr docutils literal"><span class="pre">url_map</span></tt></a> dict, i.e., any single element of <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.url_map" title="Bcfg2.Server.Plugins.Packages.Source.Source.url_map"><tt class="xref py py-attr docutils literal"><span class="pre">url_map</span></tt></a>.</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">string - the name of the repository.</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.get_vpkgs"> <tt class="descname">get_vpkgs</tt><big>(</big><em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.get_vpkgs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.get_vpkgs" title="Permalink to this definition">¶</a></dt> <dd><p>Get a list of all virtual packages provided by all sources.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">list of strings</td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.gpgkeys"> <tt class="descname">gpgkeys</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.gpgkeys" title="Permalink to this definition">¶</a></dt> <dd><p>A list of URLs to GPG keys that apply to this source</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.groups"> <tt class="descname">groups</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.groups" title="Permalink to this definition">¶</a></dt> <dd><p>Formerly, <a class="reference internal" href="../server/plugins/generators/packages.html#server-plugins-generators-packages"><em>Packages</em></a> only supported applying package sources to groups; that is, they could not be assigned by more complicated logic like per-client repositories and group or client negation. This attribute attempts to provide for some limited backwards compat with older code that relies on this.</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.is_package"> <tt class="descname">is_package</tt><big>(</big><em>metadata</em>, <em>package</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.is_package"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.is_package" title="Permalink to this definition">¶</a></dt> <dd><p>Return True if a package is a package, False otherwise.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>package</strong> (<em>string</em>) – The name of the package</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">bool</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.is_virtual_package"> <tt class="descname">is_virtual_package</tt><big>(</big><em>metadata</em>, <em>package</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.is_virtual_package"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.is_virtual_package" title="Permalink to this definition">¶</a></dt> <dd><p>Return True if a name is a virtual package (i.e., is a symbol provided by a real package), False otherwise.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>package</strong> (<em>string</em>) – The name of the symbol, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a></td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">bool</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.load_state"> <tt class="descname">load_state</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.load_state"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.load_state" title="Permalink to this definition">¶</a></dt> <dd><p>Load saved state from <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.cachefile" title="Bcfg2.Server.Plugins.Packages.Source.Source.cachefile"><tt class="xref py py-attr docutils literal"><span class="pre">cachefile</span></tt></a>. If caching and state is handled by the package library, then this function does not need to be implemented.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Raises :</th><td class="field-body">OSError - If the saved data cannot be read</td> </tr> <tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body">cPickle.UnpicklingError - If the saved data is corrupt</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.magic_groups_match"> <tt class="descname">magic_groups_match</tt><big>(</big><em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.magic_groups_match"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.magic_groups_match" title="Permalink to this definition">¶</a></dt> <dd><p>Returns True if the client’s <a class="reference internal" href="../server/plugins/generators/packages.html#server-plugins-generators-packages-magic-groups"><em>“Magic Groups”</em></a> match the magic groups this source. Also returns True if magic groups are off in the configuration and the client’s architecture matches (i.e., architecture groups are <em>always</em> checked).</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">bool</td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.pkgnames"> <tt class="descname">pkgnames</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.pkgnames" title="Permalink to this definition">¶</a></dt> <dd><p>A set of all package names in this source. This will not necessarily be populated, particularly by backends that reimplement large portions of <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection</span></tt></a></p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.process_files"> <tt class="descname">process_files</tt><big>(</big><em>dependencies</em>, <em>provides</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.process_files"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.process_files" title="Permalink to this definition">¶</a></dt> <dd><p>Given dicts of depends and provides generated by <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.read_files" title="Bcfg2.Server.Plugins.Packages.Source.Source.read_files"><tt class="xref py py-func docutils literal"><span class="pre">read_files()</span></tt></a>, this generates <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.deps" title="Bcfg2.Server.Plugins.Packages.Source.Source.deps"><tt class="xref py py-attr docutils literal"><span class="pre">deps</span></tt></a> and <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.provides" title="Bcfg2.Server.Plugins.Packages.Source.Source.provides"><tt class="xref py py-attr docutils literal"><span class="pre">provides</span></tt></a> and calls <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.save_state" title="Bcfg2.Server.Plugins.Packages.Source.Source.save_state"><tt class="xref py py-func docutils literal"><span class="pre">save_state()</span></tt></a> to save the cached data to disk.</p> <p>Both arguments are dicts of dicts of lists. Keys are the arches of packages contained in this source; values are dicts whose keys are package names and values are lists of either dependencies for each package the symbols provided by each package.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>dependencies</strong> (<em>dict; see above.</em>) – A dict of dependencies found in the metadata for this source.</li> <li><strong>provides</strong> (<em>dict; see above.</em>) – A dict of symbols provided by packages in this repository.</li> </ul> </td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.provides"> <tt class="descname">provides</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.provides" title="Permalink to this definition">¶</a></dt> <dd><p>A dict of <tt class="docutils literal"><span class="pre"><package</span> <span class="pre">name></span></tt> -> <tt class="docutils literal"><span class="pre"><list</span> <span class="pre">of</span> <span class="pre">provided</span> <span class="pre">symbols></span></tt>. This will not necessarily be populated, particularly by backends that reimplement large portions of <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection</span></tt></a></p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.ptype"> <tt class="descname">ptype</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.ptype" title="Permalink to this definition">¶</a></dt> <dd><p>The Package type handled by this Source class. The <tt class="docutils literal"><span class="pre">type</span></tt> attribute of Package entries will be set to the value <tt class="docutils literal"><span class="pre">ptype</span></tt> when they are handled by <a class="reference internal" href="#module-Bcfg2.Server.Plugins.Packages" title="Bcfg2.Server.Plugins.Packages"><tt class="xref py py-mod docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages</span></tt></a>.</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.rawurl"> <tt class="descname">rawurl</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.rawurl" title="Permalink to this definition">¶</a></dt> <dd><p>The “rawurl” attribute from <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.xsource" title="Bcfg2.Server.Plugins.Packages.Source.Source.xsource"><tt class="xref py py-attr docutils literal"><span class="pre">xsource</span></tt></a>, if applicable. A trailing slash is automatically appended to this if there wasn’t one already present.</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.read_files"> <tt class="descname">read_files</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.read_files"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.read_files" title="Permalink to this definition">¶</a></dt> <dd><p>Read and parse locally downloaded metadata files and populates <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.pkgnames" title="Bcfg2.Server.Plugins.Packages.Source.Source.pkgnames"><tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.pkgnames</span></tt></a>. Should call <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.process_files" title="Bcfg2.Server.Plugins.Packages.Source.Source.process_files"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.process_files()</span></tt></a> as its final step.</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.recommended"> <tt class="descname">recommended</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.recommended" title="Permalink to this definition">¶</a></dt> <dd><p>Whether or not to include recommended packages from this source</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.save_state"> <tt class="descname">save_state</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.save_state"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.save_state" title="Permalink to this definition">¶</a></dt> <dd><p>Save state to <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.cachefile" title="Bcfg2.Server.Plugins.Packages.Source.Source.cachefile"><tt class="xref py py-attr docutils literal"><span class="pre">cachefile</span></tt></a>. If caching and state is handled by the package library, then this function does not need to be implemented.</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.server_options"> <tt class="descname">server_options</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.server_options" title="Permalink to this definition">¶</a></dt> <dd><p>A dict of repository options that will be included in the configuration generated on the server side (if such is applicable; most backends do not generate any sort of repository configuration on the Bcfg2 server)</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.setup"> <tt class="descname">setup</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.setup" title="Permalink to this definition">¶</a></dt> <dd><p>A Bcfg2 options dict</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.setup_data"> <tt class="descname">setup_data</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.setup_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.setup_data" title="Permalink to this definition">¶</a></dt> <dd><p>Perform all data fetching and setup tasks. For most backends, this involves downloading all metadata from the repository, parsing it, and caching the parsed data locally. The order of operations is:</p> <ol class="arabic simple"> <li>Call <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.load_state" title="Bcfg2.Server.Plugins.Packages.Source.Source.load_state"><tt class="xref py py-func docutils literal"><span class="pre">load_state()</span></tt></a> to try to load data from the local cache.</li> <li>If that fails, call <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.read_files" title="Bcfg2.Server.Plugins.Packages.Source.Source.read_files"><tt class="xref py py-func docutils literal"><span class="pre">read_files()</span></tt></a> to read and parse the locally downloaded metadata files.</li> <li>If that fails, call <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.update" title="Bcfg2.Server.Plugins.Packages.Source.Source.update"><tt class="xref py py-func docutils literal"><span class="pre">update()</span></tt></a> to fetch the metadata, then <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.read_files" title="Bcfg2.Server.Plugins.Packages.Source.Source.read_files"><tt class="xref py py-func docutils literal"><span class="pre">read_files()</span></tt></a> to parse it.</li> </ol> <p>Obviously with a backend that leverages repo access libraries to avoid downloading all metadata, many of the functions called by <tt class="docutils literal"><span class="pre">setup_data</span></tt> can be no-ops (or nearly so).</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>force_update</strong> (<em>bool</em>) – Ignore all locally cached and downloaded data and fetch the metadata anew from the upstream repository.</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.unknown_filter"> <tt class="descname">unknown_filter</tt><big>(</big><em>package</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.unknown_filter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.unknown_filter" title="Permalink to this definition">¶</a></dt> <dd><p>A predicate that is used by <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.filter_unknown" title="Bcfg2.Server.Plugins.Packages.Source.Source.filter_unknown"><tt class="xref py py-func docutils literal"><span class="pre">filter_unknown()</span></tt></a> to filter packages from the results of <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.complete" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.complete"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection.complete()</span></tt></a> that should not be shown to the end user (i.e., that are not truly unknown, but are rather packaging system artifacts). By default, excludes any package whose name starts with “choice”</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>package</strong> (<em>string</em>) – The name of a package that was unknown to the backend</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">bool</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.update"> <tt class="descname">update</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.update"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.update" title="Permalink to this definition">¶</a></dt> <dd><p>Download metadata from the upstream repository and cache it locally.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Raises :</th><td class="field-body">ValueError - If any URL in <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.urls" title="Bcfg2.Server.Plugins.Packages.Source.Source.urls"><tt class="xref py py-attr docutils literal"><span class="pre">urls</span></tt></a> is malformed</td> </tr> <tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body">OSError - If there is an error writing the local cache</td> </tr> <tr class="field-odd field"><th class="field-name">Raises :</th><td class="field-body">HTTPError - If there is an error fetching the remote data</td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.url"> <tt class="descname">url</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.url" title="Permalink to this definition">¶</a></dt> <dd><p>The “url” attribute from <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.xsource" title="Bcfg2.Server.Plugins.Packages.Source.Source.xsource"><tt class="xref py py-attr docutils literal"><span class="pre">xsource</span></tt></a>, if applicable. A trailing slash is automatically appended to this if there wasn’t one already present.</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.url_map"> <tt class="descname">url_map</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.url_map" title="Permalink to this definition">¶</a></dt> <dd><p>A list of dicts, each of which describes the URL to one repository contained in this source. Each dict contains the following keys:</p> <ul class="simple"> <li><tt class="docutils literal"><span class="pre">version</span></tt>: The version of the repo (<tt class="docutils literal"><span class="pre">None</span></tt> for <tt class="docutils literal"><span class="pre">rawurl</span></tt> repos)</li> <li><tt class="docutils literal"><span class="pre">component</span></tt>: The component use to form this URL (<tt class="docutils literal"><span class="pre">None</span></tt> for <tt class="docutils literal"><span class="pre">rawurl</span></tt> repos)</li> <li><tt class="docutils literal"><span class="pre">arch</span></tt>: The architecture of this repo</li> <li><tt class="docutils literal"><span class="pre">baseurl</span></tt>: Either the <tt class="docutils literal"><span class="pre">rawurl</span></tt> attribute, or the format string built from the <tt class="docutils literal"><span class="pre">url</span></tt> attribute</li> <li><tt class="docutils literal"><span class="pre">url</span></tt>: The actual URL to the repository</li> </ul> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.urls"> <tt class="descname">urls</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#Source.urls"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.urls" title="Permalink to this definition">¶</a></dt> <dd><p>A list of URLs to the base metadata file for each repository described by this source.</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.version"> <tt class="descname">version</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.version" title="Permalink to this definition">¶</a></dt> <dd><p>The “version” attribute from <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.xsource" title="Bcfg2.Server.Plugins.Packages.Source.Source.xsource"><tt class="xref py py-attr docutils literal"><span class="pre">xsource</span></tt></a></p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.whitelist"> <tt class="descname">whitelist</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.whitelist" title="Permalink to this definition">¶</a></dt> <dd><p>A list of the the names of packages that are whitelisted in this source</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Source.Source.xsource"> <tt class="descname">xsource</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.Source.xsource" title="Permalink to this definition">¶</a></dt> <dd><p>The XML tag that describes this source</p> </dd></dl> </dd></dl> <dl class="exception"> <dt id="Bcfg2.Server.Plugins.Packages.Source.SourceInitError"> <em class="property">exception </em><tt class="descclassname">Bcfg2.Server.Plugins.Packages.Source.</tt><tt class="descname">SourceInitError</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#SourceInitError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.SourceInitError" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">exceptions.Exception</span></tt></p> <p>Raised when a <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source" title="Bcfg2.Server.Plugins.Packages.Source.Source"><tt class="xref py py-class docutils literal"><span class="pre">Source</span></tt></a> object fails instantiation.</p> </dd></dl> <dl class="function"> <dt id="Bcfg2.Server.Plugins.Packages.Source.fetch_url"> <tt class="descclassname">Bcfg2.Server.Plugins.Packages.Source.</tt><tt class="descname">fetch_url</tt><big>(</big><em>url</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Source.html#fetch_url"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Source.fetch_url" title="Permalink to this definition">¶</a></dt> <dd><p>Return the content of the given URL.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>url</strong> (<em>string</em>) – The URL to fetch content from.</td> </tr> <tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body">ValueError - Malformed URL</td> </tr> <tr class="field-odd field"><th class="field-name">Raises :</th><td class="field-body">URLError - Failure fetching URL</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">string - the content of the page at the given URL</td> </tr> </tbody> </table> </dd></dl> </div> <div class="section" id="module-Bcfg2.Server.Plugins.Packages"> <span id="the-packages-module"></span><h2>The Packages Module<a class="headerlink" href="#module-Bcfg2.Server.Plugins.Packages" title="Permalink to this headline">¶</a></h2> <p>Packages resolves Package entries on the Bcfg2 server in order to present a complete list of Package entries to the client in order to determine the completeness of the client configuration.</p> <dl class="data"> <dt id="Bcfg2.Server.Plugins.Packages.APT_CONFIG_DEFAULT"> <tt class="descclassname">Bcfg2.Server.Plugins.Packages.</tt><tt class="descname">APT_CONFIG_DEFAULT</tt><em class="property"> = '/etc/apt/sources.d/bcfg2'</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.APT_CONFIG_DEFAULT" title="Permalink to this definition">¶</a></dt> <dd><p>The default path for generated apt configs</p> </dd></dl> <dl class="class"> <dt id="Bcfg2.Server.Plugins.Packages.Packages"> <em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugins.Packages.</tt><tt class="descname">Packages</tt><big>(</big><em>core</em>, <em>datastore</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages.html#Packages"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="plugins.html#Bcfg2.Server.Plugin.base.Plugin" title="Bcfg2.Server.Plugin.base.Plugin"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.base.Plugin</span></tt></a>, <a class="reference internal" href="plugins.html#Bcfg2.Server.Plugin.interfaces.StructureValidator" title="Bcfg2.Server.Plugin.interfaces.StructureValidator"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.interfaces.StructureValidator</span></tt></a>, <a class="reference internal" href="plugins.html#Bcfg2.Server.Plugin.interfaces.Generator" title="Bcfg2.Server.Plugin.interfaces.Generator"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.interfaces.Generator</span></tt></a>, <a class="reference internal" href="plugins.html#Bcfg2.Server.Plugin.interfaces.Connector" title="Bcfg2.Server.Plugin.interfaces.Connector"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.interfaces.Connector</span></tt></a>, <a class="reference internal" href="plugins.html#Bcfg2.Server.Plugin.interfaces.ClientRunHooks" title="Bcfg2.Server.Plugin.interfaces.ClientRunHooks"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.interfaces.ClientRunHooks</span></tt></a></p> <p>Packages resolves Package entries on the Bcfg2 server in order to present a complete list of Package entries to the client in order to determine the completeness of the client configuration. It does so by delegating control of package version information to a number of backends, which may parse repository metadata directly or defer to package manager libraries for truly dynamic resolution.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>core</strong> (<a class="reference internal" href="core.html#module-Bcfg2.Server.Core" title="Bcfg2.Server.Core"><em>Bcfg2.Server.Core</em></a>) – The Bcfg2.Server.Core initializing the plugin</li> <li><strong>datastore</strong> (<em>string</em>) – The path to the Bcfg2 repository on the filesystem</li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body"><p class="first last"><a class="reference internal" href="plugins.html#Bcfg2.Server.Plugin.exceptions.PluginInitError" title="Bcfg2.Server.Plugin.exceptions.PluginInitError"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.exceptions.PluginInitError</span></tt></a></p> </td> </tr> </tbody> </table> <dl class="attribute"> <dt id="Bcfg2.Server.Plugin.base.Packages.Debuggable.__rmi__"> <tt class="descclassname">Debuggable.</tt><tt class="descname">__rmi__</tt><em class="property"> = ['toggle_debug', 'set_debug']</em><a class="headerlink" href="#Bcfg2.Server.Plugin.base.Packages.Debuggable.__rmi__" title="Permalink to this definition">¶</a></dt> <dd><p>List of names of methods to be exposed as XML-RPC functions</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Packages.HandleEntry"> <tt class="descname">HandleEntry</tt><big>(</big><em>entry</em>, <em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages.html#Packages.HandleEntry"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages.HandleEntry" title="Permalink to this definition">¶</a></dt> <dd><p>Bind configuration entries. <tt class="docutils literal"><span class="pre">HandleEntry</span></tt> handles entries two different ways:</p> <ul class="simple"> <li>All <tt class="docutils literal"><span class="pre">Package</span></tt> entries have their <tt class="docutils literal"><span class="pre">version</span></tt> and <tt class="docutils literal"><span class="pre">type</span></tt> attributes set according to the appropriate <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection</span></tt></a> object for this client.</li> <li><tt class="docutils literal"><span class="pre">Path</span></tt> entries are delegated to <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Packages.create_config" title="Bcfg2.Server.Plugins.Packages.Packages.create_config"><tt class="xref py py-func docutils literal"><span class="pre">create_config()</span></tt></a></li> </ul> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>entry</strong> (<em>lxml.etree._Element</em>) – The entry to bind</li> <li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) – The client metadata</li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">lxml.etree._Element - The fully bound entry</p> </td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Packages.HandlesEntry"> <tt class="descname">HandlesEntry</tt><big>(</big><em>entry</em>, <em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages.html#Packages.HandlesEntry"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages.HandlesEntry" title="Permalink to this definition">¶</a></dt> <dd><p>Determine if the given entry can be handled. Packages handles two kinds of entries:</p> <ul class="simple"> <li><tt class="docutils literal"><span class="pre">Package</span></tt> entries are handled if the client has any sources at all.</li> <li><tt class="docutils literal"><span class="pre">Path</span></tt> entries are handled if they match the paths that are handled by a backend that can produce client configurations, e.g., <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.YUM_CONFIG_DEFAULT" title="Bcfg2.Server.Plugins.Packages.YUM_CONFIG_DEFAULT"><tt class="xref py py-attr docutils literal"><span class="pre">YUM_CONFIG_DEFAULT</span></tt></a>, <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.APT_CONFIG_DEFAULT" title="Bcfg2.Server.Plugins.Packages.APT_CONFIG_DEFAULT"><tt class="xref py py-attr docutils literal"><span class="pre">APT_CONFIG_DEFAULT</span></tt></a>, or the overridden value of either of those from the configuration.</li> </ul> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>entry</strong> (<em>lxml.etree._Element</em>) – The entry to bind</li> <li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) – The client metadata</li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">bool - Whether or not this plugin can handle the entry</p> </td> </tr> <tr class="field-odd field"><th class="field-name">Raises :</th><td class="field-body"><p class="first last"><a class="reference internal" href="plugins.html#Bcfg2.Server.Plugin.exceptions.PluginExecutionError" title="Bcfg2.Server.Plugin.exceptions.PluginExecutionError"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.exceptions.PluginExecutionError</span></tt></a></p> </td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Packages.Refresh"> <tt class="descname">Refresh</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages.html#Packages.Refresh"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages.Refresh" title="Permalink to this definition">¶</a></dt> <dd><p>Packages.Refresh() => True|False</p> <p>Reload configuration specification and download sources</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Packages.Reload"> <tt class="descname">Reload</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages.html#Packages.Reload"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages.Reload" title="Permalink to this definition">¶</a></dt> <dd><p>Packages.Refresh() => True|False</p> <p>Reload configuration specification and sources</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Packages._build_packages"> <tt class="descname">_build_packages</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages.html#Packages._build_packages"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages._build_packages" title="Permalink to this definition">¶</a></dt> <dd><p>Perform dependency resolution and build the complete list of packages that need to be included in the specification by <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Packages.validate_structures" title="Bcfg2.Server.Plugins.Packages.Packages.validate_structures"><tt class="xref py py-func docutils literal"><span class="pre">validate_structures()</span></tt></a>, based on the initial list of packages.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) – The client metadata</li> <li><strong>independent</strong> (<em>lxml.etree._Element</em>) – The XML tag to add package entries generated by dependency resolution to. This will be modified in place.</li> <li><strong>structures</strong> (<em>list of lxml.etree._Element objects</em>) – A list of lxml.etree._Element objects describing the structures (i.e., bundles) for this client</li> <li><strong>collection</strong> (<a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><em>Bcfg2.Server.Plugins.Packages.Collection.Collection</em></a>) – The collection of sources for this client. If none is given, one will be created with <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Packages.get_collection" title="Bcfg2.Server.Plugins.Packages.Packages.get_collection"><tt class="xref py py-func docutils literal"><span class="pre">get_collection()</span></tt></a></li> </ul> </td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Packages.cachepath"> <tt class="descname">cachepath</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages.cachepath" title="Permalink to this definition">¶</a></dt> <dd><p>Packages does a potentially tremendous amount of on-disk caching. <tt class="docutils literal"><span class="pre">cachepath</span></tt> holds the base directory to where data should be cached.</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Packages.clients"> <tt class="descname">clients</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages.clients" title="Permalink to this definition">¶</a></dt> <dd><p>clients is a cache mapping of hostname -> <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.cachekey" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.cachekey"><tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection.cachekey</span></tt></a> Unlike <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Packages.collections" title="Bcfg2.Server.Plugins.Packages.Packages.collections"><tt class="xref py py-attr docutils literal"><span class="pre">collections</span></tt></a>, this _is_ used to return a <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection</span></tt></a> object when one is requested, so each entry is very short-lived – it’s purged at the end of each client run.</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Packages.collections"> <tt class="descname">collections</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages.collections" title="Permalink to this definition">¶</a></dt> <dd><p>We cache <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection</span></tt></a> objects in <tt class="docutils literal"><span class="pre">collections</span></tt> so that calling <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Packages.Refresh" title="Bcfg2.Server.Plugins.Packages.Packages.Refresh"><tt class="xref py py-func docutils literal"><span class="pre">Refresh()</span></tt></a> or <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Packages.Reload" title="Bcfg2.Server.Plugins.Packages.Packages.Reload"><tt class="xref py py-func docutils literal"><span class="pre">Reload()</span></tt></a> can tell the collection objects to clean up their cache, but we don’t actually use the cache to return a <tt class="docutils literal"><span class="pre">Collection</span></tt> object when one is requested, because that prevents new machines from working, since a <tt class="docutils literal"><span class="pre">Collection</span></tt> object gets created by <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Packages.get_additional_data" title="Bcfg2.Server.Plugins.Packages.Packages.get_additional_data"><tt class="xref py py-func docutils literal"><span class="pre">get_additional_data()</span></tt></a>, which is called for all clients at server startup and various other times. (It would also prevent machines that change groups from working properly; e.g., if you reinstall a machine with a new OS, then returning a cached <tt class="docutils literal"><span class="pre">Collection</span></tt> object would give the wrong sources to that client.) These are keyed by the collection <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.cachekey" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.cachekey"><tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection.cachekey</span></tt></a>, a unique key identifying the collection by its <em>config</em>, which could be shared among multiple clients.</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Packages.conflicts"> <tt class="descname">conflicts</tt><em class="property"> = ['Pkgmgr']</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages.conflicts" title="Permalink to this definition">¶</a></dt> <dd><p>Packages is an alternative to <tt class="xref py py-mod docutils literal"><span class="pre">Bcfg2.Server.Plugins.Pkgmgr</span></tt> and conflicts with it.</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Packages.create_config"> <tt class="descname">create_config</tt><big>(</big><em>entry</em>, <em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages.html#Packages.create_config"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages.create_config" title="Permalink to this definition">¶</a></dt> <dd><p>Create yum/apt config for the specified client.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>entry</strong> (<em>lxml.etree._Element</em>) – The base entry to bind. This will be modified in place.</li> <li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) – The client to create the config for.</li> </ul> </td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Packages.disableMetaData"> <tt class="descname">disableMetaData</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages.html#Packages.disableMetaData"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages.disableMetaData" title="Permalink to this definition">¶</a></dt> <dd><p>Report whether or not metadata processing is enabled.</p> <p>This property cannot be set.</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Packages.disableResolver"> <tt class="descname">disableResolver</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages.html#Packages.disableResolver"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages.disableResolver" title="Permalink to this definition">¶</a></dt> <dd><p>Report the state of the resolver. This can be disabled in the configuration. Note that disabling metadata (see <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Packages.disableMetaData" title="Bcfg2.Server.Plugins.Packages.Packages.disableMetaData"><tt class="xref py py-attr docutils literal"><span class="pre">disableMetaData</span></tt></a>) implies disabling the resolver.</p> <p>This property cannot be set.</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Packages.end_client_run"> <tt class="descname">end_client_run</tt><big>(</big><em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages.html#Packages.end_client_run"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages.end_client_run" title="Permalink to this definition">¶</a></dt> <dd><p>Hook to clear the cache for this client in <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Packages.clients" title="Bcfg2.Server.Plugins.Packages.Packages.clients"><tt class="xref py py-attr docutils literal"><span class="pre">clients</span></tt></a>, which must persist only the duration of a client run.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) – The client metadata</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Packages.end_statistics"> <tt class="descname">end_statistics</tt><big>(</big><em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages.html#Packages.end_statistics"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages.end_statistics" title="Permalink to this definition">¶</a></dt> <dd><p>Hook to clear the cache for this client in <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Packages.clients" title="Bcfg2.Server.Plugins.Packages.Packages.clients"><tt class="xref py py-attr docutils literal"><span class="pre">clients</span></tt></a> once statistics are processed to ensure that a stray cached <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection</span></tt></a> object is not built during statistics and preserved until a subsequent client run.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) – The client metadata</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Packages.get_additional_data"> <tt class="descname">get_additional_data</tt><big>(</big><em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages.html#Packages.get_additional_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages.get_additional_data" title="Permalink to this definition">¶</a></dt> <dd><p>Return additional data for the given client. This will be a dict containing a single key, <tt class="docutils literal"><span class="pre">sources</span></tt>, whose value is a list of data returned from <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_additional_data" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_additional_data"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection.get_additional_data()</span></tt></a>, namely, a list of <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.url_map" title="Bcfg2.Server.Plugins.Packages.Source.Source.url_map"><tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.url_map</span></tt></a> data.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) – The client metadata</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">dict of lists of <tt class="docutils literal"><span class="pre">url_map</span></tt> data</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Packages.get_collection"> <tt class="descname">get_collection</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages.html#Packages.get_collection"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages.get_collection" title="Permalink to this definition">¶</a></dt> <dd><p>Get a <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection</span></tt></a> object for this client.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) – The client metadata to get a Collection for</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">An instance of the appropriate subclass of <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection</span></tt></a> that contains all relevant sources that apply to the given client</td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Packages.keypath"> <tt class="descname">keypath</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages.keypath" title="Permalink to this definition">¶</a></dt> <dd><p>Where Packages should store downloaded GPG key files</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Packages.set_debug"> <tt class="descname">set_debug</tt><big>(</big><em>debug</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages.html#Packages.set_debug"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages.set_debug" title="Permalink to this definition">¶</a></dt> <dd><p>Explicitly enable or disable debugging. This method is exposed via XML-RPC.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">bool - The new value of the debug flag</td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Packages.sources"> <tt class="descname">sources</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages.sources" title="Permalink to this definition">¶</a></dt> <dd><p>The <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources" title="Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources</span></tt></a> object used to generate <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source" title="Bcfg2.Server.Plugins.Packages.Source.Source"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source</span></tt></a> objects for this plugin.</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Packages.validate_structures"> <tt class="descname">validate_structures</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages.html#Packages.validate_structures"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Packages.validate_structures" title="Permalink to this definition">¶</a></dt> <dd><p>Do the real work of Packages. This does two things:</p> <ol class="arabic simple"> <li>Given the full list of all packages that apply to this client from the specification, calls <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Packages._build_packages" title="Bcfg2.Server.Plugins.Packages.Packages._build_packages"><tt class="xref py py-func docutils literal"><span class="pre">_build_packages()</span></tt></a> to resolve dependencies, determine unknown packages (i.e., those that are not in any repository that applies to this client), and build a complete package list.</li> <li>Calls <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.build_extra_structures" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.build_extra_structures"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection.build_extra_structures()</span></tt></a> to add any other extra data required by the backend (e.g., GPG keys)</li> </ol> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) – The client metadata</li> <li><strong>metadata</strong> – The client metadata</li> <li><strong>structures</strong> (<em>list of lxml.etree._Element objects</em>) – A list of lxml.etree._Element objects describing the structures (i.e., bundles) for this client. This can be modified in place.</li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">None</p> </td> </tr> </tbody> </table> </dd></dl> </dd></dl> <dl class="data"> <dt id="Bcfg2.Server.Plugins.Packages.YUM_CONFIG_DEFAULT"> <tt class="descclassname">Bcfg2.Server.Plugins.Packages.</tt><tt class="descname">YUM_CONFIG_DEFAULT</tt><em class="property"> = '/etc/yum.repos.d/bcfg2.repo'</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.YUM_CONFIG_DEFAULT" title="Permalink to this definition">¶</a></dt> <dd><p>The default path for generated yum configs</p> </dd></dl> </div> <div class="section" id="module-Bcfg2.Server.Plugins.Packages.PackagesSources"> <span id="packages-source-description"></span><h2>Packages Source Description<a class="headerlink" href="#module-Bcfg2.Server.Plugins.Packages.PackagesSources" title="Permalink to this headline">¶</a></h2> <p>PackagesSources handles the <a class="reference internal" href="../server/plugins/generators/packages.html#server-plugins-generators-packages"><em>Packages</em></a> <tt class="docutils literal"><span class="pre">sources.xml</span></tt> file</p> <dl class="class"> <dt id="Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources"> <em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugins.Packages.PackagesSources.</tt><tt class="descname">PackagesSources</tt><big>(</big><em>filename</em>, <em>cachepath</em>, <em>fam</em>, <em>packages</em>, <em>setup</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/PackagesSources.html#PackagesSources"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="plugins.html#Bcfg2.Server.Plugin.helpers.StructFile" title="Bcfg2.Server.Plugin.helpers.StructFile"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.StructFile</span></tt></a>, <a class="reference internal" href="plugins.html#Bcfg2.Server.Plugin.base.Debuggable" title="Bcfg2.Server.Plugin.base.Debuggable"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.base.Debuggable</span></tt></a></p> <p>PackagesSources handles parsing of the <a class="reference internal" href="#module-Bcfg2.Server.Plugins.Packages" title="Bcfg2.Server.Plugins.Packages"><tt class="xref py py-mod docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages</span></tt></a> <tt class="docutils literal"><span class="pre">sources.xml</span></tt> file, and the creation of the appropriate <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source" title="Bcfg2.Server.Plugins.Packages.Source.Source"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source</span></tt></a> object for each <tt class="docutils literal"><span class="pre">Source</span></tt> tag.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>filename</strong> (<em>string</em>) – The full path to <tt class="docutils literal"><span class="pre">sources.xml</span></tt></li> <li><strong>cachepath</strong> (<em>string</em>) – The full path to the directory where <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source" title="Bcfg2.Server.Plugins.Packages.Source.Source"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source</span></tt></a> data will be cached</li> <li><strong>fam</strong> (<a class="reference internal" href="fam.html#Bcfg2.Server.FileMonitor.FileMonitor" title="Bcfg2.Server.FileMonitor.FileMonitor"><em>Bcfg2.Server.FileMonitor.FileMonitor</em></a>) – The file access monitor to use to create watches on <tt class="docutils literal"><span class="pre">sources.xml</span></tt> and any XIncluded files.</li> <li><strong>packages</strong> (<a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Packages" title="Bcfg2.Server.Plugins.Packages.Packages"><em>Bcfg2.Server.Plugins.Packages.Packages</em></a>) – The Packages plugin object <tt class="docutils literal"><span class="pre">sources.xml</span></tt> is being parsed on behalf of (i.e., the calling object)</li> <li><strong>setup</strong> (<em>dict</em>) – A Bcfg2 options dict</li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body"><p class="first last"><a class="reference internal" href="plugins.html#Bcfg2.Server.Plugin.exceptions.PluginInitError" title="Bcfg2.Server.Plugin.exceptions.PluginInitError"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.exceptions.PluginInitError</span></tt></a> - If <tt class="docutils literal"><span class="pre">sources.xml</span></tt> cannot be read</p> </td> </tr> </tbody> </table> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.HandleEvent"> <tt class="descname">HandleEvent</tt><big>(</big><em>event=None</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/PackagesSources.html#PackagesSources.HandleEvent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.HandleEvent" title="Permalink to this definition">¶</a></dt> <dd><p>HandleEvent is called whenever the FAM registers an event.</p> <p>When <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.loaded" title="Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.loaded"><tt class="xref py py-attr docutils literal"><span class="pre">loaded</span></tt></a> becomes True, <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Packages.Reload" title="Bcfg2.Server.Plugins.Packages.Packages.Reload"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Packages.Reload()</span></tt></a> is called to reload all plugin data from the configured sources.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>event</strong> (<a class="reference internal" href="fam.html#Bcfg2.Server.FileMonitor.Event" title="Bcfg2.Server.FileMonitor.Event"><em>Bcfg2.Server.FileMonitor.Event</em></a>) – The event object</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.Index"> <tt class="descname">Index</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/PackagesSources.html#PackagesSources.Index"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.Index" title="Permalink to this definition">¶</a></dt> <dd><p>Index() is called by <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.HandleEvent" title="Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.HandleEvent"><tt class="xref py py-func docutils literal"><span class="pre">HandleEvent()</span></tt></a> every time the data changes, and parses the data into usable data as required.</p> <p><tt class="docutils literal"><span class="pre">Index</span></tt> is responsible for calling <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.source_from_xml" title="Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.source_from_xml"><tt class="xref py py-func docutils literal"><span class="pre">source_from_xml()</span></tt></a> for each <tt class="docutils literal"><span class="pre">Source</span></tt> tag in each file.</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.cachepath"> <tt class="descname">cachepath</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.cachepath" title="Permalink to this definition">¶</a></dt> <dd><p>The full path to the directory where <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source" title="Bcfg2.Server.Plugins.Packages.Source.Source"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source</span></tt></a> data will be cached</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.loaded"> <tt class="descname">loaded</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/PackagesSources.html#PackagesSources.loaded"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.loaded" title="Permalink to this definition">¶</a></dt> <dd><p>Whether or not all XML files (<tt class="docutils literal"><span class="pre">sources.xml</span></tt> and everything XIncluded in it) have been parsed. This flag is used to determine if the Packages plugin should be told to load its data.</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.parsed"> <tt class="descname">parsed</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.parsed" title="Permalink to this definition">¶</a></dt> <dd><p>The set of all XML files that have been successfully parsed. This is used by <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.loaded" title="Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.loaded"><tt class="xref py py-attr docutils literal"><span class="pre">loaded</span></tt></a> to determine if the sources have been fully parsed and the <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Packages" title="Bcfg2.Server.Plugins.Packages.Packages"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Packages</span></tt></a> plugin should be told to reload its data.</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.pkg_obj"> <tt class="descname">pkg_obj</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.pkg_obj" title="Permalink to this definition">¶</a></dt> <dd><p>The <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Packages" title="Bcfg2.Server.Plugins.Packages.Packages"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Packages</span></tt></a> that instantiated this <tt class="docutils literal"><span class="pre">PackagesSources</span></tt> object</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.set_debug"> <tt class="descname">set_debug</tt><big>(</big><em>debug</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/PackagesSources.html#PackagesSources.set_debug"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.set_debug" title="Permalink to this definition">¶</a></dt> <dd><p>Explicitly enable or disable debugging. This method is exposed via XML-RPC.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">bool - The new value of the debug flag</td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.setup"> <tt class="descname">setup</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.setup" title="Permalink to this definition">¶</a></dt> <dd><p>The Bcfg2 options dict</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.source_from_xml"> <tt class="descname">source_from_xml</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/PackagesSources.html#PackagesSources.source_from_xml"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.PackagesSources.PackagesSources.source_from_xml" title="Permalink to this definition">¶</a></dt> <dd><p>Create a <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source" title="Bcfg2.Server.Plugins.Packages.Source.Source"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source</span></tt></a> subclass object from XML representation of a source in <tt class="docutils literal"><span class="pre">sources.xml</span></tt>. <tt class="docutils literal"><span class="pre">source_from-xml</span></tt> determines the appropriate subclass of <tt class="docutils literal"><span class="pre">Source</span></tt> to instantiate according to the <tt class="docutils literal"><span class="pre">type</span></tt> attribute of the <tt class="docutils literal"><span class="pre">Source</span></tt> tag.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>xsource</strong> (<em>lxml.etree._Element</em>) – The XML tag representing the source</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source" title="Bcfg2.Server.Plugins.Packages.Source.Source"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source</span></tt></a> subclass, or None on error</td> </tr> </tbody> </table> </dd></dl> </dd></dl> </div> <div class="section" id="existing-packages-backends"> <h2>Existing Packages Backends<a class="headerlink" href="#existing-packages-backends" title="Permalink to this headline">¶</a></h2> <div class="section" id="module-Bcfg2.Server.Plugins.Packages.Yum"> <span id="yum"></span><h3>Yum<a class="headerlink" href="#module-Bcfg2.Server.Plugins.Packages.Yum" title="Permalink to this headline">¶</a></h3> <p>Yum backend for <a class="reference internal" href="#module-Bcfg2.Server.Plugins.Packages" title="Bcfg2.Server.Plugins.Packages"><tt class="xref py py-mod docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages</span></tt></a>. This module is the most complex backend because it has to handle Yum sources without yum Python libraries, with yum Python libraries, and Pulp sources. (See <a class="reference internal" href="../server/plugins/generators/packages.html#native-yum-libraries"><em>Using Native Yum Libraries</em></a> for details on using the yum Python libraries and <a class="reference internal" href="../server/plugins/generators/packages.html#pulp-source-support"><em>Pulp Support</em></a> for details on Pulp sources.)</p> <div class="section" id="bcfg2-yum-helper"> <span id="id1"></span><h4>bcfg2-yum-helper<a class="headerlink" href="#bcfg2-yum-helper" title="Permalink to this headline">¶</a></h4> <p>If using the yum Python libraries, <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection" title="Bcfg2.Server.Plugins.Packages.Yum.YumCollection"><tt class="xref py py-class docutils literal"><span class="pre">YumCollection</span></tt></a> makes shell calls to an external command, <tt class="docutils literal"><span class="pre">bcfg2-yum-helper</span></tt>, which performs the actual yum API calls. This is done because the yum libs have horrific memory leaks, and apparently the right way to get around that in long-running processes it to have a short-lived helper. This is how it’s done by yum itself in <tt class="docutils literal"><span class="pre">yum-updatesd</span></tt>, which is a long-running daemon that checks for and applies updates.</p> </div> <div class="section" id="package-objects"> <span id="yum-pkg-objects"></span><h4>Package Objects<a class="headerlink" href="#package-objects" title="Permalink to this headline">¶</a></h4> <p><a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection</span></tt></a> objects have the option to translate from some backend-specific representation of packages to XML entries; see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a> for more information on this. If you are using the Python yum libraries, <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection" title="Bcfg2.Server.Plugins.Packages.Yum.YumCollection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Yum.YumCollection</span></tt></a> opts to do this, using the yum tuple representation of packages, which is:</p> <div class="highlight-python"><pre>(<name>, <arch>, <epoch>, <version>, <release>)</pre> </div> <p>For shorthand this is occasionally abbrevated “naevr”. Any datum that is not defined is <tt class="docutils literal"><span class="pre">None</span></tt>. So a normal package entry that can be any version would be passed to <a class="reference internal" href="#bcfg2-yum-helper"><em>bcfg2-yum-helper</em></a> as:</p> <div class="highlight-python"><div class="highlight"><pre><span class="p">(</span><span class="s">"somepackage"</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span> </pre></div> </div> <p>A package returned from the helper might look more like this:</p> <div class="highlight-python"><div class="highlight"><pre><span class="p">(</span><span class="s">"somepackage"</span><span class="p">,</span> <span class="s">"x86_64"</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="s">"1.2.3"</span><span class="p">,</span> <span class="s">"1.el6"</span><span class="p">)</span> </pre></div> </div> <p>We translate between this representation and the XML representation of packages with <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.packages_from_entry" title="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.packages_from_entry"><tt class="xref py py-func docutils literal"><span class="pre">YumCollection.packages_from_entry()</span></tt></a> and <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.packages_to_entry" title="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.packages_to_entry"><tt class="xref py py-func docutils literal"><span class="pre">YumCollection.packages_to_entry()</span></tt></a>.</p> </div> <div class="section" id="the-yum-backend"> <h4>The Yum Backend<a class="headerlink" href="#the-yum-backend" title="Permalink to this headline">¶</a></h4> <dl class="data"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.HELPER"> <tt class="descclassname">Bcfg2.Server.Plugins.Packages.Yum.</tt><tt class="descname">HELPER</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.HELPER" title="Permalink to this definition">¶</a></dt> <dd><p>The path to bcfg2-yum-helper</p> </dd></dl> <dl class="class"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.PulpCertificateData"> <em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugins.Packages.Yum.</tt><tt class="descname">PulpCertificateData</tt><big>(</big><em>name</em>, <em>specific</em>, <em>encoding</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#PulpCertificateData"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.PulpCertificateData" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="plugins.html#Bcfg2.Server.Plugin.helpers.SpecificData" title="Bcfg2.Server.Plugin.helpers.SpecificData"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.SpecificData</span></tt></a></p> <p>Handle pulp consumer certificate data for <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Yum.PulpCertificateSet" title="Bcfg2.Server.Plugins.Packages.Yum.PulpCertificateSet"><tt class="xref py py-class docutils literal"><span class="pre">PulpCertificateSet</span></tt></a></p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>name</strong> (<em>string</em>) – The full path to the file</li> <li><strong>specific</strong> (<a class="reference internal" href="plugins.html#Bcfg2.Server.Plugin.helpers.Specificity" title="Bcfg2.Server.Plugin.helpers.Specificity"><em>Bcfg2.Server.Plugin.helpers.Specificity</em></a>) – A <a class="reference internal" href="plugins.html#Bcfg2.Server.Plugin.helpers.Specificity" title="Bcfg2.Server.Plugin.helpers.Specificity"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.Specificity</span></tt></a> object describing what clients this file applies to.</li> <li><strong>encoding</strong> (<em>string</em>) – The encoding to use for data in this file</li> </ul> </td> </tr> </tbody> </table> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.PulpCertificateData.bind_entry"> <tt class="descname">bind_entry</tt><big>(</big><em>entry</em>, <em>_</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#PulpCertificateData.bind_entry"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.PulpCertificateData.bind_entry" title="Permalink to this definition">¶</a></dt> <dd><p>Given an abstract entry, add data to it and return it. <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Yum.PulpCertificateSet" title="Bcfg2.Server.Plugins.Packages.Yum.PulpCertificateSet"><tt class="xref py py-class docutils literal"><span class="pre">PulpCertificateSet</span></tt></a> handles binding entry metadata.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>entry</strong> (<em>lxml.etree._Element</em>) – The abstract entry to bind data to</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">lxml.etree._Element - the bound entry</td> </tr> </tbody> </table> </dd></dl> </dd></dl> <dl class="class"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.PulpCertificateSet"> <em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugins.Packages.Yum.</tt><tt class="descname">PulpCertificateSet</tt><big>(</big><em>path</em>, <em>fam</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#PulpCertificateSet"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.PulpCertificateSet" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="plugins.html#Bcfg2.Server.Plugin.helpers.EntrySet" title="Bcfg2.Server.Plugin.helpers.EntrySet"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.EntrySet</span></tt></a></p> <p>Handle Pulp consumer certificates.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>path</strong> (<em>string</em>) – The path to the directory where Pulp consumer certificates will be stored</td> </tr> </tbody> </table> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.PulpCertificateSet.HandleEvent"> <tt class="descname">HandleEvent</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#PulpCertificateSet.HandleEvent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.PulpCertificateSet.HandleEvent" title="Permalink to this definition">¶</a></dt> <dd><p>Handle FAM events on certificate files.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>event</strong> (<a class="reference internal" href="fam.html#Bcfg2.Server.FileMonitor.Event" title="Bcfg2.Server.FileMonitor.Event"><em>Bcfg2.Server.FileMonitor.Event</em></a>) – The event to handle</td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.PulpCertificateSet.certpath"> <tt class="descname">certpath</tt><em class="property"> = '/etc/pki/consumer/cert.pem'</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.PulpCertificateSet.certpath" title="Permalink to this definition">¶</a></dt> <dd><p>The path to certificates on consumer machines</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.PulpCertificateSet.verify_file"> <tt class="descname">verify_file</tt><big>(</big><em>filename</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#PulpCertificateSet.verify_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.PulpCertificateSet.verify_file" title="Permalink to this definition">¶</a></dt> <dd><p>Service the FAM events queued up by the key generation so the data structure entries will be available for binding.</p> <p>NOTE: We wait for up to ten seconds. There is some potential for race condition, because if the file monitor doesn’t get notified about the new key files in time, those entries won’t be available for binding. In practice, this seems “good enough.”</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<em>string</em>) – The filename to check for events on</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.PulpCertificateSet.write_data"> <tt class="descname">write_data</tt><big>(</big><em>data</em>, <em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#PulpCertificateSet.write_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.PulpCertificateSet.write_data" title="Permalink to this definition">¶</a></dt> <dd><p>Write a new certificate to the filesystem.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>data</strong> (<em>string</em>) – The new certificate data</li> <li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) – Metadata for the client to write the certificate for</li> </ul> </td> </tr> </tbody> </table> </dd></dl> </dd></dl> <dl class="class"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection"> <em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugins.Packages.Yum.</tt><tt class="descname">YumCollection</tt><big>(</big><em>metadata</em>, <em>sources</em>, <em>cachepath</em>, <em>basepath</em>, <em>fam</em>, <em>debug=False</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumCollection"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection</span></tt></a></p> <p>Handle collections of Yum sources. If we’re using the yum Python libraries, then this becomes a very full-featured <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection</span></tt></a> object; if not, then it defers to the <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource" title="Bcfg2.Server.Plugins.Packages.Yum.YumSource"><tt class="xref py py-class docutils literal"><span class="pre">YumSource</span></tt></a> object.</p> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection._add_gpg_instances"> <tt class="descname">_add_gpg_instances</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumCollection._add_gpg_instances"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection._add_gpg_instances" title="Permalink to this definition">¶</a></dt> <dd><p>Add GPG keys instances to a <tt class="docutils literal"><span class="pre">Package</span></tt> entry. This is called from <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.build_extra_structures" title="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.build_extra_structures"><tt class="xref py py-func docutils literal"><span class="pre">build_extra_structures()</span></tt></a> to add GPG keys to the specification.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>keyentry</strong> (<em>lxml.etree._Element</em>) – The <tt class="docutils literal"><span class="pre">Package</span></tt> entry to add key instances to. This will be modified in place.</li> <li><strong>localkey</strong> (<em>string</em>) – The full path to the key file on the Bcfg2 server</li> <li><strong>remotekey</strong> (<em>string</em>) – The full path to the key file on the client. (If they key is not yet on the client, this will be the full path to where the key file will go eventually.)</li> <li><strong>keydata</strong> (<em>string</em>) – The contents of the key file. If this is not provided, read the data from <tt class="docutils literal"><span class="pre">localkey</span></tt>.</li> </ul> </td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection._get_pulp_consumer"> <tt class="descname">_get_pulp_consumer</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumCollection._get_pulp_consumer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection._get_pulp_consumer" title="Permalink to this definition">¶</a></dt> <dd><p>Get a Pulp consumer object for the client.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>consumerapi</strong> (<em>pulp.client.api.consumer.ConsumerAPI</em>) – A Pulp ConsumerAPI object. If none is passed, one will be instantiated.</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">dict - the consumer. Returns None on failure (including if there is no existing Pulp consumer for this client.</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.build_extra_structures"> <tt class="descname">build_extra_structures</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumCollection.build_extra_structures"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.build_extra_structures" title="Permalink to this definition">¶</a></dt> <dd><p>Add additional entries to the <tt class="docutils literal"><span class="pre"><Independent/></span></tt> section of the final configuration. This adds several kinds of entries:</p> <ul class="simple"> <li>For GPG keys, adds a <tt class="docutils literal"><span class="pre">Package</span></tt> entry that describes the version and release of all expected <tt class="docutils literal"><span class="pre">gpg-pubkey</span></tt> packages; and <tt class="docutils literal"><span class="pre">Path</span></tt> entries to copy all of the GPG keys to the appropriate place on the client filesystem. Calls <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection._add_gpg_instances" title="Bcfg2.Server.Plugins.Packages.Yum.YumCollection._add_gpg_instances"><tt class="xref py py-func docutils literal"><span class="pre">_add_gpg_instances()</span></tt></a>.</li> <li>For Pulp Sources, adds a <tt class="docutils literal"><span class="pre">Path</span></tt> entry for the consumer certificate; and <tt class="docutils literal"><span class="pre">Action</span></tt> entries to update the consumer-side Pulp config if the consumer is newly registered. Creates a new Pulp consumer from the Bcfg2 server as necessary.</li> </ul> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>independent</strong> (<em>lxml.etree._Element</em>) – The XML tag to add extra entries to. This is modified in place.</td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.cachefile"> <tt class="descname">cachefile</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.cachefile" title="Permalink to this definition">¶</a></dt> <dd><p>Define a unique cache file for this collection to use for cached yum metadata</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.cachefiles"> <tt class="descname">cachefiles</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumCollection.cachefiles"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.cachefiles" title="Permalink to this definition">¶</a></dt> <dd><p>A list of the full path to all cachefiles used by this collection.</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.call_helper"> <tt class="descname">call_helper</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumCollection.call_helper"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.call_helper" title="Permalink to this definition">¶</a></dt> <dd><p>Make a call to <a class="reference internal" href="#bcfg2-yum-helper"><em>bcfg2-yum-helper</em></a>. The yum libs have horrific memory leaks, so apparently the right way to get around that in long-running processes it to have a short-lived helper. No, seriously – check out the yum-updatesd code. It’s pure madness.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>command</strong> (<em>string</em>) – The <a class="reference internal" href="#bcfg2-yum-helper"><em>bcfg2-yum-helper</em></a> command to call.</li> <li><strong>inputdata</strong> (<em>Any JSON-encodable data structure.</em>) – The input to pass to <tt class="docutils literal"><span class="pre">bcfg2-yum-helper</span></tt> on stdin. If this is None, no input will be given at all.</li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">Varies depending on the return value of the <tt class="docutils literal"><span class="pre">bcfg2-yum-helper</span></tt> command.</p> </td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.cfgfile"> <tt class="descname">cfgfile</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.cfgfile" title="Permalink to this definition">¶</a></dt> <dd><p>The path to the server-side config file used when resolving packages with the Python yum libraries</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.complete"> <tt class="descname">complete</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumCollection.complete"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.complete" title="Permalink to this definition">¶</a></dt> <dd><p>Build a complete list of all packages and their dependencies.</p> <p>When using the Python yum libraries, this defers to the <a class="reference internal" href="#bcfg2-yum-helper"><em>bcfg2-yum-helper</em></a>; when using the builtin yum parser, this defers to <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.complete" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.complete"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection.complete()</span></tt></a>.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>packagelist</strong> (set of strings, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a>) – Set of initial packages computed from the specification.</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">tuple of sets - The first element contains a set of strings (but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a>) describing the complete package list, and the second element is a set of symbols whose dependencies could not be resolved.</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.get_config"> <tt class="descname">get_config</tt><big>(</big><em>raw=False</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumCollection.get_config"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.get_config" title="Permalink to this definition">¶</a></dt> <dd><p>Get the yum configuration for this collection.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>raw</strong> (<em>bool</em>) – Return a <tt class="xref py py-class docutils literal"><span class="pre">ConfigParser.SafeConfigParser</span></tt> object representing the configuration instead of a string. This is useful if you need to modify the config before writing it (as <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.write_config" title="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.write_config"><tt class="xref py py-func docutils literal"><span class="pre">write_config()</span></tt></a> does in order to produce a server-specific configuration).</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">string or ConfigParser.SafeConfigParser</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.get_groups"> <tt class="descname">get_groups</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumCollection.get_groups"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.get_groups" title="Permalink to this definition">¶</a></dt> <dd><p>If using the yum libraries, given a list of package group names, return a dict of <tt class="docutils literal"><span class="pre"><group</span> <span class="pre">name>:</span> <span class="pre"><list</span> <span class="pre">of</span> <span class="pre">packages></span></tt>. This is much faster than implementing <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.get_group" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.get_group"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection.get_group()</span></tt></a>, since we have to make a call to the bcfg2 Yum helper, and each time we do that we make another call to yum, which means we set up yum metadata from the cache (hopefully) each time. So resolving ten groups once is much faster than resolving one group ten times.</p> <p>If you are using the builtin yum parser, this raises a warning and returns an empty dict.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>grouplist</strong> (<em>list of strings - group names</em>) – The list of groups to query</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">dict of <tt class="docutils literal"><span class="pre"><group</span> <span class="pre">name>:</span> <span class="pre"><list</span> <span class="pre">of</span> <span class="pre">packages></span></tt></td> </tr> </tbody> </table> <p>In this implementation the packages may be strings or tuples. See <a class="reference internal" href="#yum-pkg-objects"><em>Package Objects</em></a> for more information.</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.get_new_packages"> <tt class="descname">get_new_packages</tt><big>(</big><em>initial</em>, <em>complete</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumCollection.get_new_packages"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.get_new_packages" title="Permalink to this definition">¶</a></dt> <dd><p>Compute the difference between the complete package list (as returned by <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.complete" title="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.complete"><tt class="xref py py-func docutils literal"><span class="pre">complete()</span></tt></a>) and the initial package list computed from the specification, allowing for package tuples. See <a class="reference internal" href="#yum-pkg-objects"><em>Package Objects</em></a> and <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a> for more information on this process.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>initial</strong> (set of strings, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a>) – The initial package list</li> <li><strong>complete</strong> (set of strings, but see <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a>) – The final package list</li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">set of tuples</p> </td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.has_pulp_sources"> <tt class="descname">has_pulp_sources</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumCollection.has_pulp_sources"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.has_pulp_sources" title="Permalink to this definition">¶</a></dt> <dd><p>True if there are any Pulp sources to handle, False otherwise</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.helper"> <tt class="descname">helper</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumCollection.helper"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.helper" title="Permalink to this definition">¶</a></dt> <dd><p>The full path to <tt class="file docutils literal"><span class="pre">bcfg2-yum-helper</span></tt>. First, we check in the config file to see if it has been explicitly specified; next we see if it’s in $PATH (which we do by making a call to it; I wish there was a way to do this without forking, but apparently not); finally we check in /usr/sbin, the default location.</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.option_blacklist"> <tt class="descname">option_blacklist</tt><em class="property"> = ['use_yum_libraries', 'helper']</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.option_blacklist" title="Permalink to this definition">¶</a></dt> <dd><p>Options that are included in the [packages:yum] section of the config but that should not be included in the temporary yum.conf we write out</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.packages_from_entry"> <tt class="descname">packages_from_entry</tt><big>(</big><em>entry</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumCollection.packages_from_entry"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.packages_from_entry" title="Permalink to this definition">¶</a></dt> <dd><p>When using the Python yum libraries, convert a Package entry to a list of package tuples. See <a class="reference internal" href="#yum-pkg-objects"><em>Package Objects</em></a> and <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a> for more information on this process.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>entry</strong> (<em>lxml.etree._Element</em>) – The Package entry to convert</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of tuples</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.packages_to_entry"> <tt class="descname">packages_to_entry</tt><big>(</big><em>pkglist</em>, <em>entry</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumCollection.packages_to_entry"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.packages_to_entry" title="Permalink to this definition">¶</a></dt> <dd><p>When using the Python yum libraries, convert a list of package tuples to a Package entry. See <a class="reference internal" href="#yum-pkg-objects"><em>Package Objects</em></a> and <a class="reference internal" href="#pkg-objects"><em>Conversion Between Package Objects and XML Entries</em></a> for more information on this process.</p> <p>If pkglist contains only one package, then its data is converted to a single <tt class="docutils literal"><span class="pre">BoundPackage</span></tt> entry that is added as a subelement of <tt class="docutils literal"><span class="pre">entry</span></tt>. If pkglist contains more than one package, then a parent <tt class="docutils literal"><span class="pre">BoundPackage</span></tt> entry is created and child <tt class="docutils literal"><span class="pre">Instance</span></tt> entries are added to it.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>pkglist</strong> (<em>list of tuples</em>) – A list of package tuples to convert to an XML Package entry</li> <li><strong>entry</strong> (<em>lxml.etree._Element</em>) – The base XML entry to add Package entries to. This is modified in place.</li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">None</p> </td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.pulp_cert_set"> <tt class="descname">pulp_cert_set</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.pulp_cert_set" title="Permalink to this definition">¶</a></dt> <dd><p><a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Yum.PulpCertificateSet" title="Bcfg2.Server.Plugins.Packages.Yum.PulpCertificateSet"><tt class="xref py py-class docutils literal"><span class="pre">PulpCertificateSet</span></tt></a> object used to handle Pulp certs</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.setup_data"> <tt class="descname">setup_data</tt><big>(</big><em>force_update=False</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumCollection.setup_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.setup_data" title="Permalink to this definition">¶</a></dt> <dd><p>Do any collection-level data setup tasks. This is called when sources are loaded or reloaded by <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Packages" title="Bcfg2.Server.Plugins.Packages.Packages"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Packages</span></tt></a>.</p> <p>If the builtin yum parsers are in use, this defers to <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.setup_data" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.setup_data"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection.setup_data()</span></tt></a>. If using the yum Python libraries, this cleans up cached yum metadata, regenerates the server-side yum config (in order to catch any new sources that have been added to this server), and then cleans up cached yum metadata again, in case the new config has any preexisting cache.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>force_update</strong> (<em>bool</em>) – Ignore all local cache and setup data from its original upstream sources (i.e., the package repositories)</td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.use_yum"> <tt class="descname">use_yum</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumCollection.use_yum"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.use_yum" title="Permalink to this definition">¶</a></dt> <dd><p>True if we should use the yum Python libraries, False otherwise</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.write_config"> <tt class="descname">write_config</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumCollection.write_config"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.write_config" title="Permalink to this definition">¶</a></dt> <dd><p>Write the server-side config file to <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.cfgfile" title="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.cfgfile"><tt class="xref py py-attr docutils literal"><span class="pre">cfgfile</span></tt></a> based on the data from <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Yum.YumCollection.get_config" title="Bcfg2.Server.Plugins.Packages.Yum.YumCollection.get_config"><tt class="xref py py-func docutils literal"><span class="pre">get_config()</span></tt></a></p> </dd></dl> </dd></dl> <dl class="class"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumSource"> <em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugins.Packages.Yum.</tt><tt class="descname">YumSource</tt><big>(</big><em>basepath</em>, <em>xsource</em>, <em>setup</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumSource"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source" title="Bcfg2.Server.Plugins.Packages.Source.Source"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source</span></tt></a></p> <p>Handle yum sources</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>basepath</strong> (<em>string</em>) – The base filesystem path under which cache data for this source should be stored</li> <li><strong>xsource</strong> – The XML tag that describes this source</li> <li><strong>setup</strong> (<em>dict</em>) – A Bcfg2 options dict</li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body"><p class="first last"><a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.SourceInitError" title="Bcfg2.Server.Plugins.Packages.Source.SourceInitError"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.SourceInitError</span></tt></a></p> </td> </tr> </tbody> </table> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumSource.basegroups"> <tt class="descname">basegroups</tt><em class="property"> = ['yum', 'redhat', 'centos', 'fedora']</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource.basegroups" title="Permalink to this definition">¶</a></dt> <dd><p><a class="reference internal" href="../server/plugins/generators/packages.html#server-plugins-generators-packages-magic-groups"><em>“Magic Groups”</em></a> for <tt class="docutils literal"><span class="pre">YumSource</span></tt> are “yum”, “redhat”, “centos”, and “fedora”</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumSource.filter_unknown"> <tt class="descname">filter_unknown</tt><big>(</big><em>unknown</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumSource.filter_unknown"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource.filter_unknown" title="Permalink to this definition">¶</a></dt> <dd><p>After <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection.complete" title="Bcfg2.Server.Plugins.Packages.Collection.Collection.complete"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection.complete()</span></tt></a>, filter out packages that appear in the list of unknown packages but should not be presented to the user. <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource.unknown_filter" title="Bcfg2.Server.Plugins.Packages.Yum.YumSource.unknown_filter"><tt class="xref py py-attr docutils literal"><span class="pre">unknown_filter</span></tt></a> is called to assess whether or not a package is expected to be unknown.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>unknown</strong> (<em>set of strings</em>) – A set of unknown packages. The set should be modified in place.</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumSource.get_repo_name"> <tt class="descname">get_repo_name</tt><big>(</big><em>url_map</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumSource.get_repo_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource.get_repo_name" title="Permalink to this definition">¶</a></dt> <dd><p>Try to find a sensible name for a repository. First use a repository’s Pulp ID, if it has one; if not, then defer to <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.get_repo_name" title="Bcfg2.Server.Plugins.Packages.Source.Source.get_repo_name"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.get_repo_name</span></tt></a></p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>url_map</strong> (<em>dict</em>) – A single <tt class="xref py py-attr docutils literal"><span class="pre">url_map</span></tt> dict, i.e., any single element of <tt class="xref py py-attr docutils literal"><span class="pre">url_map</span></tt>.</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">string - the name of the repository.</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumSource.get_vpkgs"> <tt class="descname">get_vpkgs</tt><big>(</big><em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumSource.get_vpkgs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource.get_vpkgs" title="Permalink to this definition">¶</a></dt> <dd><p>Get a list of all virtual packages provided by all sources.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">list of strings</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumSource.is_package"> <tt class="descname">is_package</tt><big>(</big><em>metadata</em>, <em>package</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumSource.is_package"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource.is_package" title="Permalink to this definition">¶</a></dt> <dd><p>Return True if a package is a package, False otherwise.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>package</strong> (<em>string</em>) – The name of the package</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">bool</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumSource.load_state"> <tt class="descname">load_state</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumSource.load_state"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource.load_state" title="Permalink to this definition">¶</a></dt> <dd><p>If using the builtin yum parser, load saved state from <tt class="xref py py-attr docutils literal"><span class="pre">cachefile</span></tt>. If using the Python yum libraries, yum handles caching and state and this method is a no-op.</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumSource.parse_filelist"> <tt class="descname">parse_filelist</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumSource.parse_filelist"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource.parse_filelist" title="Permalink to this definition">¶</a></dt> <dd><p>parse filelists.xml.gz data</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumSource.parse_primary"> <tt class="descname">parse_primary</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumSource.parse_primary"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource.parse_primary" title="Permalink to this definition">¶</a></dt> <dd><p>parse primary.xml.gz data</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumSource.ptype"> <tt class="descname">ptype</tt><em class="property"> = 'yum'</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource.ptype" title="Permalink to this definition">¶</a></dt> <dd><p>YumSource sets the <tt class="docutils literal"><span class="pre">type</span></tt> on Package entries to “yum”</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumSource.read_files"> <tt class="descname">read_files</tt><big>(</big><em>obj</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumSource.read_files"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource.read_files" title="Permalink to this definition">¶</a></dt> <dd><p>When using the builtin yum parser, read and parse locally downloaded metadata files. This diverges from the stock <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.read_files" title="Bcfg2.Server.Plugins.Packages.Source.Source.read_files"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.read_files()</span></tt></a> quite a bit.</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumSource.save_state"> <tt class="descname">save_state</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumSource.save_state"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource.save_state" title="Permalink to this definition">¶</a></dt> <dd><p>If using the builtin yum parser, save state to <tt class="xref py py-attr docutils literal"><span class="pre">cachefile</span></tt>. If using the Python yum libraries, yum handles caching and state and this method is a no-op.</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumSource.setup_data"> <tt class="descname">setup_data</tt><big>(</big><em>force_update=False</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumSource.setup_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource.setup_data" title="Permalink to this definition">¶</a></dt> <dd><p><tt class="docutils literal"><span class="pre">setup_data</span></tt> is only used by the builtin yum parser. Perform all data fetching and setup tasks. For most backends, this involves downloading all metadata from the repository, parsing it, and caching the parsed data locally. The order of operations is:</p> <ol class="arabic simple"> <li>Call <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource.load_state" title="Bcfg2.Server.Plugins.Packages.Yum.YumSource.load_state"><tt class="xref py py-func docutils literal"><span class="pre">load_state()</span></tt></a> to try to load data from the local cache.</li> <li>If that fails, call <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource.read_files" title="Bcfg2.Server.Plugins.Packages.Yum.YumSource.read_files"><tt class="xref py py-func docutils literal"><span class="pre">read_files()</span></tt></a> to read and parse the locally downloaded metadata files.</li> <li>If that fails, call <tt class="xref py py-func docutils literal"><span class="pre">update()</span></tt> to fetch the metadata, then <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource.read_files" title="Bcfg2.Server.Plugins.Packages.Yum.YumSource.read_files"><tt class="xref py py-func docutils literal"><span class="pre">read_files()</span></tt></a> to parse it.</li> </ol> <p>Obviously with a backend that leverages repo access libraries to avoid downloading all metadata, many of the functions called by <tt class="docutils literal"><span class="pre">setup_data</span></tt> can be no-ops (or nearly so).</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>force_update</strong> (<em>bool</em>) – Ignore all locally cached and downloaded data and fetch the metadata anew from the upstream repository.</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumSource.unknown_filter"> <tt class="descname">unknown_filter</tt><big>(</big><em>package</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumSource.unknown_filter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource.unknown_filter" title="Permalink to this definition">¶</a></dt> <dd><p>By default, <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source" title="Bcfg2.Server.Plugins.Packages.Source.Source"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source</span></tt></a> filters out unknown packages that start with “choice”, but that doesn’t mean anything to Yum or RPM. Instead, we filter out unknown packages that start with “rpmlib”, although this is likely legacy behavior; that would seem to indicate that a package required some RPM feature that isn’t provided, which is a bad thing. This should probably go away at some point.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>package</strong> (<em>string</em>) – The name of a package that was unknown to the backend</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">bool</td> </tr> </tbody> </table> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumSource.urls"> <tt class="descname">urls</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumSource.urls"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource.urls" title="Permalink to this definition">¶</a></dt> <dd><p>A list of URLs to the base metadata file for each repository described by this source.</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Yum.YumSource.use_yum"> <tt class="descname">use_yum</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Yum.html#YumSource.use_yum"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Yum.YumSource.use_yum" title="Permalink to this definition">¶</a></dt> <dd><p>True if we should use the yum Python libraries, False otherwise</p> </dd></dl> </dd></dl> </div> </div> <div class="section" id="module-Bcfg2.Server.Plugins.Packages.Apt"> <span id="apt"></span><h3>APT<a class="headerlink" href="#module-Bcfg2.Server.Plugins.Packages.Apt" title="Permalink to this headline">¶</a></h3> <p>APT backend for <a class="reference internal" href="#module-Bcfg2.Server.Plugins.Packages" title="Bcfg2.Server.Plugins.Packages"><tt class="xref py py-mod docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages</span></tt></a></p> <dl class="class"> <dt id="Bcfg2.Server.Plugins.Packages.Apt.AptCollection"> <em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugins.Packages.Apt.</tt><tt class="descname">AptCollection</tt><big>(</big><em>metadata</em>, <em>sources</em>, <em>cachepath</em>, <em>basepath</em>, <em>fam</em>, <em>debug=False</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Apt.html#AptCollection"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Apt.AptCollection" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection</span></tt></a></p> <p>Handle collections of APT sources. This is a no-op object that simply inherits from <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection</span></tt></a>, overrides nothing, and defers all operations to <tt class="xref py py-class docutils literal"><span class="pre">PacSource</span></tt></p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) – The client metadata for this collection</li> <li><strong>sources</strong> (list of <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source" title="Bcfg2.Server.Plugins.Packages.Source.Source"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source</span></tt></a> objects) – A list of all sources known to the server that will be used to generate the list of sources that apply to this client</li> <li><strong>cachepath</strong> (<em>string</em>) – The filesystem path where cache and other temporary data will be stored</li> <li><strong>basepath</strong> (<em>string</em>) – The filesystem path to the Packages plugin directory, where more permanent data can be stored</li> <li><strong>fam</strong> (<a class="reference internal" href="fam.html#Bcfg2.Server.FileMonitor.FileMonitor" title="Bcfg2.Server.FileMonitor.FileMonitor"><em>Bcfg2.Server.FileMonitor.FileMonitor</em></a>) – A file monitor object to use if this Collection needs to monitor for file activity</li> <li><strong>debug</strong> (<em>bool</em>) – Enable debugging output</li> </ul> </td> </tr> </tbody> </table> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Apt.AptCollection.get_config"> <tt class="descname">get_config</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Apt.html#AptCollection.get_config"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Apt.AptCollection.get_config" title="Permalink to this definition">¶</a></dt> <dd><p>Get an APT configuration file (i.e., <tt class="docutils literal"><span class="pre">sources.list</span></tt>).</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">string</td> </tr> </tbody> </table> </dd></dl> </dd></dl> <dl class="class"> <dt id="Bcfg2.Server.Plugins.Packages.Apt.AptSource"> <em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugins.Packages.Apt.</tt><tt class="descname">AptSource</tt><big>(</big><em>basepath</em>, <em>xsource</em>, <em>setup</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Apt.html#AptSource"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Apt.AptSource" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source" title="Bcfg2.Server.Plugins.Packages.Source.Source"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source</span></tt></a></p> <p>Handle APT sources</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>basepath</strong> (<em>string</em>) – The base filesystem path under which cache data for this source should be stored</li> <li><strong>xsource</strong> – The XML tag that describes this source</li> <li><strong>setup</strong> (<em>dict</em>) – A Bcfg2 options dict</li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body"><p class="first last"><a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.SourceInitError" title="Bcfg2.Server.Plugins.Packages.Source.SourceInitError"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.SourceInitError</span></tt></a></p> </td> </tr> </tbody> </table> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Apt.AptSource.basegroups"> <tt class="descname">basegroups</tt><em class="property"> = ['apt', 'debian', 'ubuntu', 'nexenta']</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Apt.AptSource.basegroups" title="Permalink to this definition">¶</a></dt> <dd><p><a class="reference internal" href="../server/plugins/generators/packages.html#server-plugins-generators-packages-magic-groups"><em>“Magic Groups”</em></a> for <tt class="docutils literal"><span class="pre">AptSource</span></tt> are “apt”, “debian”, “ubuntu”, and “nexenta”</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Apt.AptSource.ptype"> <tt class="descname">ptype</tt><em class="property"> = 'deb'</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Apt.AptSource.ptype" title="Permalink to this definition">¶</a></dt> <dd><p>AptSource sets the <tt class="docutils literal"><span class="pre">type</span></tt> on Package entries to “deb”</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Apt.AptSource.read_files"> <tt class="descname">read_files</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Apt.html#AptSource.read_files"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Apt.AptSource.read_files" title="Permalink to this definition">¶</a></dt> <dd><p>Read and parse locally downloaded metadata files and populates <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.pkgnames" title="Bcfg2.Server.Plugins.Packages.Source.Source.pkgnames"><tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.pkgnames</span></tt></a>. Should call <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.process_files" title="Bcfg2.Server.Plugins.Packages.Source.Source.process_files"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.process_files()</span></tt></a> as its final step.</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Apt.AptSource.urls"> <tt class="descname">urls</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Apt.html#AptSource.urls"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Apt.AptSource.urls" title="Permalink to this definition">¶</a></dt> <dd><p>A list of URLs to the base metadata file for each repository described by this source.</p> </dd></dl> </dd></dl> </div> <div class="section" id="module-Bcfg2.Server.Plugins.Packages.Pac"> <span id="pacman"></span><h3>Pacman<a class="headerlink" href="#module-Bcfg2.Server.Plugins.Packages.Pac" title="Permalink to this headline">¶</a></h3> <p>Pacman backend for <a class="reference internal" href="#module-Bcfg2.Server.Plugins.Packages" title="Bcfg2.Server.Plugins.Packages"><tt class="xref py py-mod docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages</span></tt></a></p> <dl class="class"> <dt id="Bcfg2.Server.Plugins.Packages.Pac.PacCollection"> <em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugins.Packages.Pac.</tt><tt class="descname">PacCollection</tt><big>(</big><em>metadata</em>, <em>sources</em>, <em>cachepath</em>, <em>basepath</em>, <em>fam</em>, <em>debug=False</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Pac.html#PacCollection"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Pac.PacCollection" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection</span></tt></a></p> <p>Handle collections of Pacman sources. This is a no-op object that simply inherits from <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Collection.Collection" title="Bcfg2.Server.Plugins.Packages.Collection.Collection"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Collection.Collection</span></tt></a>, overrides nothing, and defers all operations to <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Pac.PacSource" title="Bcfg2.Server.Plugins.Packages.Pac.PacSource"><tt class="xref py py-class docutils literal"><span class="pre">PacSource</span></tt></a></p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) – The client metadata for this collection</li> <li><strong>sources</strong> (list of <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source" title="Bcfg2.Server.Plugins.Packages.Source.Source"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source</span></tt></a> objects) – A list of all sources known to the server that will be used to generate the list of sources that apply to this client</li> <li><strong>cachepath</strong> (<em>string</em>) – The filesystem path where cache and other temporary data will be stored</li> <li><strong>basepath</strong> (<em>string</em>) – The filesystem path to the Packages plugin directory, where more permanent data can be stored</li> <li><strong>fam</strong> (<a class="reference internal" href="fam.html#Bcfg2.Server.FileMonitor.FileMonitor" title="Bcfg2.Server.FileMonitor.FileMonitor"><em>Bcfg2.Server.FileMonitor.FileMonitor</em></a>) – A file monitor object to use if this Collection needs to monitor for file activity</li> <li><strong>debug</strong> (<em>bool</em>) – Enable debugging output</li> </ul> </td> </tr> </tbody> </table> </dd></dl> <dl class="class"> <dt id="Bcfg2.Server.Plugins.Packages.Pac.PacSource"> <em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugins.Packages.Pac.</tt><tt class="descname">PacSource</tt><big>(</big><em>basepath</em>, <em>xsource</em>, <em>setup</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Pac.html#PacSource"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Pac.PacSource" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source" title="Bcfg2.Server.Plugins.Packages.Source.Source"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source</span></tt></a></p> <p>Handle Pacman sources</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> <li><strong>basepath</strong> (<em>string</em>) – The base filesystem path under which cache data for this source should be stored</li> <li><strong>xsource</strong> – The XML tag that describes this source</li> <li><strong>setup</strong> (<em>dict</em>) – A Bcfg2 options dict</li> </ul> </td> </tr> <tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body"><p class="first last"><a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.SourceInitError" title="Bcfg2.Server.Plugins.Packages.Source.SourceInitError"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.SourceInitError</span></tt></a></p> </td> </tr> </tbody> </table> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Pac.PacSource.basegroups"> <tt class="descname">basegroups</tt><em class="property"> = ['arch', 'parabola']</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Pac.PacSource.basegroups" title="Permalink to this definition">¶</a></dt> <dd><p><a class="reference internal" href="../server/plugins/generators/packages.html#server-plugins-generators-packages-magic-groups"><em>“Magic Groups”</em></a> for <tt class="docutils literal"><span class="pre">PacSource</span></tt> are “arch” and “parabola”</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Pac.PacSource.ptype"> <tt class="descname">ptype</tt><em class="property"> = 'pacman'</em><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Pac.PacSource.ptype" title="Permalink to this definition">¶</a></dt> <dd><p>PacSource sets the <tt class="docutils literal"><span class="pre">type</span></tt> on Package entries to “pacman”</p> </dd></dl> <dl class="method"> <dt id="Bcfg2.Server.Plugins.Packages.Pac.PacSource.read_files"> <tt class="descname">read_files</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Pac.html#PacSource.read_files"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Pac.PacSource.read_files" title="Permalink to this definition">¶</a></dt> <dd><p>Read and parse locally downloaded metadata files and populates <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.pkgnames" title="Bcfg2.Server.Plugins.Packages.Source.Source.pkgnames"><tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.pkgnames</span></tt></a>. Should call <a class="reference internal" href="#Bcfg2.Server.Plugins.Packages.Source.Source.process_files" title="Bcfg2.Server.Plugins.Packages.Source.Source.process_files"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Packages.Source.Source.process_files()</span></tt></a> as its final step.</p> </dd></dl> <dl class="attribute"> <dt id="Bcfg2.Server.Plugins.Packages.Pac.PacSource.urls"> <tt class="descname">urls</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugins/Packages/Pac.html#PacSource.urls"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugins.Packages.Pac.PacSource.urls" title="Permalink to this definition">¶</a></dt> <dd><p>A list of URLs to the base metadata file for each repository described by this source.</p> </dd></dl> </dd></dl> </div> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="../index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">Developing for Packages</a><ul> <li><a class="reference internal" href="#module-Bcfg2.Server.Plugins.Packages.Collection">The Collection Object</a><ul> <li><a class="reference internal" href="#overriding-methods">Overriding Methods</a></li> <li><a class="reference internal" href="#conversion-between-package-objects-and-xml-entries">Conversion Between Package Objects and XML Entries</a></li> <li><a class="reference internal" href="#the-collection-module">The Collection Module</a></li> </ul> </li> <li><a class="reference internal" href="#module-Bcfg2.Server.Plugins.Packages.Source">The Source Object</a></li> <li><a class="reference internal" href="#module-Bcfg2.Server.Plugins.Packages">The Packages Module</a></li> <li><a class="reference internal" href="#module-Bcfg2.Server.Plugins.Packages.PackagesSources">Packages Source Description</a></li> <li><a class="reference internal" href="#existing-packages-backends">Existing Packages Backends</a><ul> <li><a class="reference internal" href="#module-Bcfg2.Server.Plugins.Packages.Yum">Yum</a><ul> <li><a class="reference internal" href="#bcfg2-yum-helper">bcfg2-yum-helper</a></li> <li><a class="reference internal" href="#package-objects">Package Objects</a></li> <li><a class="reference internal" href="#the-yum-backend">The Yum Backend</a></li> </ul> </li> <li><a class="reference internal" href="#module-Bcfg2.Server.Plugins.Packages.Apt">APT</a></li> <li><a class="reference internal" href="#module-Bcfg2.Server.Plugins.Packages.Pac">Pacman</a></li> </ul> </li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="cfg.html" title="previous chapter">Cfg Handler Development</a></p> <h4>Next topic</h4> <p class="topless"><a href="setup.html" title="next chapter">Environment setup for development</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/development/packages.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="setup.html" title="Environment setup for development" >next</a> |</li> <li class="right" > <a href="cfg.html" title="Cfg Handler Development" >previous</a> |</li> <li><a href="../index.html">home</a> | </li> <!--<li><a href="../search.html">search</a> | </li>--> <li><a href="../help/index.html">help</a> | </li> <li><a href="../contents.html">documentation </a> »</li> <li><a href="../contents.html" >Bcfg2 documentation 1.3.0</a> »</li> <li><a href="index.html" >Bcfg2 Development</a> »</li> <li><a href="plugins.html" >Bcfg2 Plugin development</a> »</li> </ul> </div> <div class="footer"> © Copyright 2009-2013, Narayan Desai. Last updated on Mar 20, 2013. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3. </div> </body> </html>