Sophie

Sophie

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

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>Writing A Client Tool Driver &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="Python Compatibility" href="compat.html" />
    <link rel="prev" title="Cfg Handler Development" href="cfg.html" />
 
<link rel="stylesheet" href="../_static/bcfg2.css" type=""/>

  </head>
  <body>

<div style="text-align: left; padding: 10px 10px 15px 15px">
<a href="../index.html"><img src="../_static/bcfg2_logo.png" border="0" alt="sampledoc"/></a>
</div>

    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="compat.html" title="Python Compatibility"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="cfg.html" title="Cfg Handler Development"
             accesskey="P">previous</a> |</li>
	<li><a href="../index.html">home</a> |&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="writing-a-client-tool-driver">
<span id="development-client-driver"></span><h1>Writing A Client Tool Driver<a class="headerlink" href="#writing-a-client-tool-driver" title="Permalink to this headline">¶</a></h1>
<p>This page describes the step-by-step process of writing a client tool
driver for a configuration element type. The included example describes
an existing driver, and the process that was used to create it.</p>
<ol class="arabic">
<li><p class="first">Pick a name for the driver. In this case, we picked the name RPM.</p>
</li>
<li><p class="first">Create a file in <tt class="docutils literal"><span class="pre">src/lib/Bcfg2/Client/Tools</span></tt> with the same name
(RPM.py)</p>
</li>
<li><p class="first">Create a class in this file with the same name (<tt class="docutils literal"><span class="pre">class</span> <span class="pre">RPM</span></tt>)</p>
<ul class="simple">
<li>If it handles <strong>Package</strong> entries, subclass
<a class="reference internal" href="#Bcfg2.Client.Tools.PkgTool" title="Bcfg2.Client.Tools.PkgTool"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Client.Tools.PkgTool</span></tt></a></li>
<li>If it handles <strong>Service</strong> entries, subclass
<a class="reference internal" href="#Bcfg2.Client.Tools.SvcTool" title="Bcfg2.Client.Tools.SvcTool"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Client.Tools.SvcTool</span></tt></a></li>
<li>Otherwise, subclass <a class="reference internal" href="#Bcfg2.Client.Tools.Tool" title="Bcfg2.Client.Tools.Tool"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool</span></tt></a>.</li>
</ul>
</li>
<li><p class="first">Add any required executable programs to
<a class="reference internal" href="#Bcfg2.Client.Tools.Tool.__execs__" title="Bcfg2.Client.Tools.Tool.__execs__"><tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool.__execs__</span></tt></a></p>
</li>
<li><p class="first">Set <a class="reference internal" href="#Bcfg2.Client.Tools.Tool.__handles__" title="Bcfg2.Client.Tools.Tool.__handles__"><tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool.__handles__</span></tt></a> to a list of
<tt class="docutils literal"><span class="pre">(&lt;tag&gt;,</span> <span class="pre">&lt;type&gt;)</span></tt> tuples. This determines which entries the Tool
module can be used on. In this case, we set <tt class="docutils literal"><span class="pre">__handles__</span> <span class="pre">=</span>
<span class="pre">[('Package',</span> <span class="pre">'rpm')]</span></tt>.</p>
</li>
<li><p class="first">Add verification support by defining a method named
<tt class="docutils literal"><span class="pre">Verify&lt;tag&gt;</span></tt>. See <a class="reference internal" href="#Bcfg2.Client.Tools.Tool.Inventory" title="Bcfg2.Client.Tools.Tool.Inventory"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool.Inventory()</span></tt></a> for
details. This method should return True/False depending on current
entry installation status. In the failure path, the current state
of failing entry attributes should be set in the entry, to aid in
auditing.  (For example, if a file should be mode 644, and is
currently mode 600, then set attribute current_mode=&#8216;600&#8217; in the
input entry)</p>
</li>
<li><p class="first">Add installation support by defining a method named
<tt class="docutils literal"><span class="pre">Install&lt;tag</span></tt>.  See <a class="reference internal" href="#Bcfg2.Client.Tools.Tool.Install" title="Bcfg2.Client.Tools.Tool.Install"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool.Install()</span></tt></a> for
details. This method should return True/False depending on the
results of the installation process.</p>
<p>If you are writing a tool to handle Package entries, PkgTool class
has a generic mechanism for performing all-at-once installations,
followed, in the case of failures, by single installations. See
<a class="reference internal" href="#Bcfg2.Client.Tools.PkgTool.Install" title="Bcfg2.Client.Tools.PkgTool.Install"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Client.Tools.PkgTool.Install()</span></tt></a> for details.</p>
</li>
<li><p class="first">Optionally, add support for removing extra entries by defining a
<a class="reference internal" href="#Bcfg2.Client.Tools.Tool.Remove" title="Bcfg2.Client.Tools.Tool.Remove"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool.Remove()</span></tt></a> method.</p>
</li>
<li><p class="first">Optionally, add a <a class="reference internal" href="#Bcfg2.Client.Tools.Tool.FindExtra" title="Bcfg2.Client.Tools.Tool.FindExtra"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool.FindExtra()</span></tt></a> method
that locates entries not included in the configuration.</p>
</li>
<li><p class="first">Package drivers require a
<a class="reference internal" href="#Bcfg2.Client.Tools.PkgTool.RefreshPackages" title="Bcfg2.Client.Tools.PkgTool.RefreshPackages"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Client.Tools.PkgTool.RefreshPackages()</span></tt></a> method that
updates the internal representation of the package database.</p>
</li>
</ol>
<div class="section" id="client-tool-api">
<h2>Client Tool API<a class="headerlink" href="#client-tool-api" title="Permalink to this headline">¶</a></h2>
<div class="section" id="base-classes">
<h3>Base Classes<a class="headerlink" href="#base-classes" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="Bcfg2.Client.Tools.Tool">
<em class="property">class </em><tt class="descclassname">Bcfg2.Client.Tools.</tt><tt class="descname">Tool</tt><big>(</big><em>logger</em>, <em>setup</em>, <em>config</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#Tool"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.Tool" 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>The base tool class.  All tools subclass this.</p>
<dl class="attribute">
<dt id="Bcfg2.Client.Tools.Tool.__execs__">
<tt class="descname">__execs__</tt><em class="property"> = []</em><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.__execs__" title="Permalink to this definition">¶</a></dt>
<dd><p>Full paths to all executables the tool uses.  When the tool is
instantiated it will check to ensure that all of these files
exist and are executable.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Client.Tools.Tool.__handles__">
<tt class="descname">__handles__</tt><em class="property"> = []</em><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.__handles__" title="Permalink to this definition">¶</a></dt>
<dd><p>A list of 2-tuples of entries handled by this tool.  Each
2-tuple should contain <tt class="docutils literal"><span class="pre">(&lt;tag&gt;,</span> <span class="pre">&lt;type&gt;)</span></tt>, where <tt class="docutils literal"><span class="pre">&lt;type&gt;</span></tt> is
the <tt class="docutils literal"><span class="pre">type</span></tt> attribute of the entry.  If this tool handles
entries with no <tt class="docutils literal"><span class="pre">type</span></tt> attribute, specify None.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Client.Tools.Tool.__req__">
<tt class="descname">__req__</tt><em class="property"> = {}</em><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.__req__" title="Permalink to this definition">¶</a></dt>
<dd><p>A dict that describes the required attributes for entries
handled by this tool.  The keys are the names of tags.  The
values may either be lists of attribute names (if the same
attributes are required by all tags of that name), or dicts
whose keys are the <tt class="docutils literal"><span class="pre">type</span></tt> attribute and whose values are
lists of attributes required by tags with that <tt class="docutils literal"><span class="pre">type</span></tt>
attribute.  In that case, the <tt class="docutils literal"><span class="pre">type</span></tt> attribute will also be
required.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Client.Tools.Tool.__important__">
<tt class="descname">__important__</tt><em class="property"> = []</em><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.__important__" title="Permalink to this definition">¶</a></dt>
<dd><p>A list of entry names that will be treated as important and
installed before other entries.</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>logger</strong> (<em>logging.Logger</em>) &#8211; Logger that will be used for logging by this tool</li>
<li><strong>setup</strong> (<em>Bcfg2.Options.OptionParser</em>) &#8211; The option set Bcfg2 was invoked with</li>
<li><strong>config</strong> (<em>lxml.etree._Element</em>) &#8211; The XML configuration for this client</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.Client.Tools.ToolInstantiationError" title="Bcfg2.Client.Tools.ToolInstantiationError"><tt class="xref py py-exc docutils literal"><span class="pre">Bcfg2.Client.Tools.ToolInstantiationError</span></tt></a></p>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="Bcfg2.Client.Tools.Tool.BundleNotUpdated">
<tt class="descname">BundleNotUpdated</tt><big>(</big><em>bundle</em>, <em>states</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#Tool.BundleNotUpdated"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.BundleNotUpdated" title="Permalink to this definition">¶</a></dt>
<dd><p>Callback that is invoked when a bundle has been updated.</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>bundle</strong> (<em>lxml.etree._Element</em>) &#8211; The bundle that has been updated</li>
<li><strong>states</strong> (<em>dict</em>) &#8211; The <tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Client.Frame.Frame.states</span></tt> dict</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.Client.Tools.Tool.BundleUpdated">
<tt class="descname">BundleUpdated</tt><big>(</big><em>bundle</em>, <em>states</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#Tool.BundleUpdated"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.BundleUpdated" title="Permalink to this definition">¶</a></dt>
<dd><p>Callback that is invoked when a bundle has been updated.</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>bundle</strong> (<em>lxml.etree._Element</em>) &#8211; The bundle that has been updated</li>
<li><strong>states</strong> (<em>dict</em>) &#8211; The <tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Client.Frame.Frame.states</span></tt> dict</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.Client.Tools.Tool.FindExtra">
<tt class="descname">FindExtra</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#Tool.FindExtra"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.FindExtra" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of extra entries, i.e., entries that exist
on the client but are not in the configuration.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">list of lxml.etree._Element</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Client.Tools.Tool.Install">
<tt class="descname">Install</tt><big>(</big><em>entries</em>, <em>states</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#Tool.Install"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.Install" title="Permalink to this definition">¶</a></dt>
<dd><p>Install entries.  &#8216;Install&#8217; in this sense means either
initially install, or update as necessary to match the
specification.</p>
<p>This implementation of <a class="reference internal" href="#Bcfg2.Client.Tools.Tool.Install" title="Bcfg2.Client.Tools.Tool.Install"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool.Install()</span></tt></a>
calls a <tt class="docutils literal"><span class="pre">Install&lt;tag&gt;</span></tt> method to install each entry, where
<tt class="docutils literal"><span class="pre">&lt;tag&gt;</span></tt> is the entry tag.  E.g., a Path entry would be
installed by calling <tt class="xref py py-func docutils literal"><span class="pre">InstallPath()</span></tt>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>entries</strong> (<em>list of lxml.etree._Element</em>) &#8211; The entries to install</li>
<li><strong>states</strong> (<em>dict</em>) &#8211; The <tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Client.Frame.Frame.states</span></tt> dict</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.Client.Tools.Tool.Inventory">
<tt class="descname">Inventory</tt><big>(</big><em>states</em>, <em>structures=None</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#Tool.Inventory"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.Inventory" title="Permalink to this definition">¶</a></dt>
<dd><p>Take an inventory of the system as it exists.  This
involves two steps:</p>
<ul class="simple">
<li>Call the appropriate entry-specific Verify method for each
entry this tool verifies;</li>
<li>Call <a class="reference internal" href="#Bcfg2.Client.Tools.Tool.FindExtra" title="Bcfg2.Client.Tools.Tool.FindExtra"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool.FindExtra()</span></tt></a> to populate
<a class="reference internal" href="#Bcfg2.Client.Tools.Tool.extra" title="Bcfg2.Client.Tools.Tool.extra"><tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool.extra</span></tt></a> with extra entries.</li>
</ul>
<p>This implementation of
<a class="reference internal" href="#Bcfg2.Client.Tools.Tool.Inventory" title="Bcfg2.Client.Tools.Tool.Inventory"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool.Inventory()</span></tt></a> calls a
<tt class="docutils literal"><span class="pre">Verify&lt;tag&gt;</span></tt> method to verify each entry, where <tt class="docutils literal"><span class="pre">&lt;tag&gt;</span></tt>
is the entry tag.  E.g., a Path entry would be verified by
calling <tt class="xref py py-func docutils literal"><span class="pre">VerifyPath()</span></tt>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>states</strong> (<em>dict</em>) &#8211; The <tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Client.Frame.Frame.states</span></tt> dict</li>
<li><strong>structures</strong> (<em>list of lxml.etree._Element</em>) &#8211; The list of structures (i.e., bundles) to
get entries from.  If this is not given,
all children of
<a class="reference internal" href="#Bcfg2.Client.Tools.Tool.config" title="Bcfg2.Client.Tools.Tool.config"><tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool.config</span></tt></a> will
be used.</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.Client.Tools.Tool.Remove">
<tt class="descname">Remove</tt><big>(</big><em>entries</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#Tool.Remove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.Remove" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove specified extra 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"><strong>entries</strong> (<em>list of lxml.etree._Element</em>) &#8211; The entries to remove</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.Client.Tools.Tool._entry_is_complete">
<tt class="descname">_entry_is_complete</tt><big>(</big><em>entry</em>, <em>action=None</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#Tool._entry_is_complete"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.Tool._entry_is_complete" title="Permalink to this definition">¶</a></dt>
<dd><p>Test if the entry is complete.  This involves three
things:</p>
<ul class="simple">
<li>The entry is handled by this tool (as reported by
<a class="reference internal" href="#Bcfg2.Client.Tools.Tool.handlesEntry" title="Bcfg2.Client.Tools.Tool.handlesEntry"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool.handlesEntry()</span></tt></a>;</li>
<li>The entry does not report a bind failure;</li>
<li>The entry is not missing any attributes (as reported by
<a class="reference internal" href="#Bcfg2.Client.Tools.Tool.missing_attrs" title="Bcfg2.Client.Tools.Tool.missing_attrs"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool.missing_attrs()</span></tt></a>).</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>entry</strong> (<em>lxml.etree._Element</em>) &#8211; The entry to evaluate</li>
<li><strong>action</strong> (<em>string</em>) &#8211; The action being performed on the entry (e.g.,
&#8220;install&#8221;, &#8220;verify&#8221;).  This is used to produce
error messages; if not provided, generic error
messages will be used.</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 entry can be verified, False
otherwise.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Client.Tools.Tool.buildModlist">
<tt class="descname">buildModlist</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#Tool.buildModlist"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.buildModlist" title="Permalink to this definition">¶</a></dt>
<dd><p>Build a list of all Path entries in the configuration.
(This can be used to determine which paths might be modified
from their original state, useful for verifying packages)</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">list of lxml.etree._Element</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Client.Tools.Tool.canInstall">
<tt class="descname">canInstall</tt><big>(</big><em>entry</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#Tool.canInstall"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.canInstall" title="Permalink to this definition">¶</a></dt>
<dd><p>Test if entry can be installed by calling
<a class="reference internal" href="#Bcfg2.Client.Tools.Tool._entry_is_complete" title="Bcfg2.Client.Tools.Tool._entry_is_complete"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool._entry_is_complete()</span></tt></a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>entry</strong> (<em>lxml.etree._Element</em>) &#8211; The entry to evaluate</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">bool - True if the entry can be installed, False
otherwise.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Client.Tools.Tool.canVerify">
<tt class="descname">canVerify</tt><big>(</big><em>entry</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#Tool.canVerify"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.canVerify" title="Permalink to this definition">¶</a></dt>
<dd><p>Test if entry can be verified by calling
<a class="reference internal" href="#Bcfg2.Client.Tools.Tool._entry_is_complete" title="Bcfg2.Client.Tools.Tool._entry_is_complete"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool._entry_is_complete()</span></tt></a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>entry</strong> (<em>lxml.etree._Element</em>) &#8211; The entry to evaluate</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">bool - True if the entry can be verified, False
otherwise.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Client.Tools.Tool.cmd">
<tt class="descname">cmd</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.cmd" title="Permalink to this definition">¶</a></dt>
<dd><p>An <a class="reference internal" href="#Bcfg2.Client.Tools.Executor" title="Bcfg2.Client.Tools.Executor"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Client.Tools.Executor</span></tt></a> object for
running external commands.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Client.Tools.Tool.config">
<tt class="descname">config</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.config" title="Permalink to this definition">¶</a></dt>
<dd><p>The XML configuration for this client</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Client.Tools.Tool.conflicts">
<tt class="descname">conflicts</tt><em class="property"> = []</em><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.conflicts" title="Permalink to this definition">¶</a></dt>
<dd><p>List of other tools (by name) that this tool conflicts with.
If any of the listed tools are loaded, they will be removed at
runtime with a warning.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Client.Tools.Tool.deprecated">
<tt class="descname">deprecated</tt><em class="property"> = False</em><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.deprecated" title="Permalink to this definition">¶</a></dt>
<dd><p>This tool is deprecated, and a warning will be produced if it
is used.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Client.Tools.Tool.experimental">
<tt class="descname">experimental</tt><em class="property"> = False</em><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.experimental" title="Permalink to this definition">¶</a></dt>
<dd><p>This tool is experimental, and a warning will be produced if it
is used.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Client.Tools.Tool.extra">
<tt class="descname">extra</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.extra" title="Permalink to this definition">¶</a></dt>
<dd><p>A list of extra entries that are not listed in the
configuration</p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Client.Tools.Tool.getSupportedEntries">
<tt class="descname">getSupportedEntries</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#Tool.getSupportedEntries"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.getSupportedEntries" title="Permalink to this definition">¶</a></dt>
<dd><p>Get all entries that are handled by this tool.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">list of lxml.etree._Element</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Client.Tools.Tool.handled">
<tt class="descname">handled</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.handled" title="Permalink to this definition">¶</a></dt>
<dd><p>A list of all entries handled by this tool</p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Client.Tools.Tool.handlesEntry">
<tt class="descname">handlesEntry</tt><big>(</big><em>entry</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#Tool.handlesEntry"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.handlesEntry" title="Permalink to this definition">¶</a></dt>
<dd><p>Return True if the entry is handled by this tool.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>entry</strong> (<em>lxml.etree._Element</em>) &#8211; Determine if this entry is handled.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">bool</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Client.Tools.Tool.logger">
<tt class="descname">logger</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.logger" title="Permalink to this definition">¶</a></dt>
<dd><p>A <tt class="xref py py-class docutils literal"><span class="pre">logging.Logger</span></tt> object that will be used by this
tool for logging</p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Client.Tools.Tool.missing_attrs">
<tt class="descname">missing_attrs</tt><big>(</big><em>entry</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#Tool.missing_attrs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.missing_attrs" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of attributes that were expected on an entry
(from <a class="reference internal" href="#Bcfg2.Client.Tools.Tool.__req__" title="Bcfg2.Client.Tools.Tool.__req__"><tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool.__req__</span></tt></a>), but not found.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>entry</strong> (<em>lxml.etree._Element</em>) &#8211; The entry to find missing attributes on</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">list of strings</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Client.Tools.Tool.modified">
<tt class="descname">modified</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.modified" title="Permalink to this definition">¶</a></dt>
<dd><p>A list of entries that have been modified by this tool</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Client.Tools.Tool.name">
<tt class="descname">name</tt><em class="property"> = 'Tool'</em><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.name" title="Permalink to this definition">¶</a></dt>
<dd><p>The name of the tool.  By default this uses
<a class="reference internal" href="#Bcfg2.Client.Tools.ClassName" title="Bcfg2.Client.Tools.ClassName"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Client.Tools.ClassName</span></tt></a> to ensure that it is the
same as the name of the class.</p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Client.Tools.Tool.primarykey">
<tt class="descname">primarykey</tt><big>(</big><em>entry</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#Tool.primarykey"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.primarykey" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a string that describes the entry uniquely amongst
all entries in the configuration.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>entry</strong> (<em>lxml.etree._Element</em>) &#8211; The entry to describe</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.Client.Tools.Tool.setup">
<tt class="descname">setup</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Client.Tools.Tool.setup" title="Permalink to this definition">¶</a></dt>
<dd><p>A <tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Options.OptionParser</span></tt> object describing the
option set Bcfg2 was invoked with</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Client.Tools.PkgTool">
<em class="property">class </em><tt class="descclassname">Bcfg2.Client.Tools.</tt><tt class="descname">PkgTool</tt><big>(</big><em>logger</em>, <em>setup</em>, <em>config</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#PkgTool"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.PkgTool" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#Bcfg2.Client.Tools.Tool" title="Bcfg2.Client.Tools.Tool"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool</span></tt></a></p>
<p>PkgTool provides a one-pass install with fallback for use with
packaging systems.  PkgTool makes a number of assumptions that may
need to be overridden by a subclass.  For instance, it assumes
that packages are installed by a shell command; that only one
version of a given package can be installed; etc.  Nonetheless, it
offers a strong base for writing simple package tools.</p>
<dl class="method">
<dt id="Bcfg2.Client.Tools.PkgTool.FindExtra">
<tt class="descname">FindExtra</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#PkgTool.FindExtra"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.PkgTool.FindExtra" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of extra entries, i.e., entries that exist
on the client but are not in the configuration.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">list of lxml.etree._Element</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Client.Tools.PkgTool.Install">
<tt class="descname">Install</tt><big>(</big><em>packages</em>, <em>states</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#PkgTool.Install"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.PkgTool.Install" title="Permalink to this definition">¶</a></dt>
<dd><p>Run a one-pass install where all required packages are
installed with a single command, followed by single package
installs in case of failure.</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>entries</strong> (<em>list of lxml.etree._Element</em>) &#8211; The entries to install</li>
<li><strong>states</strong> (<em>dict</em>) &#8211; The <tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Client.Frame.Frame.states</span></tt> dict</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.Client.Tools.PkgTool.RefreshPackages">
<tt class="descname">RefreshPackages</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#PkgTool.RefreshPackages"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.PkgTool.RefreshPackages" title="Permalink to this definition">¶</a></dt>
<dd><p>Refresh the internal representation of the package
database (<a class="reference internal" href="#Bcfg2.Client.Tools.PkgTool.installed" title="Bcfg2.Client.Tools.PkgTool.installed"><tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Client.Tools.PkgTool.installed</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">None</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Client.Tools.PkgTool.VerifyPackage">
<tt class="descname">VerifyPackage</tt><big>(</big><em>entry</em>, <em>modlist</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#PkgTool.VerifyPackage"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.PkgTool.VerifyPackage" title="Permalink to this definition">¶</a></dt>
<dd><p>Verify the given Package 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 Package entry to verify</li>
<li><strong>modlist</strong> (<em>list of strings</em>) &#8211; A list of all Path entries in the
configuration, which may be considered when
verifying a package.  For instance, a package
should verify successfully if paths in
<tt class="docutils literal"><span class="pre">modlist</span></tt> have been modified outside the
package.</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 package verifies, false otherwise.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Client.Tools.PkgTool.installed">
<tt class="descname">installed</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Client.Tools.PkgTool.installed" title="Permalink to this definition">¶</a></dt>
<dd><p>A dict of installed packages; the keys should be package
names and the values should be simple strings giving the
installed version.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Client.Tools.PkgTool.pkgtool">
<tt class="descname">pkgtool</tt><em class="property"> = ('echo %s', ('%s', ['name']))</em><a class="headerlink" href="#Bcfg2.Client.Tools.PkgTool.pkgtool" title="Permalink to this definition">¶</a></dt>
<dd><p>A tuple describing the format of the command to run to install
a single package.  The first element of the tuple is a string
giving the format of the command, with a single &#8216;%s&#8217; for the
name of the package or packages to be installed.  The second
element is a tuple whose first element is the format of the
name of the package, and whose second element is a list whose
members are the names of attributes that will be used when
formatting the package name format string.</p>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Client.Tools.PkgTool.pkgtype">
<tt class="descname">pkgtype</tt><em class="property"> = 'echo'</em><a class="headerlink" href="#Bcfg2.Client.Tools.PkgTool.pkgtype" title="Permalink to this definition">¶</a></dt>
<dd><p>The <tt class="docutils literal"><span class="pre">type</span></tt> attribute of Packages handled by this tool.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Client.Tools.SvcTool">
<em class="property">class </em><tt class="descclassname">Bcfg2.Client.Tools.</tt><tt class="descname">SvcTool</tt><big>(</big><em>logger</em>, <em>setup</em>, <em>config</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#SvcTool"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.SvcTool" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#Bcfg2.Client.Tools.Tool" title="Bcfg2.Client.Tools.Tool"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool</span></tt></a></p>
<p>Base class for tools that handle Service 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>logger</strong> (<em>logging.Logger</em>) &#8211; Logger that will be used for logging by this tool</li>
<li><strong>setup</strong> (<em>Bcfg2.Options.OptionParser</em>) &#8211; The option set Bcfg2 was invoked with</li>
<li><strong>config</strong> (<em>lxml.etree._Element</em>) &#8211; The XML configuration for this client</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.Client.Tools.ToolInstantiationError" title="Bcfg2.Client.Tools.ToolInstantiationError"><tt class="xref py py-exc docutils literal"><span class="pre">Bcfg2.Client.Tools.ToolInstantiationError</span></tt></a></p>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="Bcfg2.Client.Tools.SvcTool.BundleUpdated">
<tt class="descname">BundleUpdated</tt><big>(</big><em>bundle</em>, <em>states</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#SvcTool.BundleUpdated"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.SvcTool.BundleUpdated" title="Permalink to this definition">¶</a></dt>
<dd><p>Callback that is invoked when a bundle has been updated.</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>bundle</strong> (<em>lxml.etree._Element</em>) &#8211; The bundle that has been updated</li>
<li><strong>states</strong> (<em>dict</em>) &#8211; The <tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Client.Frame.Frame.states</span></tt> dict</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.Client.Tools.SvcTool.Install">
<tt class="descname">Install</tt><big>(</big><em>entries</em>, <em>states</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#SvcTool.Install"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.SvcTool.Install" title="Permalink to this definition">¶</a></dt>
<dd><p>Install entries.  &#8216;Install&#8217; in this sense means either
initially install, or update as necessary to match the
specification.</p>
<p>This implementation of <a class="reference internal" href="#Bcfg2.Client.Tools.Tool.Install" title="Bcfg2.Client.Tools.Tool.Install"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool.Install()</span></tt></a>
calls a <tt class="docutils literal"><span class="pre">Install&lt;tag&gt;</span></tt> method to install each entry, where
<tt class="docutils literal"><span class="pre">&lt;tag&gt;</span></tt> is the entry tag.  E.g., a Path entry would be
installed by calling <tt class="xref py py-func docutils literal"><span class="pre">InstallPath()</span></tt>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>entries</strong> (<em>list of lxml.etree._Element</em>) &#8211; The entries to install</li>
<li><strong>states</strong> (<em>dict</em>) &#8211; The <tt class="xref py py-attr docutils literal"><span class="pre">Bcfg2.Client.Frame.Frame.states</span></tt> dict</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.Client.Tools.SvcTool.InstallService">
<tt class="descname">InstallService</tt><big>(</big><em>entry</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#SvcTool.InstallService"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.SvcTool.InstallService" title="Permalink to this definition">¶</a></dt>
<dd><p>Install a single service entry.  See
<a class="reference internal" href="#Bcfg2.Client.Tools.Tool.Install" title="Bcfg2.Client.Tools.Tool.Install"><tt class="xref py py-func docutils literal"><span class="pre">Bcfg2.Client.Tools.Tool.Install()</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>entry</strong> (<em>lxml.etree._Element</em>) &#8211; The Service entry to install</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">bool - True if installation was successful, False
otherwise</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Client.Tools.SvcTool.Remove">
<tt class="descname">Remove</tt><big>(</big><em>services</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#SvcTool.Remove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.SvcTool.Remove" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove specified extra 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"><strong>entries</strong> (<em>list of lxml.etree._Element</em>) &#8211; The entries to remove</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.Client.Tools.SvcTool.check_service">
<tt class="descname">check_service</tt><big>(</big><em>service</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#SvcTool.check_service"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.SvcTool.check_service" title="Permalink to this definition">¶</a></dt>
<dd><p>Check the status a service.</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>service</strong> (<em>lxml.etree._Element</em>) &#8211; The service entry to modify</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">bool - True if the status command returned 0, False
otherwise</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Client.Tools.SvcTool.get_svc_command">
<tt class="descname">get_svc_command</tt><big>(</big><em>service</em>, <em>action</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#SvcTool.get_svc_command"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.SvcTool.get_svc_command" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a command that can be run to start or stop a service.</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>service</strong> (<em>lxml.etree._Element</em>) &#8211; The service entry to modify</li>
<li><strong>action</strong> (<em>string</em>) &#8211; The action to take (e.g., &#8220;stop&#8221;, &#8220;start&#8221;)</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">string - The command to run</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Client.Tools.SvcTool.restart_service">
<tt class="descname">restart_service</tt><big>(</big><em>service</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#SvcTool.restart_service"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.SvcTool.restart_service" title="Permalink to this definition">¶</a></dt>
<dd><p>Restart a service.</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>service</strong> (<em>lxml.etree._Element</em>) &#8211; The service entry to modify</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">tuple - The return value from
<a class="reference internal" href="#Bcfg2.Client.Tools.Executor.run" title="Bcfg2.Client.Tools.Executor.run"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Client.Tools.Executor.run</span></tt></a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="Bcfg2.Client.Tools.SvcTool.restarted">
<tt class="descname">restarted</tt><em class="property"> = None</em><a class="headerlink" href="#Bcfg2.Client.Tools.SvcTool.restarted" title="Permalink to this definition">¶</a></dt>
<dd><p>List of services that have been restarted</p>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Client.Tools.SvcTool.start_service">
<tt class="descname">start_service</tt><big>(</big><em>service</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#SvcTool.start_service"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.SvcTool.start_service" title="Permalink to this definition">¶</a></dt>
<dd><p>Start a service.</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>service</strong> (<em>lxml.etree._Element</em>) &#8211; The service entry to modify</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">tuple - The return value from
<a class="reference internal" href="#Bcfg2.Client.Tools.Executor.run" title="Bcfg2.Client.Tools.Executor.run"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Client.Tools.Executor.run</span></tt></a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="Bcfg2.Client.Tools.SvcTool.stop_service">
<tt class="descname">stop_service</tt><big>(</big><em>service</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#SvcTool.stop_service"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.SvcTool.stop_service" title="Permalink to this definition">¶</a></dt>
<dd><p>Stop a service.</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>service</strong> (<em>lxml.etree._Element</em>) &#8211; The service entry to modify</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">tuple - The return value from
<a class="reference internal" href="#Bcfg2.Client.Tools.Executor.run" title="Bcfg2.Client.Tools.Executor.run"><tt class="xref py py-class docutils literal"><span class="pre">Bcfg2.Client.Tools.Executor.run</span></tt></a></td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="helper-classes">
<h3>Helper Classes<a class="headerlink" href="#helper-classes" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="Bcfg2.Client.Tools.ClassName">
<em class="property">class </em><tt class="descclassname">Bcfg2.Client.Tools.</tt><tt class="descname">ClassName</tt><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#ClassName"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.ClassName" 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 very simple descriptor class exists only to get the name
of the owner class.  This is used because, for historical reasons,
we expect every tool to have a <tt class="docutils literal"><span class="pre">name</span></tt> attribute that is in
almost all cases the same as the <tt class="docutils literal"><span class="pre">__class__.__name__</span></tt> attribute
of the plugin object.  This makes that more dynamic so that each
plugin isn&#8217;t repeating its own name.</p>
</dd></dl>

<dl class="class">
<dt id="Bcfg2.Client.Tools.Executor">
<em class="property">class </em><tt class="descclassname">Bcfg2.Client.Tools.</tt><tt class="descname">Executor</tt><big>(</big><em>logger</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#Executor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.Executor" title="Permalink to this definition">¶</a></dt>
<dd><p>This class runs shell commands.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>logger</strong> (<em>logging.Logger</em>) &#8211; The logger to use to produce debug logging</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="Bcfg2.Client.Tools.Executor.run">
<tt class="descname">run</tt><big>(</big><em>command</em><big>)</big><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#Executor.run"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.Executor.run" title="Permalink to this definition">¶</a></dt>
<dd><p>Run a command inside a shell.</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>command</strong> (<em>list</em>) &#8211; The command to run, given as a list as to
<tt class="xref py py-class docutils literal"><span class="pre">subprocess.Popen</span></tt>.  Since the command
will be run within a shell it is particularly
important to pass it as a list.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">tuple of return value (integer) and output (list of
lines)</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="Bcfg2.Client.Tools.ToolInstantiationError">
<em class="property">class </em><tt class="descclassname">Bcfg2.Client.Tools.</tt><tt class="descname">ToolInstantiationError</tt><a class="reference internal" href="../_modules/Bcfg2/Client/Tools.html#ToolInstantiationError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#Bcfg2.Client.Tools.ToolInstantiationError" 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 if the toolset cannot be instantiated.</p>
</dd></dl>

</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Writing A Client Tool Driver</a><ul>
<li><a class="reference internal" href="#client-tool-api">Client Tool API</a><ul>
<li><a class="reference internal" href="#base-classes">Base Classes</a></li>
<li><a class="reference internal" href="#helper-classes">Helper Classes</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="cfg.html"
                        title="previous chapter">Cfg Handler Development</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="compat.html"
                        title="next chapter">Python Compatibility</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/development/client-driver.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="compat.html" title="Python Compatibility"
             >next</a> |</li>
        <li class="right" >
          <a href="cfg.html" title="Cfg Handler Development"
             >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>