Sophie

Sophie

distrib > Fedora > 17 > i386 > media > updates > by-pkgid > b50d8ee6d7871fcc13c0677a9364ed59 > files > 362

bcfg2-doc-1.3.0-1.fc17.noarch.rpm



<!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>Bcfg2 Plugin development &mdash; 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 Development" href="index.html" />
    <link rel="next" title="Cfg Handler Development" href="cfg.html" />
    <link rel="prev" title="Developing for Packages" href="packages.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="cfg.html" title="Cfg Handler Development"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="packages.html" title="Developing for Packages"
             accesskey="P">previous</a> |</li>
	<li><a href="../index.html">home</a> |&nbsp;</li>
	<!--<li><a href="../search.html">search</a> |&nbsp;</li>-->
	<li><a href="../help/index.html">help</a> |&nbsp;</li>
	<li><a href="../contents.html">documentation </a> &raquo;</li>

          <li><a href="../contents.html" >Bcfg2 documentation 1.3.0</a> &raquo;</li>
          <li><a href="index.html" accesskey="U">Bcfg2 Development</a> &raquo;</li> 
      </ul>
    </div>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="bcfg2-plugin-development">
<span id="development-plugins"></span><h1>Bcfg2 Plugin development<a class="headerlink" href="#bcfg2-plugin-development" title="Permalink to this headline">¶</a></h1>
<p>While the Bcfg2 server provides a good interface for representing
general system configurations, its plugin interface offers the ability
to implement configuration interfaces and representation tailored to
problems encountered by a particular site. This chapter describes what
plugins are good for, what they can do, and how to implement them.</p>
<p>Several plugins themselves have pluggable backends, and for narrow
cases you may want to develop a backend for an existing plugin rather
than an entirely new plugin.  See the following pages for more
information:</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="cfg.html">Cfg Handler Development</a></li>
<li class="toctree-l1"><a class="reference internal" href="packages.html">Developing for Packages</a></li>
</ul>
</div>
<div class="section" id="bcfg2-plugins">
<h2>Bcfg2 Plugins<a class="headerlink" href="#bcfg2-plugins" title="Permalink to this headline">¶</a></h2>
<p>Bcfg2 plugins are loadable python modules that the Bcfg2 server loads at
initialization time. These plugins can contribute to the functions already
offered by the Bcfg2 server or can extend its functionality. In general,
plugins will provide some portion of the configuration for clients, with a
data representation that is tuned for a set of common tasks. Much of the
core functionality of Bcfg2 is implemented by several plugins, however,
they are not special in any way; new plugins could easily supplant one
or all of them.</p>
<span class="target" id="module-Bcfg2.Server.Plugin"></span><p><tt class="docutils literal"><span class="pre">Bcfg2.Server.Plugin</span></tt> contains server plugin base classes,
interfaces, exceptions, and helper objects.  This module is split into
a number of submodules to make it more manageable, but it imports all
symbols from the submodules, so with the exception of some
documentation it&#8217;s not necessary to use the submodules.  E.g., you can
(and should) do:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">Bcfg2.Server.Plugin</span> <span class="kn">import</span> <span class="n">Plugin</span>
</pre></div>
</div>
<p>...rather than:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">Bcfg2.Server.Plugin.base</span> <span class="kn">import</span> <span class="n">Plugin</span>
</pre></div>
</div>
</div>
<div class="section" id="server-plugin-types">
<h2>Server Plugin Types<a class="headerlink" href="#server-plugin-types" title="Permalink to this headline">¶</a></h2>
<p>A plugin must implement at least one of the interfaces described
below.  Each interface is available as a class in
<a class="reference internal" href="#module-Bcfg2.Server.Plugin" title="Bcfg2.Server.Plugin"><tt class="xref py py-mod docutils literal"><span class="pre">Bcfg2.Server.Plugin</span></tt></a>.  In most cases, a plugin must also
inherit from <a class="reference internal" href="#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>, which is the
base Plugin object (described below).  Some of the interfaces listed
below are themselves Plugin objects, so your custom plugin would only
need to inherit from the plugin type.</p>
<div class="section" id="plugin">
<h3>Plugin<a class="headerlink" href="#plugin" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="Bcfg2.Server.Plugin.base.Plugin">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.base.</tt><tt class="descname">Plugin</tt><big>(</big><em>core</em>, <em>datastore</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/base.html#Plugin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.base.Plugin" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#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>The base class for all Bcfg2 Server plugins.</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>) &#8211; The Bcfg2.Server.Core initializing the plugin</li>
<li><strong>datastore</strong> (<em>string</em>) &#8211; 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="#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.Plugin.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.Plugin.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="attribute">
<dt id="Bcfg2.Server.Plugin.base.Plugin.conflicts">
<tt class="descname">conflicts</tt><em class="property"> = []</em><a class="headerlink" href="#Bcfg2.Server.Plugin.base.Plugin.conflicts" title="Permalink to this definition">¶</a></dt>
<dd><p>Plugin conflicts with the list of other plugin names</p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.base.Plugin.debug_log">
<tt class="descname">debug_log</tt><big>(</big><em>message</em>, <em>flag=None</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.base.Plugin.debug_log" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a message at the debug level.</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>message</strong> (<em>string</em>) &#8211; The message to log</li>
<li><strong>flag</strong> (<em>bool</em>) &#8211; Override the current debug flag with this value</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.Plugin.base.Plugin.deprecated">
<tt class="descname">deprecated</tt><em class="property"> = False</em><a class="headerlink" href="#Bcfg2.Server.Plugin.base.Plugin.deprecated" title="Permalink to this definition">¶</a></dt>
<dd><p>Plugin is deprecated and will be removed in a future release.
Use of this plugin will produce a log message alerting the
administrator that an experimental plugin is in use.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.base.Plugin.experimental">
<tt class="descname">experimental</tt><em class="property"> = False</em><a class="headerlink" href="#Bcfg2.Server.Plugin.base.Plugin.experimental" title="Permalink to this definition">¶</a></dt>
<dd><p>Plugin is experimental.  Use of this plugin will produce a log
message alerting the administrator that an experimental plugin
is in use.</p>
</dd></dl>

<dl class="classmethod">
<dt id="Bcfg2.Server.Plugin.base.Plugin.init_repo">
<em class="property">classmethod </em><tt class="descname">init_repo</tt><big>(</big><em>repo</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/base.html#Plugin.init_repo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.base.Plugin.init_repo" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform any tasks necessary to create an initial Bcfg2
repository.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>repo</strong> (<em>string</em>) &#8211; The path to the Bcfg2 repository on the filesystem</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="attribute">
<dt id="Bcfg2.Server.Plugin.base.Plugin.name">
<tt class="descname">name</tt><em class="property"> = 'Plugin'</em><a class="headerlink" href="#Bcfg2.Server.Plugin.base.Plugin.name" title="Permalink to this definition">¶</a></dt>
<dd><p>The name of the plugin.</p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.base.Plugin.set_debug">
<tt class="descname">set_debug</tt><big>(</big><em>debug</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.base.Plugin.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="method">
<dt id="Bcfg2.Server.Plugin.base.Plugin.shutdown">
<tt class="descname">shutdown</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/base.html#Plugin.shutdown"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.base.Plugin.shutdown" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform shutdown tasks for the plugin</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">None</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.base.Plugin.sort_order">
<tt class="descname">sort_order</tt><em class="property"> = 500</em><a class="headerlink" href="#Bcfg2.Server.Plugin.base.Plugin.sort_order" title="Permalink to this definition">¶</a></dt>
<dd><p>Plugins of the same type are processed in order of ascending
sort_order value. Plugins with the same sort_order are sorted
alphabetically by their name.</p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.base.Plugin.toggle_debug">
<tt class="descname">toggle_debug</tt><big>(</big><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.base.Plugin.toggle_debug" title="Permalink to this definition">¶</a></dt>
<dd><p>Turn debugging output on or off.  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>

</dd></dl>

<p>With the exceptions of
<a class="reference internal" href="#Bcfg2.Server.Plugin.interfaces.Statistics" title="Bcfg2.Server.Plugin.interfaces.Statistics"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.interfaces.Statistics</span></tt></a> and
<a class="reference internal" href="#Bcfg2.Server.Plugin.interfaces.ThreadedStatistics" title="Bcfg2.Server.Plugin.interfaces.ThreadedStatistics"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.interfaces.ThreadedStatistics</span></tt></a>, the plugin
interfaces listed below do <strong>not</strong> inherit from Plugin; they simply
provide interfaces that a given plugin may or must implement.</p>
</div>
<div class="section" id="interfaces">
<h3>Interfaces<a class="headerlink" href="#interfaces" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="Bcfg2.Server.Plugin.Bcfg2.Server.Plugin.interfaces">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.</tt><tt class="descname">interfaces</tt><a class="headerlink" href="#Bcfg2.Server.Plugin.Bcfg2.Server.Plugin.interfaces" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<span class="target" id="module-Bcfg2.Server.Plugin.interfaces"></span><p>Interface definitions for Bcfg2 server plugins</p>
<dl class="class">
<dt id="Bcfg2.Server.Plugin.interfaces.ClientRunHooks">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.interfaces.</tt><tt class="descname">ClientRunHooks</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#ClientRunHooks"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.ClientRunHooks" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>ClientRunHooks can hook into various parts of a client run to
perform actions at various times without needing to pretend to be
a different plugin type.</p>
<dl class="method">
<dt id="Bcfg2.Server.Plugin.interfaces.ClientRunHooks.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/Plugin/interfaces.html#ClientRunHooks.end_client_run"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.ClientRunHooks.end_client_run" title="Permalink to this definition">¶</a></dt>
<dd><p>Invoked at the end of a client run, immediately after
<a class="reference internal" href="#Bcfg2.Server.Plugin.interfaces.GoalValidator" title="Bcfg2.Server.Plugin.interfaces.GoalValidator"><tt class="xref py py-class docutils literal"><span class="pre">GoalValidator</span></tt></a> plugins have been run and just before
the configuration is returned to 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>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; The client metadata 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.Plugin.interfaces.ClientRunHooks.end_statistics">
<tt class="descname">end_statistics</tt><big>(</big><em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#ClientRunHooks.end_statistics"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.ClientRunHooks.end_statistics" title="Permalink to this definition">¶</a></dt>
<dd><p>Invoked after statistics are processed for a 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>) &#8211; The client metadata 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.Plugin.interfaces.ClientRunHooks.start_client_run">
<tt class="descname">start_client_run</tt><big>(</big><em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#ClientRunHooks.start_client_run"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.ClientRunHooks.start_client_run" title="Permalink to this definition">¶</a></dt>
<dd><p>Invoked at the start of a client run, after all probe data
has been received and decision lists have been queried (if
applicable), but before the configuration is generated.</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>) &#8211; The client metadata 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>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.interfaces.Connector">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.interfaces.</tt><tt class="descname">Connector</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Connector"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Connector" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>Connector plugins augment client metadata instances with
additional data, additional groups, or both.</p>
<dl class="method">
<dt id="Bcfg2.Server.Plugin.interfaces.Connector.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/Plugin/interfaces.html#Connector.get_additional_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Connector.get_additional_data" title="Permalink to this definition">¶</a></dt>
<dd><p>Return arbitrary additional data for the given
ClientMetadata object.  By convention this is usually a dict
object, but doesn&#8217;t need to be.</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>) &#8211; The client metadata</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">dict</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.interfaces.Connector.get_additional_groups">
<tt class="descname">get_additional_groups</tt><big>(</big><em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Connector.get_additional_groups"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Connector.get_additional_groups" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of additional groups for the given 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>) &#8211; The client metadata</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>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.interfaces.Decision">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.interfaces.</tt><tt class="descname">Decision</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Decision"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Decision" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>Decision plugins produce decision lists for affecting which
entries are actually installed on clients.</p>
<dl class="method">
<dt id="Bcfg2.Server.Plugin.interfaces.Decision.GetDecisions">
<tt class="descname">GetDecisions</tt><big>(</big><em>metadata</em>, <em>mode</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Decision.GetDecisions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Decision.GetDecisions" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of tuples of <tt class="docutils literal"><span class="pre">(&lt;entry</span> <span class="pre">type&gt;,</span> <span class="pre">&lt;entry</span>
<span class="pre">name&gt;)</span></tt> to be used as the decision list for the given
client in the specified mode.</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>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; The client metadata</li>
<li><strong>mode</strong> (<em>string</em>) &#8211; The decision mode (&#8220;whitelist&#8221; or &#8220;blacklist&#8221;)</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 tuples</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.interfaces.Generator">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.interfaces.</tt><tt class="descname">Generator</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Generator"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Generator" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>Generator plugins contribute to literal client configurations.
That is, they generate entry contents.</p>
<p>An entry is generated in one of two ways:</p>
<ol class="arabic simple">
<li>The Bcfg2 core looks in the <tt class="docutils literal"><span class="pre">Entries</span></tt> dict attribute of the
plugin object.  <tt class="docutils literal"><span class="pre">Entries</span></tt> is expected to be a dict whose keys
are entry tags (e.g., <tt class="docutils literal"><span class="pre">&quot;Path&quot;</span></tt>, <tt class="docutils literal"><span class="pre">&quot;Service&quot;</span></tt>, etc.) and
whose values are dicts; those dicts should map the <tt class="docutils literal"><span class="pre">name</span></tt>
attribute of an entry to a callable that will be called to
generate the content.  The callable will receive two arguments:
the abstract entry (as an lxml.etree._Element object), and the
client metadata object the entry is being generated for.</li>
<li>If the entry is not listed in <tt class="docutils literal"><span class="pre">Entries</span></tt>, the Bcfg2 core calls
<a class="reference internal" href="#Bcfg2.Server.Plugin.interfaces.Generator.HandlesEntry" title="Bcfg2.Server.Plugin.interfaces.Generator.HandlesEntry"><tt class="xref py py-func docutils literal"><span class="pre">HandlesEntry()</span></tt></a>; if that returns True, then it calls
<a class="reference internal" href="#Bcfg2.Server.Plugin.interfaces.Generator.HandleEntry" title="Bcfg2.Server.Plugin.interfaces.Generator.HandleEntry"><tt class="xref py py-func docutils literal"><span class="pre">HandleEntry()</span></tt></a>.</li>
</ol>
<dl class="method">
<dt id="Bcfg2.Server.Plugin.interfaces.Generator.HandleEntry">
<tt class="descname">HandleEntry</tt><big>(</big><em>entry</em>, <em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Generator.HandleEntry"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Generator.HandleEntry" title="Permalink to this definition">¶</a></dt>
<dd><p>HandleEntry is the slow path method for binding
configuration binding requests.  It is called if the
<tt class="docutils literal"><span class="pre">Entries</span></tt> dict does not contain a method for binding the
entry, and <a class="reference internal" href="#Bcfg2.Server.Plugin.interfaces.Generator.HandlesEntry" title="Bcfg2.Server.Plugin.interfaces.Generator.HandlesEntry"><tt class="xref py py-func docutils literal"><span class="pre">HandlesEntry()</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"><ul class="first simple">
<li><strong>entry</strong> (<em>lxml.etree._Element</em>) &#8211; The entry to bind</li>
<li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; 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">lxml.etree._Element - The fully bound 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="#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.Plugin.interfaces.Generator.HandlesEntry">
<tt class="descname">HandlesEntry</tt><big>(</big><em>entry</em>, <em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Generator.HandlesEntry"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Generator.HandlesEntry" title="Permalink to this definition">¶</a></dt>
<dd><p>HandlesEntry is the slow path method for routing
configuration binding requests.  It is called if the
<tt class="docutils literal"><span class="pre">Entries</span></tt> dict does not contain a method for binding the
entry.</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>entry</strong> (<em>lxml.etree._Element</em>) &#8211; The entry to bind</li>
<li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; 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="#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>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.interfaces.GoalValidator">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.interfaces.</tt><tt class="descname">GoalValidator</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#GoalValidator"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.GoalValidator" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>GoalValidator plugins can modify the concretely-bound configuration of
a client as a last stage before the configuration is sent to the
client.</p>
<dl class="method">
<dt id="Bcfg2.Server.Plugin.interfaces.GoalValidator.validate_goals">
<tt class="descname">validate_goals</tt><big>(</big><em>metadata</em>, <em>config</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#GoalValidator.validate_goals"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.GoalValidator.validate_goals" title="Permalink to this definition">¶</a></dt>
<dd><p>Given a monolithic XML document of the full configuration,
modify the document in-place.</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>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; The client metadata</li>
<li><strong>config</strong> (<em>lxml.etree._Element</em>) &#8211; The full configuration for the client</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">None</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises :</th><td class="field-body"><p class="first last"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.exceptions:ValidationError</span></tt></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.interfaces.Metadata">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.interfaces.</tt><tt class="descname">Metadata</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Metadata" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>Metadata plugins handle initial metadata construction,
accumulating data from <a class="reference internal" href="#Bcfg2.Server.Plugin.interfaces.Connector" title="Bcfg2.Server.Plugin.interfaces.Connector"><tt class="xref py py-class docutils literal"><span class="pre">Connector</span></tt></a> plugins, and producing
<tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Metadata.ClientMetadata</span></tt> objects.</p>
<dl class="method">
<dt id="Bcfg2.Server.Plugin.interfaces.Metadata.AuthenticateConnection">
<tt class="descname">AuthenticateConnection</tt><big>(</big><em>cert</em>, <em>user</em>, <em>password</em>, <em>address</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Metadata.AuthenticateConnection"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Metadata.AuthenticateConnection" title="Permalink to this definition">¶</a></dt>
<dd><p>Authenticate the given 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 simple">
<li><strong>cert</strong> (<em>dict</em>) &#8211; an x509 certificate</li>
<li><strong>user</strong> (<em>string</em>) &#8211; The username of the user trying to authenticate</li>
<li><strong>password</strong> (<em>string</em>) &#8211; The password supplied by the client</li>
<li><strong>addresspair</strong> (<em>tuple</em>) &#8211; An address pair of <tt class="docutils literal"><span class="pre">(&lt;ip</span> <span class="pre">address&gt;,</span>
<span class="pre">&lt;hostname&gt;)</span></tt></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">bool - True if the authenticate succeeds, False otherwise</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.interfaces.Metadata.get_initial_metadata">
<tt class="descname">get_initial_metadata</tt><big>(</big><em>client_name</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Metadata.get_initial_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Metadata.get_initial_metadata" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a
<tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugins.Metadata.ClientMetadata</span></tt> object
that fully describes everything the Metadata plugin knows
about the named 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>client_name</strong> (<em>string</em>) &#8211; The hostname of the client</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Bcfg2.Server.Plugins.Metadata.ClientMetadata</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.interfaces.Metadata.merge_additional_data">
<tt class="descname">merge_additional_data</tt><big>(</big><em>imd</em>, <em>source</em>, <em>data</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Metadata.merge_additional_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Metadata.merge_additional_data" title="Permalink to this definition">¶</a></dt>
<dd><p>Add arbitrary data from a
<a class="reference internal" href="#Bcfg2.Server.Plugin.interfaces.Connector" title="Bcfg2.Server.Plugin.interfaces.Connector"><tt class="xref py py-class docutils literal"><span class="pre">Connector</span></tt></a> plugin to the given
metadata object.</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>imd</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; An initial metadata object</li>
<li><strong>source</strong> (<em>string</em>) &#8211; The name of the plugin providing this data</li>
<li><strong>data</strong> (<em>any</em>) &#8211; The data to add</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="method">
<dt id="Bcfg2.Server.Plugin.interfaces.Metadata.merge_additional_groups">
<tt class="descname">merge_additional_groups</tt><big>(</big><em>imd</em>, <em>groups</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Metadata.merge_additional_groups"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Metadata.merge_additional_groups" title="Permalink to this definition">¶</a></dt>
<dd><p>Add groups from a
<a class="reference internal" href="#Bcfg2.Server.Plugin.interfaces.Connector" title="Bcfg2.Server.Plugin.interfaces.Connector"><tt class="xref py py-class docutils literal"><span class="pre">Connector</span></tt></a> plugin to the given
metadata object.</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>imd</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; An initial metadata object</li>
<li><strong>groups</strong> (<em>list of strings</em>) &#8211; The groups to add</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="method">
<dt id="Bcfg2.Server.Plugin.interfaces.Metadata.resolve_client">
<tt class="descname">resolve_client</tt><big>(</big><em>address</em>, <em>cleanup_cache=False</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Metadata.resolve_client"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Metadata.resolve_client" title="Permalink to this definition">¶</a></dt>
<dd><p>Resolve the canonical name of this client.  If this method
is not implemented, the hostname claimed by the client is
used.  (This may be a security risk; it&#8217;s highly recommended
that you implement <tt class="docutils literal"><span class="pre">resolve_client</span></tt> if you are writing a
Metadata plugin.)</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>address</strong> (<em>tuple</em>) &#8211; Address pair of <tt class="docutils literal"><span class="pre">(&lt;ip</span> <span class="pre">address&gt;,</span> <span class="pre">&lt;hostname&gt;)</span></tt></li>
<li><strong>cleanup_cache</strong> (<em>bool</em>) &#8211; Whether or not to remove expire the
entire client hostname resolution class</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">string - canonical client hostname</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="#Bcfg2.Server.Plugin.exceptions.MetadataRuntimeError" title="Bcfg2.Server.Plugin.exceptions.MetadataRuntimeError"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.exceptions.MetadataRuntimeError</span></tt></a>,
<a class="reference internal" href="#Bcfg2.Server.Plugin.exceptions.MetadataConsistencyError" title="Bcfg2.Server.Plugin.exceptions.MetadataConsistencyError"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.exceptions.MetadataConsistencyError</span></tt></a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.interfaces.Metadata.set_profile">
<tt class="descname">set_profile</tt><big>(</big><em>client</em>, <em>profile</em>, <em>address</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Metadata.set_profile"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Metadata.set_profile" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the profile for the named client to the named profile
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>client</strong> (<em>string</em>) &#8211; Hostname of the client</li>
<li><strong>profile</strong> (<em>string</em>) &#8211; Name of the profile group</li>
<li><strong>address</strong> (<em>tuple</em>) &#8211; Address pair of <tt class="docutils literal"><span class="pre">(&lt;ip</span> <span class="pre">address&gt;,</span> <span class="pre">&lt;hostname&gt;)</span></tt></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">None</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="#Bcfg2.Server.Plugin.exceptions.MetadataRuntimeError" title="Bcfg2.Server.Plugin.exceptions.MetadataRuntimeError"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.exceptions.MetadataRuntimeError</span></tt></a>,
<a class="reference internal" href="#Bcfg2.Server.Plugin.exceptions.MetadataConsistencyError" title="Bcfg2.Server.Plugin.exceptions.MetadataConsistencyError"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.exceptions.MetadataConsistencyError</span></tt></a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.interfaces.Metadata.set_version">
<tt class="descname">set_version</tt><big>(</big><em>client</em>, <em>version</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Metadata.set_version"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Metadata.set_version" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the version for the named client to the specified
version string.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>client</strong> (<em>string</em>) &#8211; Hostname of the client</li>
<li><strong>profile</strong> (<em>string</em>) &#8211; Client Bcfg2 version</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">None</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="#Bcfg2.Server.Plugin.exceptions.MetadataRuntimeError" title="Bcfg2.Server.Plugin.exceptions.MetadataRuntimeError"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.exceptions.MetadataRuntimeError</span></tt></a>,
<a class="reference internal" href="#Bcfg2.Server.Plugin.exceptions.MetadataConsistencyError" title="Bcfg2.Server.Plugin.exceptions.MetadataConsistencyError"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.exceptions.MetadataConsistencyError</span></tt></a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.interfaces.Metadata.viz">
<tt class="descname">viz</tt><big>(</big><em>hosts</em>, <em>bundles</em>, <em>key</em>, <em>only_client</em>, <em>colors</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Metadata.viz"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Metadata.viz" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a string containing a graphviz document that maps
out the Metadata for <a class="reference internal" href="../server/admin/viz.html#server-admin-viz"><em>bcfg2-admin viz</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"><ul class="first simple">
<li><strong>hosts</strong> (<em>bool</em>) &#8211; Include hosts in the graph</li>
<li><strong>bundles</strong> (<em>bool</em>) &#8211; Include bundles in the graph</li>
<li><strong>key</strong> (<em>bool</em>) &#8211; Include a key in the graph</li>
<li><strong>only_client</strong> (<em>string</em>) &#8211; Only include data for the specified client</li>
<li><strong>colors</strong> (<em>list of strings</em>) &#8211; Use the specified graphviz colors</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">string</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.interfaces.Probing">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.interfaces.</tt><tt class="descname">Probing</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Probing"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Probing" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>Probing plugins can collect data from clients and process it.</p>
<dl class="method">
<dt id="Bcfg2.Server.Plugin.interfaces.Probing.GetProbes">
<tt class="descname">GetProbes</tt><big>(</big><em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Probing.GetProbes"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Probing.GetProbes" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of probes for the given client.  Each probe
should be an lxml.etree._Element object that adheres to
the following specification.  Each probe must the following
attributes:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">name</span></tt>: The unique name of the probe.</li>
<li><tt class="docutils literal"><span class="pre">source</span></tt>: The origin of the probe; probably the name of
the plugin that supplies the probe.</li>
<li><tt class="docutils literal"><span class="pre">interpreter</span></tt>: The command that will be run on the client
to interpret the probe script.  Compiled (i.e.,
non-interpreted) probes are not supported.</li>
</ul>
<p>The text of the XML tag should be the contents of the probe,
i.e., the code that will be run on 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>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; The client metadata</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of lxml.etree._Element objects</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.interfaces.Probing.ReceiveData">
<tt class="descname">ReceiveData</tt><big>(</big><em>metadata</em>, <em>datalist</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Probing.ReceiveData"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Probing.ReceiveData" title="Permalink to this definition">¶</a></dt>
<dd><p>Process data returned from the probes for the given
client.  <tt class="docutils literal"><span class="pre">datalist</span></tt> is a list of lxml.etree._Element
objects, each of which is a single tag; the <tt class="docutils literal"><span class="pre">name</span></tt> attribute
holds the unique name of the probe that was run, and the text
contents of the tag hold the results of the probe.</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>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; The client metadata</li>
<li><strong>datalist</strong> (<em>list of lxml.etree._Element objects</em>) &#8211; The probe data</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="class">
<dt id="Bcfg2.Server.Plugin.interfaces.Statistics">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.interfaces.</tt><tt class="descname">Statistics</tt><big>(</big><em>core</em>, <em>datastore</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Statistics"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Statistics" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#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></p>
<p>Statistics plugins handle statistics for clients.  In general,
you should avoid using Statistics and use
<a class="reference internal" href="#Bcfg2.Server.Plugin.interfaces.ThreadedStatistics" title="Bcfg2.Server.Plugin.interfaces.ThreadedStatistics"><tt class="xref py py-class docutils literal"><span class="pre">ThreadedStatistics</span></tt></a> instead.</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>) &#8211; The Bcfg2.Server.Core initializing the plugin</li>
<li><strong>datastore</strong> (<em>string</em>) &#8211; 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="#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.Statistics.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.Statistics.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.Plugin.interfaces.Statistics.process_statistics">
<tt class="descname">process_statistics</tt><big>(</big><em>client</em>, <em>xdata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Statistics.process_statistics"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Statistics.process_statistics" title="Permalink to this definition">¶</a></dt>
<dd><p>Process the given XML statistics data 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 simple">
<li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; The client metadata</li>
<li><strong>data</strong> (<em>lxml.etree._Element</em>) &#8211; The statistics data</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="class">
<dt id="Bcfg2.Server.Plugin.interfaces.Structure">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.interfaces.</tt><tt class="descname">Structure</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Structure"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Structure" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>Structure Plugins contribute to abstract client
configurations.  That is, they produce lists of entries that will
be generated for a client.</p>
<dl class="method">
<dt id="Bcfg2.Server.Plugin.interfaces.Structure.BuildStructures">
<tt class="descname">BuildStructures</tt><big>(</big><em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Structure.BuildStructures"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Structure.BuildStructures" title="Permalink to this definition">¶</a></dt>
<dd><p>Build a list of lxml.etree._Element objects that will be
added to the top-level <tt class="docutils literal"><span class="pre">&lt;Configuration&gt;</span></tt> tag of the client
configuration.  Consequently, each object in the list returned
by <tt class="docutils literal"><span class="pre">BuildStructures()</span></tt> must consist of a container tag
(e.g., <tt class="docutils literal"><span class="pre">&lt;Bundle&gt;</span></tt> or <tt class="docutils literal"><span class="pre">&lt;Independent&gt;</span></tt>) which contains the
entry tags.  It must not return a list of entry tags.</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>) &#8211; The client metadata</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of lxml.etree._Element objects</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.interfaces.StructureValidator">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.interfaces.</tt><tt class="descname">StructureValidator</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#StructureValidator"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.StructureValidator" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>StructureValidator plugins can modify the list of structures
after it has been created but before the entries have been
concretely bound.</p>
<dl class="method">
<dt id="Bcfg2.Server.Plugin.interfaces.StructureValidator.validate_structures">
<tt class="descname">validate_structures</tt><big>(</big><em>metadata</em>, <em>structures</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#StructureValidator.validate_structures"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.StructureValidator.validate_structures" title="Permalink to this definition">¶</a></dt>
<dd><p>Given a list of structures (i.e., of tags that contain
entry tags), modify that list or the structures in it
in-place.</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>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; The client metadata</li>
<li><strong>config</strong> (<em>list of lxml.etree._Element</em>) &#8211; 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">None</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="#Bcfg2.Server.Plugin.exceptions.ValidationError" title="Bcfg2.Server.Plugin.exceptions.ValidationError"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.exceptions.ValidationError</span></tt></a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.interfaces.Threaded">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.interfaces.</tt><tt class="descname">Threaded</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Threaded"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Threaded" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>Threaded plugins use threads in any way.  The thread must be
started after daemonization, so this class implements a single
method, <a class="reference internal" href="#Bcfg2.Server.Plugin.interfaces.Threaded.start_threads" title="Bcfg2.Server.Plugin.interfaces.Threaded.start_threads"><tt class="xref py py-func docutils literal"><span class="pre">start_threads()</span></tt></a>, that can be used to start threads
after daemonization of the server core.</p>
<dl class="method">
<dt id="Bcfg2.Server.Plugin.interfaces.Threaded.start_threads">
<tt class="descname">start_threads</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Threaded.start_threads"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Threaded.start_threads" title="Permalink to this definition">¶</a></dt>
<dd><p>Start this plugin&#8217;s threads after daemonization.</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">None</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises :</th><td class="field-body"><a class="reference internal" href="#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></td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.interfaces.ThreadedStatistics">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.interfaces.</tt><tt class="descname">ThreadedStatistics</tt><big>(</big><em>core</em>, <em>datastore</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#ThreadedStatistics"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.ThreadedStatistics" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#Bcfg2.Server.Plugin.interfaces.Statistics" title="Bcfg2.Server.Plugin.interfaces.Statistics"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.interfaces.Statistics</span></tt></a>, <a class="reference internal" href="#Bcfg2.Server.Plugin.interfaces.Threaded" title="Bcfg2.Server.Plugin.interfaces.Threaded"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.interfaces.Threaded</span></tt></a>, <tt class="xref py py-class docutils literal"><span class="pre">threading.Thread</span></tt></p>
<p>ThreadedStatistics plugins process client statistics in a
separate thread.</p>
<dl class="method">
<dt id="Bcfg2.Server.Plugin.interfaces.ThreadedStatistics.handle_statistic">
<tt class="descname">handle_statistic</tt><big>(</big><em>metadata</em>, <em>data</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#ThreadedStatistics.handle_statistic"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.ThreadedStatistics.handle_statistic" title="Permalink to this definition">¶</a></dt>
<dd><p>Process the given XML statistics data for the specified
client object.  This differs from the
<a class="reference internal" href="#Bcfg2.Server.Plugin.interfaces.Statistics.process_statistics" title="Bcfg2.Server.Plugin.interfaces.Statistics.process_statistics"><tt class="xref py py-func docutils literal"><span class="pre">Statistics.process_statistics()</span></tt></a> method only in that
ThreadedStatistics first adds the data to a queue, and then
processes them in a separate thread.</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>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; The client metadata</li>
<li><strong>data</strong> (<em>lxml.etree._Element</em>) &#8211; The statistics data</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="class">
<dt id="Bcfg2.Server.Plugin.interfaces.Version">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.interfaces.</tt><tt class="descname">Version</tt><big>(</big><em>core</em>, <em>datastore</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Version"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Version" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#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></p>
<p>Version plugins interact with various version control systems.</p>
<blockquote>
<div><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">param core:</th><td class="field-body">The Bcfg2.Server.Core initializing the plugin</td>
</tr>
<tr class="field-even field"><th class="field-name">type core:</th><td class="field-body">Bcfg2.Server.Core</td>
</tr>
<tr class="field-odd field"><th class="field-name" colspan="2">param datastore:</th></tr>
<tr class="field-odd field"><td>&nbsp;</td><td class="field-body">The path to the Bcfg2 repository on the
filesystem</td>
</tr>
<tr class="field-even field"><th class="field-name">type datastore:</th><td class="field-body">string</td>
</tr>
<tr class="field-odd field"><th class="field-name">raises:</th><td class="field-body"><a class="reference internal" href="#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></td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.base.Version.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.Version.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>

</div></blockquote>
<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.interfaces.Version.__vcs_metadata_path__">
<tt class="descname">__vcs_metadata_path__</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Version.__vcs_metadata_path__" title="Permalink to this definition">¶</a></dt>
<dd><p>The path to the VCS metadata file or directory, relative to the
base of the Bcfg2 repository.  E.g., for Subversion this would
be &#8221;.svn&#8221;</p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.interfaces.Version.get_revision">
<tt class="descname">get_revision</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/interfaces.html#Version.get_revision"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.interfaces.Version.get_revision" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the current revision of the Bcfg2 specification.
This will be included in the <tt class="docutils literal"><span class="pre">revision</span></tt> attribute of the
top-level tag of the XML configuration sent to 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">Returns:</th><td class="field-body">string - the current version</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
</div>
<div class="section" id="exposing-xml-rpc-functions">
<h2>Exposing XML-RPC Functions<a class="headerlink" href="#exposing-xml-rpc-functions" title="Permalink to this headline">¶</a></h2>
<p>Plugins can expose XML-RPC functions that can then be called with
<a class="reference internal" href="../server/admin/xcmd.html#server-admin-xcmd"><em>bcfg2-admin xcmd</em></a>.  Note that there is
absolutely no access control beyond the initial authentication, so
take care to not expose any data or behavior via XML-RPC that you
would not want all of your clients to be able to see or use.</p>
<p>To expose a function, simply add its name to the <tt class="docutils literal"><span class="pre">__rmi__</span></tt> class
attribute.  (RMI stands for &#8220;Remote Method Invocation.&#8221;)  Consider
this example from the <a class="reference internal" href="../server/plugins/generators/packages.html#server-plugins-generators-packages"><em>Packages</em></a>
plugin:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">Packages</span><span class="p">(</span><span class="n">Bcfg2</span><span class="o">.</span><span class="n">Server</span><span class="o">.</span><span class="n">Plugin</span><span class="o">.</span><span class="n">Plugin</span><span class="p">,</span>
               <span class="n">Bcfg2</span><span class="o">.</span><span class="n">Server</span><span class="o">.</span><span class="n">Plugin</span><span class="o">.</span><span class="n">StructureValidator</span><span class="p">,</span>
               <span class="n">Bcfg2</span><span class="o">.</span><span class="n">Server</span><span class="o">.</span><span class="n">Plugin</span><span class="o">.</span><span class="n">Generator</span><span class="p">,</span>
               <span class="n">Bcfg2</span><span class="o">.</span><span class="n">Server</span><span class="o">.</span><span class="n">Plugin</span><span class="o">.</span><span class="n">Connector</span><span class="p">,</span>
               <span class="n">Bcfg2</span><span class="o">.</span><span class="n">Server</span><span class="o">.</span><span class="n">Plugin</span><span class="o">.</span><span class="n">ClientRunHooks</span><span class="p">):</span>
    <span class="n">name</span> <span class="o">=</span> <span class="s">&#39;Packages&#39;</span>
    <span class="n">conflicts</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;Pkgmgr&#39;</span><span class="p">]</span>
    <span class="n">__rmi__</span> <span class="o">=</span> <span class="n">Bcfg2</span><span class="o">.</span><span class="n">Server</span><span class="o">.</span><span class="n">Plugin</span><span class="o">.</span><span class="n">Plugin</span><span class="o">.</span><span class="n">__rmi__</span> <span class="o">+</span> <span class="p">[</span><span class="s">&#39;Refresh&#39;</span><span class="p">,</span> <span class="s">&#39;Reload&#39;</span><span class="p">]</span>

<span class="k">def</span> <span class="nf">Refresh</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">_load_config</span><span class="p">(</span><span class="n">force_update</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
    <span class="k">return</span> <span class="bp">True</span>

<span class="k">def</span> <span class="nf">Reload</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
    <span class="bp">self</span><span class="o">.</span><span class="n">_load_config</span><span class="p">()</span>
    <span class="k">return</span> <span class="bp">True</span>
</pre></div>
</div>
<p>This exposes two functions, <tt class="docutils literal"><span class="pre">Refresh</span></tt> and <tt class="docutils literal"><span class="pre">Reload</span></tt>, in addition to
any default methods that are already exposed.  To call one of these
functions, you could run:</p>
<div class="highlight-python"><pre>bcfg2-admin xcmd Packages.Refresh</pre>
</div>
</div>
<div class="section" id="invalidating-caches">
<h2>Invalidating Caches<a class="headerlink" href="#invalidating-caches" title="Permalink to this headline">¶</a></h2>
<p class="versionadded">
<span class="versionmodified">New in version 1.3.0.</span></p>
<p>In Bcfg2 1.3.0, some limited <a class="reference internal" href="../server/caching.html#server-caching"><em>Server-side Caching</em></a> was introduced.  If
you are writing a <a class="reference internal" href="#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>
plugin that implements
<a class="reference internal" href="#Bcfg2.Server.Plugin.interfaces.Connector.get_additional_groups" title="Bcfg2.Server.Plugin.interfaces.Connector.get_additional_groups"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugin.interfaces.Connector.get_additional_groups()</span></tt></a>,
then you need to be able to invalidate the server metadata cache in
order to be compatible with the <tt class="docutils literal"><span class="pre">cautious</span></tt> or <tt class="docutils literal"><span class="pre">aggressive</span></tt> caching
modes.</p>
<p>The two attributes you need to know about are:</p>
<ul class="simple">
<li><tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Server.Core.metadata_cache_mode</span></tt>: A string description
of the caching mode.  See <a class="reference internal" href="../server/caching.html#server-caching"><em>Server-side Caching</em></a> for a description of
each mode.</li>
<li><tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Server.Core.metadata_cache</span></tt>: A dict-like
<tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Cache.Cache</span></tt> object that stores the cached data.</li>
</ul>
<p><a class="reference internal" href="#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> objects have access to the
<a class="reference internal" href="core.html#module-Bcfg2.Server.Core" title="Bcfg2.Server.Core"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Core</span></tt></a> object as <tt class="docutils literal"><span class="pre">self.core</span></tt>.  In general,
you&#8217;ll be interested in the <tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Cache.Cache.expire()</span></tt> method;
if called with no arguments, it expires all cached data; if called
with one string argument, it expires cached data for the named client.</p>
<p>It&#8217;s important, therefore, that your Connector plugin can either track
when changes are made to the group membership it reports, and expire
cached data appropriately when in <tt class="docutils literal"><span class="pre">cautious</span></tt> or <tt class="docutils literal"><span class="pre">aggressive</span></tt> mode;
or prudently flag an incompatibility with those two modes.</p>
<p>For examples, see:</p>
<ul class="simple">
<li><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.Probes.ReceiveData()</span></tt> takes a copy of the
groups that have been assigned to a client by
<a class="reference internal" href="../server/plugins/probes/index.html#server-plugins-probes-index"><em>Probes</em></a>, and if that data changes when
new probe data is received, it invalidates the cache for that
client.</li>
<li><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.GroupPatterns.Index()</span></tt> expires the entire
cache whenever a FAM event is received for the
<a class="reference internal" href="../server/plugins/grouping/grouppatterns.html#server-plugins-grouping-grouppatterns"><em>GroupPatterns</em></a> config file.</li>
<li><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugins.PuppetENC.end_client_run()</span></tt> expires the
entire cache at the end of every client run and produces a message
at the warning level that the
<a class="reference internal" href="../server/plugins/connectors/puppetenc.html#server-plugins-connectors-puppetenc"><em>PuppetENC</em></a> plugin is incompatible
with aggressive caching.</li>
</ul>
</div>
<div class="section" id="tracking-execution-time">
<h2>Tracking Execution Time<a class="headerlink" href="#tracking-execution-time" title="Permalink to this headline">¶</a></h2>
<p class="versionadded">
<span class="versionmodified">New in version 1.3.0.</span></p>
<p>Statistics can and should track execution time statistics using
<a class="reference internal" href="#module-Bcfg2.Statistics" title="Bcfg2.Statistics"><tt class="xref py py-mod docutils literal"><span class="pre">Bcfg2.Statistics</span></tt></a>.  This module tracks execution time for the
server core and for plugins, and exposes that data via <tt class="docutils literal"><span class="pre">bcfg2-admin</span>
<span class="pre">perf</span></tt>.  This data can be invaluable for locating bottlenecks or other
performance issues.</p>
<p>The simplest way to track statistics is to use the
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.track_statistics" title="Bcfg2.Server.Plugin.helpers.track_statistics"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.track_statistics()</span></tt></a> decorator to
decorate functions that you would like to track execution times for:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">Bcfg2.Server.Plugin</span> <span class="kn">import</span> <span class="n">track_statistics</span>

<span class="nd">@track_statistics</span><span class="p">()</span>
<span class="k">def</span> <span class="nf">do_something</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">...</span><span class="p">):</span>
    <span class="o">...</span>
</pre></div>
</div>
<p>This will track the execution time of <tt class="docutils literal"><span class="pre">do_something</span></tt>.</p>
<p>More granular usage is possible by using <tt class="xref py py-func docutils literal"><span class="pre">time.time()</span></tt> to manually
determine the execution time of a given event and calling
<a class="reference internal" href="#Bcfg2.Statistics.Statistics.add_value" title="Bcfg2.Statistics.Statistics.add_value"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Statistics.Statistics.add_value()</span></tt></a> with an appropriate
statistic name.</p>
<div class="section" id="module-Bcfg2.Statistics">
<span id="bcfg2-statistics"></span><h3>Bcfg2.Statistics<a class="headerlink" href="#module-Bcfg2.Statistics" title="Permalink to this headline">¶</a></h3>
<p>Module for tracking execution time statistics from the Bcfg2
server core.  This data is exposed by
<a class="reference internal" href="core.html#Bcfg2.Server.Core.BaseCore.get_statistics" title="Bcfg2.Server.Core.BaseCore.get_statistics"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Server.Core.BaseCore.get_statistics()</span></tt></a>.</p>
<dl class="class">
<dt id="Bcfg2.Statistics.Statistic">
<em class="property">class </em><tt class="descclassname">Bcfg2.Statistics.</tt><tt class="descname">Statistic</tt><big>(</big><em>name</em>, <em>initial_value</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Statistics.html#Statistic"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Statistics.Statistic" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>A single named statistic, tracking minimum, maximum, and
average execution time, and number of invocations.</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>) &#8211; The name of this statistic</li>
<li><strong>initial_value</strong> (<em>int or float</em>) &#8211; The initial value to be added to this
statistic</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="Bcfg2.Statistics.Statistic.add_value">
<tt class="descname">add_value</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Statistics.html#Statistic.add_value"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Statistics.Statistic.add_value" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a value to the statistic, recalculating the various
metrics.</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>value</strong> (<em>int or float</em>) &#8211; The value to add to this statistic</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Statistics.Statistic.get_value">
<tt class="descname">get_value</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Statistics.html#Statistic.get_value"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Statistics.Statistic.get_value" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a tuple of all the stats tracked on this named item.
The tuple is in the format:</p>
<div class="highlight-python"><pre>(&lt;name&gt;, (min, max, average, number of values))</pre>
</div>
<p>This makes it very easy to cast to a dict in
<a class="reference internal" href="#Bcfg2.Statistics.Statistics.display" title="Bcfg2.Statistics.Statistics.display"><tt class="xref py py-func docutils literal"><span class="pre">Statistics.display()</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">tuple</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Statistics.Statistics">
<em class="property">class </em><tt class="descclassname">Bcfg2.Statistics.</tt><tt class="descname">Statistics</tt><a class="reference internal" href="../_modules/Bcfg2/Statistics.html#Statistics"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Statistics.Statistics" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>A collection of named <a class="reference internal" href="#Bcfg2.Statistics.Statistic" title="Bcfg2.Statistics.Statistic"><tt class="xref py py-class docutils literal"><span class="pre">Statistic</span></tt></a> objects.</p>
<dl class="method">
<dt id="Bcfg2.Statistics.Statistics.add_value">
<tt class="descname">add_value</tt><big>(</big><em>name</em>, <em>value</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Statistics.html#Statistics.add_value"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Statistics.Statistics.add_value" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a value to the named <a class="reference internal" href="#Bcfg2.Statistics.Statistic" title="Bcfg2.Statistics.Statistic"><tt class="xref py py-class docutils literal"><span class="pre">Statistic</span></tt></a>.  This just
proxies to <a class="reference internal" href="#Bcfg2.Statistics.Statistic.add_value" title="Bcfg2.Statistics.Statistic.add_value"><tt class="xref py py-func docutils literal"><span class="pre">Statistic.add_value()</span></tt></a> or the
<a class="reference internal" href="#Bcfg2.Statistics.Statistic" title="Bcfg2.Statistics.Statistic"><tt class="xref py py-class docutils literal"><span class="pre">Statistic</span></tt></a> constructor as appropriate.</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>) &#8211; The name of the <a class="reference internal" href="#Bcfg2.Statistics.Statistic" title="Bcfg2.Statistics.Statistic"><tt class="xref py py-class docutils literal"><span class="pre">Statistic</span></tt></a> to add the
value to</li>
<li><strong>value</strong> (<em>int or float</em>) &#8211; The value to add to the Statistic</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Statistics.Statistics.display">
<tt class="descname">display</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Statistics.html#Statistics.display"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Statistics.Statistics.display" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a dict of all <a class="reference internal" href="#Bcfg2.Statistics.Statistic" title="Bcfg2.Statistics.Statistic"><tt class="xref py py-class docutils literal"><span class="pre">Statistic</span></tt></a> object values.
Keys are the statistic names, and values are tuples of the
statistic metrics as returned by
<a class="reference internal" href="#Bcfg2.Statistics.Statistic.get_value" title="Bcfg2.Statistics.Statistic.get_value"><tt class="xref py py-func docutils literal"><span class="pre">Statistic.get_value()</span></tt></a>.</p>
</dd></dl>

</dd></dl>

<dl class="data">
<dt id="Bcfg2.Statistics.stats">
<tt class="descclassname">Bcfg2.Statistics.</tt><tt class="descname">stats</tt><em class="property"> = &lt;Bcfg2.Statistics.Statistics object at 0x9b9058c&gt;</em><a class="headerlink" href="#Bcfg2.Statistics.stats" title="Permalink to this definition">¶</a></dt>
<dd><p>A module-level <a class="reference internal" href="#Bcfg2.Statistics.Statistics" title="Bcfg2.Statistics.Statistics"><tt class="xref py py-class docutils literal"><span class="pre">Statistics</span></tt></a> objects used to track all
execution time metrics for the server.</p>
</dd></dl>

</div>
</div>
<div class="section" id="module-Bcfg2.Server.Plugin.helpers">
<span id="plugin-helper-classes"></span><h2>Plugin Helper Classes<a class="headerlink" href="#module-Bcfg2.Server.Plugin.helpers" title="Permalink to this headline">¶</a></h2>
<p>Helper classes for Bcfg2 server plugins</p>
<dl class="data">
<dt id="Bcfg2.Server.Plugin.helpers.DEFAULT_FILE_METADATA">
<tt class="descclassname">Bcfg2.Server.Plugin.helpers.</tt><tt class="descname">DEFAULT_FILE_METADATA</tt><em class="property"> = {'group': 'root', 'paranoid': 'true', 'sensitive': 'false', 'important': 'False', 'secontext': '__default__', 'mode': '644', 'owner': 'root'}</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DEFAULT_FILE_METADATA" title="Permalink to this definition">¶</a></dt>
<dd><p>A dict containing default metadata for Path entries from bcfg2.conf</p>
</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.helpers.DatabaseBacked">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.helpers.</tt><tt class="descname">DatabaseBacked</tt><big>(</big><em>core</em>, <em>datastore</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#DatabaseBacked"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DatabaseBacked" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#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></p>
<p>Provides capabilities for a plugin to read and write to a
database.</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>) &#8211; The Bcfg2.Server.Core initializing the plugin</li>
<li><strong>datastore</strong> (<em>string</em>) &#8211; 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="#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.DatabaseBacked.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.DatabaseBacked.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="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.DatabaseBacked._must_lock">
<tt class="descname">_must_lock</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#DatabaseBacked._must_lock"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DatabaseBacked._must_lock" title="Permalink to this definition">¶</a></dt>
<dd><p>Whether or not the backend database must acquire a thread
lock before writing, because it does not allow multiple
threads to write.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.DatabaseBacked._use_db">
<tt class="descname">_use_db</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#DatabaseBacked._use_db"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DatabaseBacked._use_db" title="Permalink to this definition">¶</a></dt>
<dd><p>Whether or not this plugin is configured to use the
database.</p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.DatabaseBacked.debug_log">
<tt class="descname">debug_log</tt><big>(</big><em>message</em>, <em>flag=None</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DatabaseBacked.debug_log" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a message at the debug level.</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>message</strong> (<em>string</em>) &#8211; The message to log</li>
<li><strong>flag</strong> (<em>bool</em>) &#8211; Override the current debug flag with this value</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="staticmethod">
<dt id="Bcfg2.Server.Plugin.helpers.DatabaseBacked.get_db_lock">
<em class="property">static </em><tt class="descname">get_db_lock</tt><big>(</big><em>func</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#DatabaseBacked.get_db_lock"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DatabaseBacked.get_db_lock" title="Permalink to this definition">¶</a></dt>
<dd><p>Decorator to be used by a method of a
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.DatabaseBacked" title="Bcfg2.Server.Plugin.helpers.DatabaseBacked"><tt class="xref py py-class docutils literal"><span class="pre">DatabaseBacked</span></tt></a> plugin that will update database data.</p>
</dd></dl>

<dl class="classmethod">
<dt id="Bcfg2.Server.Plugin.helpers.DatabaseBacked.init_repo">
<em class="property">classmethod </em><tt class="descname">init_repo</tt><big>(</big><em>repo</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DatabaseBacked.init_repo" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform any tasks necessary to create an initial Bcfg2
repository.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>repo</strong> (<em>string</em>) &#8211; The path to the Bcfg2 repository on the filesystem</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="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.DatabaseBacked.option">
<tt class="descname">option</tt><em class="property"> = 'use_database'</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DatabaseBacked.option" title="Permalink to this definition">¶</a></dt>
<dd><p>The option to look up in <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.DatabaseBacked.section" title="Bcfg2.Server.Plugin.helpers.DatabaseBacked.section"><tt class="xref py py-attr docutils literal"><span class="pre">section</span></tt></a> to determine whether or
not to use the database capabilities of this plugin.  The option
is retrieved with
<tt class="xref py py-func docutils literal"><span class="pre">ConfigParser.SafeConfigParser.getboolean()</span></tt>, and so must
conform to the possible values that function can handle.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.DatabaseBacked.section">
<tt class="descname">section</tt><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DatabaseBacked.section" title="Permalink to this definition">¶</a></dt>
<dd><p>The section to look in for <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.DatabaseBacked.option" title="Bcfg2.Server.Plugin.helpers.DatabaseBacked.option"><tt class="xref py py-attr docutils literal"><span class="pre">DatabaseBacked.option</span></tt></a></p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.DatabaseBacked.set_debug">
<tt class="descname">set_debug</tt><big>(</big><em>debug</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DatabaseBacked.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="method">
<dt id="Bcfg2.Server.Plugin.helpers.DatabaseBacked.shutdown">
<tt class="descname">shutdown</tt><big>(</big><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DatabaseBacked.shutdown" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform shutdown tasks for the plugin</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">None</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.DatabaseBacked.toggle_debug">
<tt class="descname">toggle_debug</tt><big>(</big><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DatabaseBacked.toggle_debug" title="Permalink to this definition">¶</a></dt>
<dd><p>Turn debugging output on or off.  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>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.helpers.DirectoryBacked">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.helpers.</tt><tt class="descname">DirectoryBacked</tt><big>(</big><em>data</em>, <em>fam</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#DirectoryBacked"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DirectoryBacked" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>DirectoryBacked objects represent a directory that contains
files, represented by objects of the type listed in
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.DirectoryBacked.__child__" title="Bcfg2.Server.Plugin.helpers.DirectoryBacked.__child__"><tt class="xref py py-attr docutils literal"><span class="pre">__child__</span></tt></a>, and other directories recursively.  It monitors
for new files and directories to be added, and creates new objects
as required to track those.</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>) &#8211; The path to the data directory that will be
monitored</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>) &#8211; The FAM object used to receive notifications of
changes</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.DirectoryBacked.__child__">
<tt class="descname">__child__</tt><em class="property"> = &lt;class 'Bcfg2.Server.Plugin.helpers.FileBacked'&gt;</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DirectoryBacked.__child__" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of child objects to create for files contained within
the directory that is tracked.  Default is
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.FileBacked" title="Bcfg2.Server.Plugin.helpers.FileBacked"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.FileBacked</span></tt></a></p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.DirectoryBacked.HandleEvent">
<tt class="descname">HandleEvent</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#DirectoryBacked.HandleEvent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DirectoryBacked.HandleEvent" title="Permalink to this definition">¶</a></dt>
<dd><p>Handle FAM events.</p>
<p>This method is invoked by the FAM when it detects a change to
a filesystem object we have requsted to be monitored.</p>
<p>This method manages the lifecycle of events related to the
monitored objects, adding them to our list of entries and
creating objects of type <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.DirectoryBacked.__child__" title="Bcfg2.Server.Plugin.helpers.DirectoryBacked.__child__"><tt class="xref py py-attr docutils literal"><span class="pre">__child__</span></tt></a> that actually do
the domain-specific processing. When appropriate, it
propogates events those objects by invoking their HandleEvent
method in turn.</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>) &#8211; FAM event that caused this entry to be added.</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.Plugin.helpers.DirectoryBacked.add_directory_monitor">
<tt class="descname">add_directory_monitor</tt><big>(</big><em>relative</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#DirectoryBacked.add_directory_monitor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DirectoryBacked.add_directory_monitor" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a new directory to the FAM for monitoring.</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>relative</strong> (<em>string</em>) &#8211; Path name to monitor. This must be relative
to the plugin&#8217;s directory. An empty string
value (&#8220;&#8221;) will cause the plugin directory
itself to be monitored.</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.Plugin.helpers.DirectoryBacked.add_entry">
<tt class="descname">add_entry</tt><big>(</big><em>relative</em>, <em>event</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#DirectoryBacked.add_entry"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DirectoryBacked.add_entry" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a new file to our tracked entries, and to our FAM for
monitoring.</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>relative</strong> (<em>string:</em>) &#8211; Path name to monitor. This must be relative
to the plugin&#8217;s directory.</li>
<li><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>) &#8211; FAM event that caused this entry to be added.</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.Plugin.helpers.DirectoryBacked.entries">
<tt class="descname">entries</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DirectoryBacked.entries" title="Permalink to this definition">¶</a></dt>
<dd><p>self.entries contains information about the files monitored
by this object. The keys of the dict are the relative
paths to the files. The values are the objects (of type
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.DirectoryBacked.__child__" title="Bcfg2.Server.Plugin.helpers.DirectoryBacked.__child__"><tt class="xref py py-attr docutils literal"><span class="pre">__child__</span></tt></a>) that handle their contents.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.DirectoryBacked.handles">
<tt class="descname">handles</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DirectoryBacked.handles" title="Permalink to this definition">¶</a></dt>
<dd><p>self.handles contains information about the directories
monitored by this object. The keys of the dict are the
values returned by the initial fam.AddMonitor() call (which
appear to be integers). The values are the relative paths of
the directories.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.DirectoryBacked.ignore">
<tt class="descname">ignore</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DirectoryBacked.ignore" title="Permalink to this definition">¶</a></dt>
<dd><p>Preemptively ignore files whose names (not paths) match this
compiled regex.  <tt class="docutils literal"><span class="pre">ignore</span></tt> can be set to <tt class="docutils literal"><span class="pre">None</span></tt> to ignore no
files.  If a file is encountered that does not match
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.DirectoryBacked.patterns" title="Bcfg2.Server.Plugin.helpers.DirectoryBacked.patterns"><tt class="xref py py-attr docutils literal"><span class="pre">patterns</span></tt></a> or <tt class="docutils literal"><span class="pre">ignore</span></tt>, then a warning will be produced.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.DirectoryBacked.patterns">
<tt class="descname">patterns</tt><em class="property"> = &lt;_sre.SRE_Pattern object at 0x9a97698&gt;</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.DirectoryBacked.patterns" title="Permalink to this definition">¶</a></dt>
<dd><p>Only track and include files whose names (not paths) match this
compiled regex.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.helpers.EntrySet">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.helpers.</tt><tt class="descname">EntrySet</tt><big>(</big><em>basename</em>, <em>path</em>, <em>entry_type</em>, <em>encoding</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#EntrySet"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.EntrySet" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#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>EntrySets deal with a collection of host- and group-specific
files (e.g., <a class="reference internal" href="#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>
objects) in a single directory. EntrySets are usually used as part
of <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.GroupSpool" title="Bcfg2.Server.Plugin.helpers.GroupSpool"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.GroupSpool</span></tt></a> objects.</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>basename</strong> (<em>string</em>) &#8211; The filename or regular expression that files
in this EntrySet must match.  See
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.EntrySet.basename_is_regex" title="Bcfg2.Server.Plugin.helpers.EntrySet.basename_is_regex"><tt class="xref py py-attr docutils literal"><span class="pre">basename_is_regex</span></tt></a> for more details.</li>
<li><strong>path</strong> (<em>string</em>) &#8211; The full path to the directory containing files
for this EntrySet</li>
<li><strong>entry_type</strong> (<em>callable</em>) &#8211; A callable that returns an object that
represents files in this EntrySet.  This
will usually be a class object, but it can
be an object factory or similar callable.
See below for the expected signature.</li>
<li><strong>encoding</strong> (<em>string</em>) &#8211; The encoding of all files in this entry set.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>The <tt class="docutils literal"><span class="pre">entry_type</span></tt> callable must have the following signature:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">entry_type</span><span class="p">(</span><span class="n">filepath</span><span class="p">,</span> <span class="n">specificity</span><span class="p">,</span> <span class="n">encoding</span><span class="p">)</span>
</pre></div>
</div>
<p>Where the parameters are:</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>filepath</strong> (<em>string</em>) &#8211; Full path to file</li>
<li><strong>specific</strong> (<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.Specificity" title="Bcfg2.Server.Plugin.helpers.Specificity"><em>Bcfg2.Server.Plugin.helpers.Specificity</em></a>) &#8211; A
<a class="reference internal" href="#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>) &#8211; The encoding to use for data in this file</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Additionally, the object returned by <tt class="docutils literal"><span class="pre">entry_type</span></tt> must have
a <tt class="docutils literal"><span class="pre">specific</span></tt> attribute that is sortable (e.g., a
<a class="reference internal" href="#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).</p>
<p>See <a class="reference internal" href="#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> for an
example of a class that can be used as an <tt class="docutils literal"><span class="pre">entry_type</span></tt>.</p>
<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.EntrySet.basename_is_regex">
<tt class="descname">basename_is_regex</tt><em class="property"> = False</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.EntrySet.basename_is_regex" title="Permalink to this definition">¶</a></dt>
<dd><p>processed as a string that contains a regular expression (i.e.,
<em>not</em> a compiled regex object) if <tt class="docutils literal"><span class="pre">basename_is_regex</span></tt> is True,
and all files that match the regex will be cincluded in the
EntrySet.  If <tt class="docutils literal"><span class="pre">basename_is_regex</span></tt> is False, then it will be
considered a plain string and filenames must match exactly.</p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.EntrySet.best_matching">
<tt class="descname">best_matching</tt><big>(</big><em>metadata</em>, <em>matching=None</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#EntrySet.best_matching"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.EntrySet.best_matching" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the single most specific matching entry from the
set of matching entries.  You can use <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.EntrySet.get_matching" title="Bcfg2.Server.Plugin.helpers.EntrySet.get_matching"><tt class="xref py py-func docutils literal"><span class="pre">get_matching()</span></tt></a> to
get all matching entries.</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>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; The client metadata to get matching entries for</li>
<li><strong>matching</strong> (list of <tt class="docutils literal"><span class="pre">entry_type</span></tt> objects (see the constructor
docs for more details)) &#8211; The set of matching entries to pick from.  If
this is not provided, <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.EntrySet.get_matching" title="Bcfg2.Server.Plugin.helpers.EntrySet.get_matching"><tt class="xref py py-func docutils literal"><span class="pre">get_matching()</span></tt></a>
will be called.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a single object from the list of matching
<tt class="docutils literal"><span class="pre">entry_type</span></tt> objects</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="#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>
if no matching entries are found</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.EntrySet.bind_entry">
<tt class="descname">bind_entry</tt><big>(</big><em>entry</em>, <em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#EntrySet.bind_entry"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.EntrySet.bind_entry" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the single best fully-bound entry from the set of
available entries 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 simple">
<li><strong>entry</strong> (<em>lxml.etree._Element</em>) &#8211; The abstract entry to bind the info to</li>
<li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; The client metadata to get info for</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.Plugin.helpers.EntrySet.bind_info_to_entry">
<tt class="descname">bind_info_to_entry</tt><big>(</big><em>entry</em>, <em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#EntrySet.bind_info_to_entry"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.EntrySet.bind_info_to_entry" title="Permalink to this definition">¶</a></dt>
<dd><p>Shortcut to call <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.bind_info" title="Bcfg2.Server.Plugin.helpers.bind_info"><tt class="xref py py-func docutils literal"><span class="pre">bind_info()</span></tt></a> with the base
info/info.xml for this EntrySet.</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>entry</strong> (<em>lxml.etree._Element</em>) &#8211; The abstract entry to bind the info to. This
will be modified in place</li>
<li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; The client metadata to get info for</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="method">
<dt id="Bcfg2.Server.Plugin.helpers.EntrySet.debug_log">
<tt class="descname">debug_log</tt><big>(</big><em>message</em>, <em>flag=None</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.EntrySet.debug_log" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a message at the debug level.</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>message</strong> (<em>string</em>) &#8211; The message to log</li>
<li><strong>flag</strong> (<em>bool</em>) &#8211; Override the current debug flag with this value</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="method">
<dt id="Bcfg2.Server.Plugin.helpers.EntrySet.entry_init">
<tt class="descname">entry_init</tt><big>(</big><em>event</em>, <em>entry_type=None</em>, <em>specific=None</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#EntrySet.entry_init"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.EntrySet.entry_init" title="Permalink to this definition">¶</a></dt>
<dd><p>Handle the creation of a file on the filesystem and the
creation of an object in this EntrySet to track 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>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>) &#8211; An event that applies to a file handled by this
EntrySet</li>
<li><strong>entry_type</strong> (<em>callable</em>) &#8211; Override the default <tt class="docutils literal"><span class="pre">entry_type</span></tt> for
this EntrySet object and create a different
object for this entry.  See the constructor
docs for more information on
<tt class="docutils literal"><span class="pre">entry_type</span></tt>.</li>
<li><strong>specific</strong> (<em>compiled regular expression object</em>) &#8211; Override the default <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.EntrySet.specific" title="Bcfg2.Server.Plugin.helpers.EntrySet.specific"><tt class="xref py py-attr docutils literal"><span class="pre">specific</span></tt></a> regular
expression used by this object with a custom
regular expression that will be used to
determine the specificity of this entry.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">None</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="#Bcfg2.Server.Plugin.exceptions.SpecificityError" title="Bcfg2.Server.Plugin.exceptions.SpecificityError"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.exceptions.SpecificityError</span></tt></a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.EntrySet.get_matching">
<tt class="descname">get_matching</tt><big>(</big><em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#EntrySet.get_matching"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.EntrySet.get_matching" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a list of all entries that apply to the given client.
This gets all matching entries; for example, there could be an
entry that applies to all clients, multiple group-specific
entries, and a client-specific entry, all of which would be
returned by get_matching().  You can use <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.EntrySet.best_matching" title="Bcfg2.Server.Plugin.helpers.EntrySet.best_matching"><tt class="xref py py-func docutils literal"><span class="pre">best_matching()</span></tt></a>
to get the single best matching entry.</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>) &#8211; The client metadata to get matching entries for</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list &#8211; all matching <tt class="docutils literal"><span class="pre">entry_type</span></tt> objects (see the
constructor docs for more details)</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.EntrySet.handle_event">
<tt class="descname">handle_event</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#EntrySet.handle_event"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.EntrySet.handle_event" title="Permalink to this definition">¶</a></dt>
<dd><p>Dispatch a FAM event to the appropriate function or child
<tt class="docutils literal"><span class="pre">entry_type</span></tt> object.  This will probably be handled by a
call to <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.EntrySet.update_metadata" title="Bcfg2.Server.Plugin.helpers.EntrySet.update_metadata"><tt class="xref py py-func docutils literal"><span class="pre">update_metadata()</span></tt></a>, <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.EntrySet.reset_metadata" title="Bcfg2.Server.Plugin.helpers.EntrySet.reset_metadata"><tt class="xref py py-func docutils literal"><span class="pre">reset_metadata()</span></tt></a>,
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.EntrySet.entry_init" title="Bcfg2.Server.Plugin.helpers.EntrySet.entry_init"><tt class="xref py py-func docutils literal"><span class="pre">entry_init()</span></tt></a>, or to the <tt class="docutils literal"><span class="pre">entry_type</span></tt>
<tt class="docutils literal"><span class="pre">handle_event()</span></tt> function.</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>) &#8211; An event that applies to a file handled by this
EntrySet</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="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.EntrySet.ignore">
<tt class="descname">ignore</tt><em class="property"> = &lt;_sre.SRE_Pattern object at 0x9c0fc28&gt;</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.EntrySet.ignore" title="Permalink to this definition">¶</a></dt>
<dd><p>Preemptively ignore files whose names (not paths) match this
compiled regex.  <tt class="docutils literal"><span class="pre">ignore</span></tt> cannot be set to <tt class="docutils literal"><span class="pre">None</span></tt>.  If a
file is encountered that does not match the <tt class="docutils literal"><span class="pre">basename</span></tt>
argument passed to the constructor or <tt class="docutils literal"><span class="pre">ignore</span></tt>, then a
warning will be produced.</p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.EntrySet.reset_metadata">
<tt class="descname">reset_metadata</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#EntrySet.reset_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.EntrySet.reset_metadata" title="Permalink to this definition">¶</a></dt>
<dd><p>Reset metadata to defaults if info. :info, or info.xml are
removed.</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>) &#8211; An event that applies to an info handled by this
EntrySet</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.Plugin.helpers.EntrySet.set_debug">
<tt class="descname">set_debug</tt><big>(</big><em>debug</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.EntrySet.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.Plugin.helpers.EntrySet.specific">
<tt class="descname">specific</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.EntrySet.specific" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="docutils literal"><span class="pre">specific</span></tt> is a regular expression that is used to
determine the specificity of a file in this entry set.  It
must have three named groups: <tt class="docutils literal"><span class="pre">hostname</span></tt>, <tt class="docutils literal"><span class="pre">prio</span></tt> (the
priority of a group-specific file), and <tt class="docutils literal"><span class="pre">group</span></tt>.  The base
regex is constructed from the <tt class="docutils literal"><span class="pre">basename</span></tt> argument. It can
be overridden on a per-entry basis in <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.EntrySet.entry_init" title="Bcfg2.Server.Plugin.helpers.EntrySet.entry_init"><tt class="xref py py-func docutils literal"><span class="pre">entry_init()</span></tt></a>.</p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.EntrySet.specificity_from_filename">
<tt class="descname">specificity_from_filename</tt><big>(</big><em>fname</em>, <em>specific=None</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#EntrySet.specificity_from_filename"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.EntrySet.specificity_from_filename" title="Permalink to this definition">¶</a></dt>
<dd><p>Construct a
<a class="reference internal" href="#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 from a
filename and regex. See <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.EntrySet.specific" title="Bcfg2.Server.Plugin.helpers.EntrySet.specific"><tt class="xref py py-attr docutils literal"><span class="pre">specific</span></tt></a> for details on the
regex.</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>fname</strong> (<em>string</em>) &#8211; The filename (not full path) of a file that is
in this EntrySet&#8217;s directory.  It is not
necessary to determine first if the filename
matches this EntrySet&#8217;s basename; that can be
done by catching
<a class="reference internal" href="#Bcfg2.Server.Plugin.exceptions.SpecificityError" title="Bcfg2.Server.Plugin.exceptions.SpecificityError"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.exceptions.SpecificityError</span></tt></a>
from this function.</li>
<li><strong>specific</strong> (<em>compiled regular expression object</em>) &#8211; Override the default <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.EntrySet.specific" title="Bcfg2.Server.Plugin.helpers.EntrySet.specific"><tt class="xref py py-attr docutils literal"><span class="pre">specific</span></tt></a> regular
expression used by this object with a custom
regular expression that will be used to
determine the specificity of this entry.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Object representing the specificity of the file</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference internal" href="#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></p>
</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.Plugin.exceptions.SpecificityError" title="Bcfg2.Server.Plugin.exceptions.SpecificityError"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.exceptions.SpecificityError</span></tt></a>
if the regex does not match the filename</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.EntrySet.toggle_debug">
<tt class="descname">toggle_debug</tt><big>(</big><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.EntrySet.toggle_debug" title="Permalink to this definition">¶</a></dt>
<dd><p>Turn debugging output on or off.  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="method">
<dt id="Bcfg2.Server.Plugin.helpers.EntrySet.update_metadata">
<tt class="descname">update_metadata</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#EntrySet.update_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.EntrySet.update_metadata" title="Permalink to this definition">¶</a></dt>
<dd><p>Process changes to or creation of info, :info, and
info.xml files for the EntrySet.</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>) &#8211; An event that applies to an info handled by this
EntrySet</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.helpers.FileBacked">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.helpers.</tt><tt class="descname">FileBacked</tt><big>(</big><em>name</em>, <em>fam=None</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#FileBacked"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.FileBacked" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>This object caches file data in memory. FileBacked objects are
principally meant to be used as a part of
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.DirectoryBacked" title="Bcfg2.Server.Plugin.helpers.DirectoryBacked"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.DirectoryBacked</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>) &#8211; The full path to the file to cache and monitor</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>) &#8211; The FAM object used to receive notifications of
changes</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.FileBacked.HandleEvent">
<tt class="descname">HandleEvent</tt><big>(</big><em>event=None</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#FileBacked.HandleEvent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.FileBacked.HandleEvent" title="Permalink to this definition">¶</a></dt>
<dd><p>HandleEvent is called whenever the FAM registers an event.</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>) &#8211; 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.Plugin.helpers.FileBacked.Index">
<tt class="descname">Index</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#FileBacked.Index"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.FileBacked.Index" title="Permalink to this definition">¶</a></dt>
<dd><p>Index() is called by <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.FileBacked.HandleEvent" title="Bcfg2.Server.Plugin.helpers.FileBacked.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>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.FileBacked.data">
<tt class="descname">data</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.FileBacked.data" title="Permalink to this definition">¶</a></dt>
<dd><p>A string containing the raw data in this file</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.FileBacked.fam">
<tt class="descname">fam</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.FileBacked.fam" title="Permalink to this definition">¶</a></dt>
<dd><p>The FAM object used to receive notifications of changes</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.FileBacked.name">
<tt class="descname">name</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.FileBacked.name" title="Permalink to this definition">¶</a></dt>
<dd><p>The full path to the file</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.helpers.GroupSpool">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.helpers.</tt><tt class="descname">GroupSpool</tt><big>(</big><em>core</em>, <em>datastore</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#GroupSpool"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.GroupSpool" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#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="#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></p>
<p>A GroupSpool is a collection of
<a class="reference internal" href="#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> objects &#8211; i.e., a
directory tree, each directory in which may contain files that are
specific to groups/clients/etc.</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>) &#8211; The Bcfg2.Server.Core initializing the plugin</li>
<li><strong>datastore</strong> (<em>string</em>) &#8211; 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="#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.GroupSpool.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.GroupSpool.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.Plugin.helpers.GroupSpool.AddDirectoryMonitor">
<tt class="descname">AddDirectoryMonitor</tt><big>(</big><em>relative</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#GroupSpool.AddDirectoryMonitor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.AddDirectoryMonitor" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a FAM monitor to a new directory and set the
appropriate event handler.</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>relative</strong> (<em>string</em>) &#8211; The path to the directory relative to the
base data directory of the GroupSpool 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.Plugin.helpers.GroupSpool.HandleEntry">
<tt class="descname">HandleEntry</tt><big>(</big><em>entry</em>, <em>metadata</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.HandleEntry" title="Permalink to this definition">¶</a></dt>
<dd><p>HandleEntry is the slow path method for binding
configuration binding requests.  It is called if the
<tt class="docutils literal"><span class="pre">Entries</span></tt> dict does not contain a method for binding the
entry, and <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.HandlesEntry" title="Bcfg2.Server.Plugin.helpers.GroupSpool.HandlesEntry"><tt class="xref py py-func docutils literal"><span class="pre">HandlesEntry()</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"><ul class="first simple">
<li><strong>entry</strong> (<em>lxml.etree._Element</em>) &#8211; The entry to bind</li>
<li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; 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">lxml.etree._Element - The fully bound 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="#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.Plugin.helpers.GroupSpool.HandleEvent">
<tt class="descname">HandleEvent</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#GroupSpool.HandleEvent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.HandleEvent" title="Permalink to this definition">¶</a></dt>
<dd><p>HandleEvent is the event dispatcher for GroupSpool
objects.  It receives all events and dispatches them the
appropriate handling object (e.g., one of the <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.es_cls" title="Bcfg2.Server.Plugin.helpers.GroupSpool.es_cls"><tt class="xref py py-attr docutils literal"><span class="pre">es_cls</span></tt></a>
objects in <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.entries" title="Bcfg2.Server.Plugin.helpers.GroupSpool.entries"><tt class="xref py py-attr docutils literal"><span class="pre">entries</span></tt></a>), function (e.g.,
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.add_entry" title="Bcfg2.Server.Plugin.helpers.GroupSpool.add_entry"><tt class="xref py py-func docutils literal"><span class="pre">add_entry()</span></tt></a>), or behavior (e.g., deleting an entire
entry set).</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>) &#8211; An event that applies to a file or directory
handled by this GroupSpool</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.Plugin.helpers.GroupSpool.HandlesEntry">
<tt class="descname">HandlesEntry</tt><big>(</big><em>entry</em>, <em>metadata</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.HandlesEntry" title="Permalink to this definition">¶</a></dt>
<dd><p>HandlesEntry is the slow path method for routing
configuration binding requests.  It is called if the
<tt class="docutils literal"><span class="pre">Entries</span></tt> dict does not contain a method for binding the
entry.</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>entry</strong> (<em>lxml.etree._Element</em>) &#8211; The entry to bind</li>
<li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; 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="#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.Plugin.helpers.GroupSpool.add_entry">
<tt class="descname">add_entry</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#GroupSpool.add_entry"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.add_entry" title="Permalink to this definition">¶</a></dt>
<dd><p>This method handles two functions:</p>
<ul class="simple">
<li>Adding a new entry of type <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.es_cls" title="Bcfg2.Server.Plugin.helpers.GroupSpool.es_cls"><tt class="xref py py-attr docutils literal"><span class="pre">es_cls</span></tt></a> to track a new
directory.</li>
<li>Passing off an event on a file to the correct entry object
to handle it.</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>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>) &#8211; An event that applies to a file or directory
handled by this GroupSpool</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.Plugin.helpers.GroupSpool.debug_log">
<tt class="descname">debug_log</tt><big>(</big><em>message</em>, <em>flag=None</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.debug_log" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a message at the debug level.</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>message</strong> (<em>string</em>) &#8211; The message to log</li>
<li><strong>flag</strong> (<em>bool</em>) &#8211; Override the current debug flag with this value</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.Plugin.helpers.GroupSpool.entries">
<tt class="descname">entries</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.entries" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="docutils literal"><span class="pre">entries</span></tt> is a dict whose keys are <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.event_id" title="Bcfg2.Server.Plugin.helpers.GroupSpool.event_id"><tt class="xref py py-func docutils literal"><span class="pre">event_id()</span></tt></a> return
values and whose values are <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.es_cls" title="Bcfg2.Server.Plugin.helpers.GroupSpool.es_cls"><tt class="xref py py-attr docutils literal"><span class="pre">es_cls</span></tt></a> objects. It ties
the directories handled by this GroupSpools to the
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.es_cls" title="Bcfg2.Server.Plugin.helpers.GroupSpool.es_cls"><tt class="xref py py-attr docutils literal"><span class="pre">es_cls</span></tt></a> objects that handle each directory.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.GroupSpool.entry_type">
<tt class="descname">entry_type</tt><em class="property"> = 'Path'</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.entry_type" title="Permalink to this definition">¶</a></dt>
<dd><p>The entry type (i.e., the XML tag) handled by this GroupSpool
object.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.GroupSpool.es_child_cls">
<tt class="descname">es_child_cls</tt><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.es_child_cls" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="docutils literal"><span class="pre">es_child_cls</span></tt> is a callable that will be used as the
<tt class="docutils literal"><span class="pre">entry_type</span></tt> argument to the <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.es_cls" title="Bcfg2.Server.Plugin.helpers.GroupSpool.es_cls"><tt class="xref py py-attr docutils literal"><span class="pre">es_cls</span></tt></a> callable.  It must
return objects that will represent individual files in the
GroupSpool.  For instance,
<a class="reference internal" href="#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>alias of <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.GroupSpool.es_cls">
<tt class="descname">es_cls</tt><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.es_cls" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="docutils literal"><span class="pre">es_cls</span></tt> is a callable that must return objects that will be
used to represent directories (i.e., sets of entries) within the
GroupSpool.  E.g.,
<a class="reference internal" href="#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>.  The returned
object must implement a callable called <tt class="docutils literal"><span class="pre">bind_entry</span></tt> that has
the same signature as <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.EntrySet.bind_entry" title="Bcfg2.Server.Plugin.helpers.EntrySet.bind_entry"><tt class="xref py py-attr docutils literal"><span class="pre">EntrySet.bind_entry</span></tt></a>.</p>
<p>alias of <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.EntrySet" title="Bcfg2.Server.Plugin.helpers.EntrySet"><tt class="xref py py-class docutils literal"><span class="pre">EntrySet</span></tt></a></p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.GroupSpool.event_id">
<tt class="descname">event_id</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#GroupSpool.event_id"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.event_id" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a string that can be used to relate the event
unambiguously to a single <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.es_cls" title="Bcfg2.Server.Plugin.helpers.GroupSpool.es_cls"><tt class="xref py py-attr docutils literal"><span class="pre">es_cls</span></tt></a> object in the
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.entries" title="Bcfg2.Server.Plugin.helpers.GroupSpool.entries"><tt class="xref py py-attr docutils literal"><span class="pre">entries</span></tt></a> dict.  In practice, this means:</p>
<ul class="simple">
<li>If the event is on a directory, <tt class="docutils literal"><span class="pre">event_id</span></tt> returns the
full path to the directory.</li>
<li>If the event is on a file, <tt class="docutils literal"><span class="pre">event_id</span></tt> returns the full
path to the directory the file is in.</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>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>) &#8211; An event that applies to a file or directory
handled by this GroupSpool</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="method">
<dt id="Bcfg2.Server.Plugin.helpers.GroupSpool.event_path">
<tt class="descname">event_path</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#GroupSpool.event_path"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.event_path" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the full path to the filename affected by an event.
<a class="reference internal" href="fam.html#Bcfg2.Server.FileMonitor.Event" title="Bcfg2.Server.FileMonitor.Event"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.FileMonitor.Event</span></tt></a> objects just contain
the filename, not the full path, so this function reconstructs
the fill path based on the path to the <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.es_cls" title="Bcfg2.Server.Plugin.helpers.GroupSpool.es_cls"><tt class="xref py py-attr docutils literal"><span class="pre">es_cls</span></tt></a> object
that handles the event.</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>) &#8211; An event that applies to a file or directory
handled by this GroupSpool</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.Plugin.helpers.GroupSpool.filename_pattern">
<tt class="descname">filename_pattern</tt><em class="property"> = ''</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.filename_pattern" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="docutils literal"><span class="pre">filename_pattern</span></tt> is used as the <tt class="docutils literal"><span class="pre">basename</span></tt> argument to the
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.es_cls" title="Bcfg2.Server.Plugin.helpers.GroupSpool.es_cls"><tt class="xref py py-attr docutils literal"><span class="pre">es_cls</span></tt></a> callable.  It may or may not be a regex,
depending on the <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.EntrySet.basename_is_regex" title="Bcfg2.Server.Plugin.helpers.EntrySet.basename_is_regex"><tt class="xref py py-attr docutils literal"><span class="pre">EntrySet.basename_is_regex</span></tt></a> setting.</p>
</dd></dl>

<dl class="classmethod">
<dt id="Bcfg2.Server.Plugin.helpers.GroupSpool.init_repo">
<em class="property">classmethod </em><tt class="descname">init_repo</tt><big>(</big><em>repo</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.init_repo" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform any tasks necessary to create an initial Bcfg2
repository.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>repo</strong> (<em>string</em>) &#8211; The path to the Bcfg2 repository on the filesystem</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.Plugin.helpers.GroupSpool.set_debug">
<tt class="descname">set_debug</tt><big>(</big><em>debug</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#GroupSpool.set_debug"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.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="method">
<dt id="Bcfg2.Server.Plugin.helpers.GroupSpool.shutdown">
<tt class="descname">shutdown</tt><big>(</big><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.shutdown" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform shutdown tasks for the plugin</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">None</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.GroupSpool.toggle_debug">
<tt class="descname">toggle_debug</tt><big>(</big><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.GroupSpool.toggle_debug" title="Permalink to this definition">¶</a></dt>
<dd><p>Turn debugging output on or off.  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>

</dd></dl>

<dl class="data">
<dt id="Bcfg2.Server.Plugin.helpers.INFO_REGEX">
<tt class="descclassname">Bcfg2.Server.Plugin.helpers.</tt><tt class="descname">INFO_REGEX</tt><em class="property"> = &lt;_sre.SRE_Pattern object at 0x9b2a780&gt;</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.INFO_REGEX" title="Permalink to this definition">¶</a></dt>
<dd><p>a compiled regular expression for parsing info and :info files</p>
</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.helpers.INode">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.helpers.</tt><tt class="descname">INode</tt><big>(</big><em>data</em>, <em>idict</em>, <em>parent=None</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#INode"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.INode" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>INodes provide lists of things available at a particular group
intersection.  INodes are deprecated; new plugins should use
<a class="reference internal" href="#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> instead.</p>
<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.INode.Match">
<tt class="descname">Match</tt><big>(</big><em>metadata</em>, <em>data</em>, <em>entry=&lt;Element None at 0x9a9a2fc&gt;</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#INode.Match"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.INode.Match" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a dictionary of package mappings.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.helpers.InfoNode">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.helpers.</tt><tt class="descname">InfoNode</tt><big>(</big><em>data</em>, <em>idict</em>, <em>parent=None</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#InfoNode"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.InfoNode" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.INode" title="Bcfg2.Server.Plugin.helpers.INode"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.INode</span></tt></a></p>
<p><a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.INode" title="Bcfg2.Server.Plugin.helpers.INode"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.INode</span></tt></a> implementation that
includes <tt class="docutils literal"><span class="pre">&lt;Path&gt;</span></tt> tags, suitable for use with <tt class="file docutils literal"><span class="pre">info.xml</span></tt>
files.</p>
<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.InfoNode.Match">
<tt class="descname">Match</tt><big>(</big><em>metadata</em>, <em>data</em>, <em>entry=&lt;Element None at 0x9a9a2fc&gt;</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.InfoNode.Match" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a dictionary of package mappings.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.helpers.InfoXML">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.helpers.</tt><tt class="descname">InfoXML</tt><big>(</big><em>filename</em>, <em>fam=None</em>, <em>should_monitor=False</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#InfoXML"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.InfoXML" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.XMLSrc" title="Bcfg2.Server.Plugin.helpers.XMLSrc"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.XMLSrc</span></tt></a></p>
<p>InfoXML files contain a
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.InfoNode" title="Bcfg2.Server.Plugin.helpers.InfoNode"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.InfoNode</span></tt></a> hierarchy that
returns matching entries, suitable for use with <tt class="file docutils literal"><span class="pre">info.xml</span></tt>
files.</p>
<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.InfoXML.Cache">
<tt class="descname">Cache</tt><big>(</big><em>metadata</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.InfoXML.Cache" title="Permalink to this definition">¶</a></dt>
<dd><p>Build a package dict for a given host.</p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.InfoXML.HandleEvent">
<tt class="descname">HandleEvent</tt><big>(</big><em>_=None</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.InfoXML.HandleEvent" title="Permalink to this definition">¶</a></dt>
<dd><p>Read file upon update.</p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.InfoXML.Index">
<tt class="descname">Index</tt><big>(</big><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.InfoXML.Index" title="Permalink to this definition">¶</a></dt>
<dd><p>Index() is called by <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.InfoXML.HandleEvent" title="Bcfg2.Server.Plugin.helpers.InfoXML.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>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.InfoXML.add_monitor">
<tt class="descname">add_monitor</tt><big>(</big><em>fpath</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.InfoXML.add_monitor" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a FAM monitor to a file that has been XIncluded.  This
is only done if the constructor got both a <tt class="docutils literal"><span class="pre">fam</span></tt> object and
<tt class="docutils literal"><span class="pre">should_monitor</span></tt> set to 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>fpath</strong> (<em>string</em>) &#8211; The full path to the file to monitor</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.helpers.PluginDatabaseModel">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.helpers.</tt><tt class="descname">PluginDatabaseModel</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#PluginDatabaseModel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.PluginDatabaseModel" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>A database model mixin that all database models used by
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.DatabaseBacked" title="Bcfg2.Server.Plugin.helpers.DatabaseBacked"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.DatabaseBacked</span></tt></a> plugins must
inherit from.  This is just a mixin; models must also inherit from
django.db.models.Model to be valid Django models.</p>
</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.helpers.PrioDir">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.helpers.</tt><tt class="descname">PrioDir</tt><big>(</big><em>core</em>, <em>datastore</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#PrioDir"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.PrioDir" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#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="#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="#Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked" title="Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked</span></tt></a></p>
<p>PrioDir handles a directory of XML files where each file has a
set priority.</p>
<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.PrioDir.__child__">
<tt class="descname">__child__</tt><em class="property"> = &lt;class 'Bcfg2.Server.Plugin.helpers.XMLSrc'&gt;</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.PrioDir.__child__" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of child objects to create for files contained within
the directory that is tracked.  Default is
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.XMLSrc" title="Bcfg2.Server.Plugin.helpers.XMLSrc"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.XMLSrc</span></tt></a></p>
</dd></dl>

<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>) &#8211; The Bcfg2.Server.Core initializing the plugin</li>
<li><strong>datastore</strong> (<em>string</em>) &#8211; 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="#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.PrioDir.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.PrioDir.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.Plugin.helpers.PrioDir.BindEntry">
<tt class="descname">BindEntry</tt><big>(</big><em>entry</em>, <em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#PrioDir.BindEntry"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.PrioDir.BindEntry" title="Permalink to this definition">¶</a></dt>
<dd><p>Bind the attributes that apply to an entry to it.  The
entry is modified in-place.</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>entry</strong> (<em>lxml.etree._Element</em>) &#8211; The entry to add attributes to.</li>
<li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; The metadata to get attributes for</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="method">
<dt id="Bcfg2.Server.Plugin.helpers.PrioDir.HandleEntry">
<tt class="descname">HandleEntry</tt><big>(</big><em>entry</em>, <em>metadata</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.PrioDir.HandleEntry" title="Permalink to this definition">¶</a></dt>
<dd><p>HandleEntry is the slow path method for binding
configuration binding requests.  It is called if the
<tt class="docutils literal"><span class="pre">Entries</span></tt> dict does not contain a method for binding the
entry, and <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.PrioDir.HandlesEntry" title="Bcfg2.Server.Plugin.helpers.PrioDir.HandlesEntry"><tt class="xref py py-func docutils literal"><span class="pre">HandlesEntry()</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"><ul class="first simple">
<li><strong>entry</strong> (<em>lxml.etree._Element</em>) &#8211; The entry to bind</li>
<li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; 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">lxml.etree._Element - The fully bound 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="#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.Plugin.helpers.PrioDir.HandleEvent">
<tt class="descname">HandleEvent</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#PrioDir.HandleEvent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.PrioDir.HandleEvent" title="Permalink to this definition">¶</a></dt>
<dd><p>Handle FAM events.</p>
<p>This method is invoked by the FAM when it detects a change to
a filesystem object we have requsted to be monitored.</p>
<p>This method manages the lifecycle of events related to the
monitored objects, adding them to our list of entries and
creating objects of type <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.PrioDir.__child__" title="Bcfg2.Server.Plugin.helpers.PrioDir.__child__"><tt class="xref py py-attr docutils literal"><span class="pre">__child__</span></tt></a> that actually do
the domain-specific processing. When appropriate, it
propogates events those objects by invoking their HandleEvent
method in turn.</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>) &#8211; FAM event that caused this entry to be added.</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.Plugin.helpers.PrioDir.HandlesEntry">
<tt class="descname">HandlesEntry</tt><big>(</big><em>entry</em>, <em>metadata</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.PrioDir.HandlesEntry" title="Permalink to this definition">¶</a></dt>
<dd><p>HandlesEntry is the slow path method for routing
configuration binding requests.  It is called if the
<tt class="docutils literal"><span class="pre">Entries</span></tt> dict does not contain a method for binding the
entry.</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>entry</strong> (<em>lxml.etree._Element</em>) &#8211; The entry to bind</li>
<li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; 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="#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.Plugin.helpers.PrioDir.add_directory_monitor">
<tt class="descname">add_directory_monitor</tt><big>(</big><em>relative</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.PrioDir.add_directory_monitor" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a new directory to the FAM for monitoring.</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>relative</strong> (<em>string</em>) &#8211; Path name to monitor. This must be relative
to the plugin&#8217;s directory. An empty string
value (&#8220;&#8221;) will cause the plugin directory
itself to be monitored.</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.Plugin.helpers.PrioDir.add_entry">
<tt class="descname">add_entry</tt><big>(</big><em>relative</em>, <em>event</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.PrioDir.add_entry" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a new file to our tracked entries, and to our FAM for
monitoring.</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>relative</strong> (<em>string:</em>) &#8211; Path name to monitor. This must be relative
to the plugin&#8217;s directory.</li>
<li><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>) &#8211; FAM event that caused this entry to be added.</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="method">
<dt id="Bcfg2.Server.Plugin.helpers.PrioDir.debug_log">
<tt class="descname">debug_log</tt><big>(</big><em>message</em>, <em>flag=None</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.PrioDir.debug_log" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a message at the debug level.</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>message</strong> (<em>string</em>) &#8211; The message to log</li>
<li><strong>flag</strong> (<em>bool</em>) &#8211; Override the current debug flag with this value</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="method">
<dt id="Bcfg2.Server.Plugin.helpers.PrioDir.get_attrs">
<tt class="descname">get_attrs</tt><big>(</big><em>entry</em>, <em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#PrioDir.get_attrs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.PrioDir.get_attrs" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a list of attributes to add to the entry during the
bind.  This is a complex method, in that it both modifies the
entry, and returns attributes that need to be added to the
entry.  That seems sub-optimal, and should probably be changed
at some point.  Namely:</p>
<ul class="simple">
<li>The return value includes all XML attributes that need to be
added to the entry, but it does not add them.</li>
<li>If text contents or child tags need to be added to the
entry, they are added to the entry in place.</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>) &#8211; The entry to add attributes to.</li>
<li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; The metadata to get attributes for</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">dict of &lt;attr name&gt;:&lt;attr value&gt;</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="#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="classmethod">
<dt id="Bcfg2.Server.Plugin.helpers.PrioDir.init_repo">
<em class="property">classmethod </em><tt class="descname">init_repo</tt><big>(</big><em>repo</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.PrioDir.init_repo" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform any tasks necessary to create an initial Bcfg2
repository.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>repo</strong> (<em>string</em>) &#8211; The path to the Bcfg2 repository on the filesystem</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.Plugin.helpers.PrioDir.set_debug">
<tt class="descname">set_debug</tt><big>(</big><em>debug</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.PrioDir.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="method">
<dt id="Bcfg2.Server.Plugin.helpers.PrioDir.shutdown">
<tt class="descname">shutdown</tt><big>(</big><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.PrioDir.shutdown" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform shutdown tasks for the plugin</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">None</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.PrioDir.toggle_debug">
<tt class="descname">toggle_debug</tt><big>(</big><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.PrioDir.toggle_debug" title="Permalink to this definition">¶</a></dt>
<dd><p>Turn debugging output on or off.  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>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.helpers.SpecificData">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.helpers.</tt><tt class="descname">SpecificData</tt><big>(</big><em>name</em>, <em>specific</em>, <em>encoding</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#SpecificData"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.SpecificData" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>A file that is specific to certain clients, groups, or all
clients.</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>) &#8211; The full path to the file</li>
<li><strong>specific</strong> (<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.Specificity" title="Bcfg2.Server.Plugin.helpers.Specificity"><em>Bcfg2.Server.Plugin.helpers.Specificity</em></a>) &#8211; A
<a class="reference internal" href="#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>) &#8211; The encoding to use for data in this file</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.SpecificData.handle_event">
<tt class="descname">handle_event</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#SpecificData.handle_event"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.SpecificData.handle_event" title="Permalink to this definition">¶</a></dt>
<dd><p>Handle a FAM event.  Note that the SpecificData object
itself has no FAM, so this must be produced by a parent object
(e.g., <a class="reference internal" href="#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>
<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>) &#8211; The event that applies to this file</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises :</th><td class="field-body"><a class="reference internal" href="#Bcfg2.Server.Plugin.exceptions.PluginExecutionError" title="Bcfg2.Server.Plugin.exceptions.PluginExecutionError"><tt class="xref py py-exc docutils literal"><span class="pre">Bcfg2.Server.Plugin.exceptions.PluginExecutionError</span></tt></a></td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.helpers.Specificity">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.helpers.</tt><tt class="descname">Specificity</tt><big>(</big><em>all=False</em>, <em>group=False</em>, <em>hostname=False</em>, <em>prio=0</em>, <em>delta=False</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#Specificity"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.Specificity" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="compat.html#Bcfg2.Compat.CmpMixin" title="Bcfg2.Compat.CmpMixin"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Compat.CmpMixin</span></tt></a></p>
<p>Represent the specificity of an object; i.e., what client(s)
it applies to.  It can be group- or client-specific, or apply to
all clients.</p>
<p>Specificity objects are sortable; objects that are less specific
are considered less than objects that are more specific.  Objects
that apply to all clients are the least specific; objects that
apply to a single client are the most specific.  Objects that
apply to groups are sorted by priority.</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>all</strong> (<em>bool</em>) &#8211; The object applies to all clients.</li>
<li><strong>group</strong> (<em>string or False</em>) &#8211; The object applies only to the given group.</li>
<li><strong>hostname</strong> (<em>string or False</em>) &#8211; The object applies only to the named client.</li>
<li><strong>prio</strong> (<em>int</em>) &#8211; The object has the given priority relative to
other objects that also apply to the same group.
<tt class="docutils literal"><span class="pre">&lt;group&gt;</span></tt> must be specified with <tt class="docutils literal"><span class="pre">&lt;prio&gt;</span></tt>.</li>
<li><strong>delta</strong> (<em>bool</em>) &#8211; The object is a delta (i.e., a .cat or .diff
file, not a full file).  Deltas are deprecated.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Exactly one of {all|group|hostname} should be given.</p>
<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.Specificity.matches">
<tt class="descname">matches</tt><big>(</big><em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#Specificity.matches"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.Specificity.matches" title="Permalink to this definition">¶</a></dt>
<dd><p>Return True if the object described by this Specificity
object applies to the given client.  That is, if this
Specificity applies to all clients, or to a group the client
is a member of, or to the client individually.</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>) &#8211; The client metadata</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">bool</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.helpers.StructFile">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.helpers.</tt><tt class="descname">StructFile</tt><big>(</big><em>filename</em>, <em>fam=None</em>, <em>should_monitor=False</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#StructFile"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.StructFile" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.XMLFileBacked" title="Bcfg2.Server.Plugin.helpers.XMLFileBacked"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.XMLFileBacked</span></tt></a></p>
<p>StructFiles are XML files that contain a set of structure file
formatting logic for handling <tt class="docutils literal"><span class="pre">&lt;Group&gt;</span></tt> and <tt class="docutils literal"><span class="pre">&lt;Client&gt;</span></tt>
tags.</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>filename</strong> (<em>string</em>) &#8211; The full path to the file to cache and monitor</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>) &#8211; The FAM object used to receive notifications of
changes</li>
<li><strong>should_monitor</strong> (<em>bool</em>) &#8211; Whether or not to monitor this file for
changes. It may be useful to disable
monitoring when, for instance, the file
is monitored by another object (e.g.,
an
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked" title="Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked</span></tt></a>
object).</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.StructFile.__identifier__">
<tt class="descname">__identifier__</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.StructFile.__identifier__" title="Permalink to this definition">¶</a></dt>
<dd><p>If <tt class="docutils literal"><span class="pre">__identifier__</span></tt> is not None, then it must be the name of
an XML attribute that will be required on the top-level tag of
the file being cached</p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.StructFile.HandleEvent">
<tt class="descname">HandleEvent</tt><big>(</big><em>event=None</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.StructFile.HandleEvent" title="Permalink to this definition">¶</a></dt>
<dd><p>HandleEvent is called whenever the FAM registers an event.</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>) &#8211; 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.Plugin.helpers.StructFile.Index">
<tt class="descname">Index</tt><big>(</big><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.StructFile.Index" title="Permalink to this definition">¶</a></dt>
<dd><p>Index() is called by <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.StructFile.HandleEvent" title="Bcfg2.Server.Plugin.helpers.StructFile.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>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.StructFile.Match">
<tt class="descname">Match</tt><big>(</big><em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#StructFile.Match"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.StructFile.Match" title="Permalink to this definition">¶</a></dt>
<dd><p>Return matching fragments of the data in this file.  A tag
is considered to match if all <tt class="docutils literal"><span class="pre">&lt;Group&gt;</span></tt> and <tt class="docutils literal"><span class="pre">&lt;Client&gt;</span></tt>
tags that are its ancestors match the metadata given.  Since
tags are included unmodified, it&#8217;s possible for a tag to
itself match while containing non-matching children.
Consequently, only the tags contained in the list returned by
Match() (and <em>not</em> their descendents) should be considered to
match the 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>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; Client metadata to match against.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of lxml.etree._Element objects</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.StructFile.XMLMatch">
<tt class="descname">XMLMatch</tt><big>(</big><em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#StructFile.XMLMatch"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.StructFile.XMLMatch" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a rebuilt XML document that only contains the
matching portions of the original file.  A tag is considered
to match if all <tt class="docutils literal"><span class="pre">&lt;Group&gt;</span></tt> and <tt class="docutils literal"><span class="pre">&lt;Client&gt;</span></tt> tags that are its
ancestors match the metadata given.  Unlike <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.StructFile.Match" title="Bcfg2.Server.Plugin.helpers.StructFile.Match"><tt class="xref py py-func docutils literal"><span class="pre">Match()</span></tt></a>, the
document returned by XMLMatch will only contain matching data.
All <tt class="docutils literal"><span class="pre">&lt;Group&gt;</span></tt> and <tt class="docutils literal"><span class="pre">&lt;Client&gt;</span></tt> tags will have been stripped
out.</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>) &#8211; Client metadata to match against.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">lxml.etree._Element</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.StructFile.add_monitor">
<tt class="descname">add_monitor</tt><big>(</big><em>fpath</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.StructFile.add_monitor" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a FAM monitor to a file that has been XIncluded.  This
is only done if the constructor got both a <tt class="docutils literal"><span class="pre">fam</span></tt> object and
<tt class="docutils literal"><span class="pre">should_monitor</span></tt> set to 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>fpath</strong> (<em>string</em>) &#8211; The full path to the file to monitor</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.helpers.</tt><tt class="descname">XMLDirectoryBacked</tt><big>(</big><em>data</em>, <em>fam</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#XMLDirectoryBacked"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.DirectoryBacked" title="Bcfg2.Server.Plugin.helpers.DirectoryBacked"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.DirectoryBacked</span></tt></a></p>
<p><a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.DirectoryBacked" title="Bcfg2.Server.Plugin.helpers.DirectoryBacked"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.DirectoryBacked</span></tt></a> for XML 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"><ul class="first last simple">
<li><strong>data</strong> (<em>string</em>) &#8211; The path to the data directory that will be
monitored</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>) &#8211; The FAM object used to receive notifications of
changes</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked.__child__">
<tt class="descname">__child__</tt><em class="property"> = &lt;class 'Bcfg2.Server.Plugin.helpers.XMLFileBacked'&gt;</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked.__child__" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of child objects to create for files contained within
the directory that is tracked.  Default is
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.XMLFileBacked" title="Bcfg2.Server.Plugin.helpers.XMLFileBacked"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.XMLFileBacked</span></tt></a></p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked.HandleEvent">
<tt class="descname">HandleEvent</tt><big>(</big><em>event</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked.HandleEvent" title="Permalink to this definition">¶</a></dt>
<dd><p>Handle FAM events.</p>
<p>This method is invoked by the FAM when it detects a change to
a filesystem object we have requsted to be monitored.</p>
<p>This method manages the lifecycle of events related to the
monitored objects, adding them to our list of entries and
creating objects of type <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked.__child__" title="Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked.__child__"><tt class="xref py py-attr docutils literal"><span class="pre">__child__</span></tt></a> that actually do
the domain-specific processing. When appropriate, it
propogates events those objects by invoking their HandleEvent
method in turn.</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>) &#8211; FAM event that caused this entry to be added.</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.Plugin.helpers.XMLDirectoryBacked.add_directory_monitor">
<tt class="descname">add_directory_monitor</tt><big>(</big><em>relative</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked.add_directory_monitor" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a new directory to the FAM for monitoring.</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>relative</strong> (<em>string</em>) &#8211; Path name to monitor. This must be relative
to the plugin&#8217;s directory. An empty string
value (&#8220;&#8221;) will cause the plugin directory
itself to be monitored.</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.Plugin.helpers.XMLDirectoryBacked.add_entry">
<tt class="descname">add_entry</tt><big>(</big><em>relative</em>, <em>event</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked.add_entry" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a new file to our tracked entries, and to our FAM for
monitoring.</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>relative</strong> (<em>string:</em>) &#8211; Path name to monitor. This must be relative
to the plugin&#8217;s directory.</li>
<li><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>) &#8211; FAM event that caused this entry to be added.</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.Plugin.helpers.XMLDirectoryBacked.patterns">
<tt class="descname">patterns</tt><em class="property"> = &lt;_sre.SRE_Pattern object at 0x9a9e020&gt;</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked.patterns" title="Permalink to this definition">¶</a></dt>
<dd><p>Only track and include files whose names (not paths) match this
compiled regex.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.helpers.XMLFileBacked">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.helpers.</tt><tt class="descname">XMLFileBacked</tt><big>(</big><em>filename</em>, <em>fam=None</em>, <em>should_monitor=False</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#XMLFileBacked"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLFileBacked" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.FileBacked" title="Bcfg2.Server.Plugin.helpers.FileBacked"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.FileBacked</span></tt></a></p>
<p>This object parses and caches XML file data in memory.  It can
be used as a standalone object or as a part of
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked" title="Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked</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>filename</strong> (<em>string</em>) &#8211; The full path to the file to cache and monitor</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>) &#8211; The FAM object used to receive notifications of
changes</li>
<li><strong>should_monitor</strong> (<em>bool</em>) &#8211; Whether or not to monitor this file for
changes. It may be useful to disable
monitoring when, for instance, the file
is monitored by another object (e.g.,
an
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked" title="Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.XMLDirectoryBacked</span></tt></a>
object).</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.XMLFileBacked.__identifier__">
<tt class="descname">__identifier__</tt><em class="property"> = 'name'</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLFileBacked.__identifier__" title="Permalink to this definition">¶</a></dt>
<dd><p>If <tt class="docutils literal"><span class="pre">__identifier__</span></tt> is set, then a top-level tag with the
specified name will be required on the file being cached.  Its
value will be available as <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.XMLFileBacked.label" title="Bcfg2.Server.Plugin.helpers.XMLFileBacked.label"><tt class="xref py py-attr docutils literal"><span class="pre">label</span></tt></a>.  To disable this
behavior, set <tt class="docutils literal"><span class="pre">__identifier__</span></tt> to <tt class="docutils literal"><span class="pre">None</span></tt>.</p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.XMLFileBacked.HandleEvent">
<tt class="descname">HandleEvent</tt><big>(</big><em>event=None</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLFileBacked.HandleEvent" title="Permalink to this definition">¶</a></dt>
<dd><p>HandleEvent is called whenever the FAM registers an event.</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>) &#8211; 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.Plugin.helpers.XMLFileBacked.Index">
<tt class="descname">Index</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#XMLFileBacked.Index"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLFileBacked.Index" title="Permalink to this definition">¶</a></dt>
<dd><p>Index() is called by <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.XMLFileBacked.HandleEvent" title="Bcfg2.Server.Plugin.helpers.XMLFileBacked.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>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.XMLFileBacked.add_monitor">
<tt class="descname">add_monitor</tt><big>(</big><em>fpath</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#XMLFileBacked.add_monitor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLFileBacked.add_monitor" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a FAM monitor to a file that has been XIncluded.  This
is only done if the constructor got both a <tt class="docutils literal"><span class="pre">fam</span></tt> object and
<tt class="docutils literal"><span class="pre">should_monitor</span></tt> set to 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>fpath</strong> (<em>string</em>) &#8211; The full path to the file to monitor</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="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.XMLFileBacked.entries">
<tt class="descname">entries</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLFileBacked.entries" title="Permalink to this definition">¶</a></dt>
<dd><p>All entries in this file.  By default, all immediate
children of the top-level XML tag.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.XMLFileBacked.extras">
<tt class="descname">extras</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLFileBacked.extras" title="Permalink to this definition">¶</a></dt>
<dd><p>&#8220;Extra&#8221; files included in this file by XInclude.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.XMLFileBacked.label">
<tt class="descname">label</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLFileBacked.label" title="Permalink to this definition">¶</a></dt>
<dd><p>The label of this file.  This is determined from the
top-level tag in the file, which must have an attribute
specified by <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.XMLFileBacked.__identifier__" title="Bcfg2.Server.Plugin.helpers.XMLFileBacked.__identifier__"><tt class="xref py py-attr docutils literal"><span class="pre">__identifier__</span></tt></a>.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.XMLFileBacked.should_monitor">
<tt class="descname">should_monitor</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLFileBacked.should_monitor" title="Permalink to this definition">¶</a></dt>
<dd><p>Whether or not to monitor this file for changes.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.XMLFileBacked.xdata">
<tt class="descname">xdata</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLFileBacked.xdata" title="Permalink to this definition">¶</a></dt>
<dd><p>The raw XML data contained in the file as an
<tt class="xref py py-class docutils literal"><span class="pre">lxml.etree.ElementTree</span></tt> object, with XIncludes
processed.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.helpers.XMLSrc">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.helpers.</tt><tt class="descname">XMLSrc</tt><big>(</big><em>filename</em>, <em>fam=None</em>, <em>should_monitor=False</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#XMLSrc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLSrc" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.XMLFileBacked" title="Bcfg2.Server.Plugin.helpers.XMLFileBacked"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.XMLFileBacked</span></tt></a></p>
<p>XMLSrc files contain a
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.INode" title="Bcfg2.Server.Plugin.helpers.INode"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.INode</span></tt></a> hierarchy that returns
matching entries. XMLSrc objects are deprecated and
<a class="reference internal" href="#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> should be
preferred where possible.</p>
<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.XMLSrc.Cache">
<tt class="descname">Cache</tt><big>(</big><em>metadata</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#XMLSrc.Cache"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLSrc.Cache" title="Permalink to this definition">¶</a></dt>
<dd><p>Build a package dict for a given host.</p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.XMLSrc.HandleEvent">
<tt class="descname">HandleEvent</tt><big>(</big><em>_=None</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#XMLSrc.HandleEvent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLSrc.HandleEvent" title="Permalink to this definition">¶</a></dt>
<dd><p>Read file upon update.</p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.XMLSrc.Index">
<tt class="descname">Index</tt><big>(</big><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLSrc.Index" title="Permalink to this definition">¶</a></dt>
<dd><p>Index() is called by <a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.XMLSrc.HandleEvent" title="Bcfg2.Server.Plugin.helpers.XMLSrc.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>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Server.Plugin.helpers.XMLSrc.add_monitor">
<tt class="descname">add_monitor</tt><big>(</big><em>fpath</em><big>)</big><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.XMLSrc.add_monitor" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a FAM monitor to a file that has been XIncluded.  This
is only done if the constructor got both a <tt class="docutils literal"><span class="pre">fam</span></tt> object and
<tt class="docutils literal"><span class="pre">should_monitor</span></tt> set to 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>fpath</strong> (<em>string</em>) &#8211; The full path to the file to monitor</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="Bcfg2.Server.Plugin.helpers.bind_info">
<tt class="descclassname">Bcfg2.Server.Plugin.helpers.</tt><tt class="descname">bind_info</tt><big>(</big><em>entry</em>, <em>metadata</em>, <em>infoxml=None</em>, <em>default={'group': 'root'</em>, <em>'paranoid': 'true'</em>, <em>'sensitive': 'false'</em>, <em>'important': 'False'</em>, <em>'secontext': '__default__'</em>, <em>'mode': '644'</em>, <em>'owner': 'root'}</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#bind_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.bind_info" title="Permalink to this definition">¶</a></dt>
<dd><p>Bind the file metadata in the given
<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.InfoXML" title="Bcfg2.Server.Plugin.helpers.InfoXML"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.helpers.InfoXML</span></tt></a> object to the given
entry.</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>entry</strong> (<em>lxml.etree._Element</em>) &#8211; The abstract entry to bind the info to</li>
<li><strong>metadata</strong> (<em>Bcfg2.Server.Plugins.Metadata.ClientMetadata</em>) &#8211; The client metadata to get info for</li>
<li><strong>infoxml</strong> (<a class="reference internal" href="#Bcfg2.Server.Plugin.helpers.InfoXML" title="Bcfg2.Server.Plugin.helpers.InfoXML"><em>Bcfg2.Server.Plugin.helpers.InfoXML</em></a>) &#8211; The info.xml file to pull file metadata from</li>
<li><strong>default</strong> (<em>dict</em>) &#8211; Default metadata to supply when the info.xml file
does not include a particular attribute</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">None</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="#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="class">
<dt id="Bcfg2.Server.Plugin.helpers.track_statistics">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.helpers.</tt><tt class="descname">track_statistics</tt><big>(</big><em>name=None</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/helpers.html#track_statistics"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.track_statistics" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>Decorator that tracks execution time for the given
<tt class="xref py py-class docutils literal"><span class="pre">Plugin</span></tt> method with <a class="reference internal" href="#module-Bcfg2.Statistics" title="Bcfg2.Statistics"><tt class="xref py py-mod docutils literal"><span class="pre">Bcfg2.Statistics</span></tt></a> for reporting
via <tt class="docutils literal"><span class="pre">bcfg2-admin</span> <span class="pre">perf</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>name</strong> (<em>string</em>) &#8211; The name under which statistics for this function
will be tracked.  By default, the name will be
the name of the function concatenated with the
name of the class the function is a member of.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="class">
<dt id="Bcfg2.Server.Plugin.base.Debuggable">
<em class="property">class </em><tt class="descclassname">Bcfg2.Server.Plugin.base.</tt><tt class="descname">Debuggable</tt><big>(</big><em>name=None</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/base.html#Debuggable"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.base.Debuggable" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>Mixin to add a debugging interface to an object and expose it
via XML-RPC on <a class="reference internal" href="#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> objects</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>name</strong> (<em>string</em>) &#8211; The name of the logger object to get.  If none is
supplied, the full name of the class (including
module) will be used.</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="Bcfg2.Server.Plugin.helpers.Debuggable.__rmi__">
<tt class="descname">__rmi__</tt><em class="property"> = ['toggle_debug', 'set_debug']</em><a class="headerlink" href="#Bcfg2.Server.Plugin.helpers.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.Plugin.base.Debuggable.debug_log">
<tt class="descname">debug_log</tt><big>(</big><em>message</em>, <em>flag=None</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/base.html#Debuggable.debug_log"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.base.Debuggable.debug_log" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a message at the debug level.</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>message</strong> (<em>string</em>) &#8211; The message to log</li>
<li><strong>flag</strong> (<em>bool</em>) &#8211; Override the current debug flag with this value</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="method">
<dt id="Bcfg2.Server.Plugin.base.Debuggable.set_debug">
<tt class="descname">set_debug</tt><big>(</big><em>debug</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/base.html#Debuggable.set_debug"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.base.Debuggable.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="method">
<dt id="Bcfg2.Server.Plugin.base.Debuggable.toggle_debug">
<tt class="descname">toggle_debug</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/base.html#Debuggable.toggle_debug"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.base.Debuggable.toggle_debug" title="Permalink to this definition">¶</a></dt>
<dd><p>Turn debugging output on or off.  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>

</dd></dl>

</div>
<div class="section" id="module-Bcfg2.Server.Plugin.exceptions">
<span id="plugin-exceptions"></span><h2>Plugin Exceptions<a class="headerlink" href="#module-Bcfg2.Server.Plugin.exceptions" title="Permalink to this headline">¶</a></h2>
<p>Exceptions for Bcfg2 Server Plugins.</p>
<dl class="exception">
<dt id="Bcfg2.Server.Plugin.exceptions.MetadataConsistencyError">
<em class="property">exception </em><tt class="descclassname">Bcfg2.Server.Plugin.exceptions.</tt><tt class="descname">MetadataConsistencyError</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/exceptions.html#MetadataConsistencyError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.exceptions.MetadataConsistencyError" 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>This error gets raised when metadata is internally
inconsistent.</p>
</dd></dl>

<dl class="exception">
<dt id="Bcfg2.Server.Plugin.exceptions.MetadataRuntimeError">
<em class="property">exception </em><tt class="descclassname">Bcfg2.Server.Plugin.exceptions.</tt><tt class="descname">MetadataRuntimeError</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/exceptions.html#MetadataRuntimeError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.exceptions.MetadataRuntimeError" 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>This error is raised when the metadata engine is called prior
to reading enough data, or for other
<a class="reference internal" href="#Bcfg2.Server.Plugin.interfaces.Metadata" title="Bcfg2.Server.Plugin.interfaces.Metadata"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.interfaces.Metadata</span></tt></a> errors.</p>
</dd></dl>

<dl class="exception">
<dt id="Bcfg2.Server.Plugin.exceptions.PluginExecutionError">
<em class="property">exception </em><tt class="descclassname">Bcfg2.Server.Plugin.exceptions.</tt><tt class="descname">PluginExecutionError</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/exceptions.html#PluginExecutionError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.exceptions.PluginExecutionError" 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>Error raised in case of
<a class="reference internal" href="#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> execution errors.</p>
</dd></dl>

<dl class="exception">
<dt id="Bcfg2.Server.Plugin.exceptions.PluginInitError">
<em class="property">exception </em><tt class="descclassname">Bcfg2.Server.Plugin.exceptions.</tt><tt class="descname">PluginInitError</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/exceptions.html#PluginInitError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.exceptions.PluginInitError" 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>Error raised in cases of
<a class="reference internal" href="#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> initialization errors.</p>
</dd></dl>

<dl class="exception">
<dt id="Bcfg2.Server.Plugin.exceptions.SpecificityError">
<em class="property">exception </em><tt class="descclassname">Bcfg2.Server.Plugin.exceptions.</tt><tt class="descname">SpecificityError</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/exceptions.html#SpecificityError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.exceptions.SpecificityError" 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>Thrown by <a class="reference internal" href="#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> in
case of filename parse failure.</p>
</dd></dl>

<dl class="exception">
<dt id="Bcfg2.Server.Plugin.exceptions.ValidationError">
<em class="property">exception </em><tt class="descclassname">Bcfg2.Server.Plugin.exceptions.</tt><tt class="descname">ValidationError</tt><a class="reference internal" href="../_modules/Bcfg2/Server/Plugin/exceptions.html#ValidationError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Server.Plugin.exceptions.ValidationError" 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>Exception raised by
<a class="reference internal" href="#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> and
<a class="reference internal" href="#Bcfg2.Server.Plugin.interfaces.GoalValidator" title="Bcfg2.Server.Plugin.interfaces.GoalValidator"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Server.Plugin.interfaces.GoalValidator</span></tt></a> objects</p>
</dd></dl>

</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="#">Bcfg2 Plugin development</a><ul>
<li><a class="reference internal" href="#bcfg2-plugins">Bcfg2 Plugins</a></li>
<li><a class="reference internal" href="#server-plugin-types">Server Plugin Types</a><ul>
<li><a class="reference internal" href="#plugin">Plugin</a></li>
<li><a class="reference internal" href="#interfaces">Interfaces</a></li>
</ul>
</li>
<li><a class="reference internal" href="#exposing-xml-rpc-functions">Exposing XML-RPC Functions</a></li>
<li><a class="reference internal" href="#invalidating-caches">Invalidating Caches</a></li>
<li><a class="reference internal" href="#tracking-execution-time">Tracking Execution Time</a><ul>
<li><a class="reference internal" href="#module-Bcfg2.Statistics">Bcfg2.Statistics</a></li>
</ul>
</li>
<li><a class="reference internal" href="#module-Bcfg2.Server.Plugin.helpers">Plugin Helper Classes</a></li>
<li><a class="reference internal" href="#module-Bcfg2.Server.Plugin.exceptions">Plugin Exceptions</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="packages.html"
                        title="previous chapter">Developing for Packages</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="cfg.html"
                        title="next chapter">Cfg Handler Development</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/development/plugins.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="cfg.html" title="Cfg Handler Development"
             >next</a> |</li>
        <li class="right" >
          <a href="packages.html" title="Developing for Packages"
             >previous</a> |</li>
	<li><a href="../index.html">home</a> |&nbsp;</li>
	<!--<li><a href="../search.html">search</a> |&nbsp;</li>-->
	<li><a href="../help/index.html">help</a> |&nbsp;</li>
	<li><a href="../contents.html">documentation </a> &raquo;</li>

          <li><a href="../contents.html" >Bcfg2 documentation 1.3.0</a> &raquo;</li>
          <li><a href="index.html" >Bcfg2 Development</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; 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>