Sophie

Sophie

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

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>Actions &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="Client Tool Drivers" href="../tools.html" />
    <link rel="next" title="APT Client Tool" href="apt.html" />
    <link rel="prev" title="Client Tool Drivers" href="../tools.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="apt.html" title="APT Client Tool"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="../tools.html" title="Client Tool Drivers"
             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" >The Bcfg2 Client</a> &raquo;</li>
          <li><a href="../tools.html" accesskey="U">Client Tool Drivers</a> &raquo;</li> 
      </ul>
    </div>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="actions">
<span id="client-tools-actions"></span><h1>Actions<a class="headerlink" href="#actions" title="Permalink to this headline">¶</a></h1>
<p>This page describes use of the Action configuration entry. Action entries
are commands that are executed either before bundle installation,
after bundle installation or both. If exit status is observed, a
failing pre-action will cause no modification of the enclosing bundle
to be performed; all entries in included in that bundle will not be
modified. Failing actions are reported through Bcfg2&#8217;s reporting system,
so they can be centrally observed. Actions look like:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Action</span> <span class="na">timing=</span><span class="s">&#39;pre|post|both&#39;</span>
        <span class="na">name=</span><span class="s">&#39;name&#39;</span>
        <span class="na">command=</span><span class="s">&#39;cmd text&#39;</span>
        <span class="na">when=</span><span class="s">&#39;always|modified&#39;</span>
        <span class="na">status=</span><span class="s">&#39;ignore|check&#39;</span>
        <span class="na">build=</span><span class="s">&#39;true|false&#39;</span><span class="nt">/&gt;</span>
</pre></div>
</div>
<dl class="complexType" id="complexType:ActionType">
<dt id="complexType:ActionType">
<!--[complexType:ActionType]--><em>complexType</em> <strong>ActionType</strong><a class="headerlink" href="#complexType:ActionType" title="Permalink to this definition">¶</a></dt>
</dt>
<dd><blockquote class="first">
<div>Action entries are external shell commands that are executed
either before bundle installation, after bundle installation
or both.</div></blockquote>
<dl class="last docutils">
<dt>Attributes:</dt>
<dd><table border="1" class="first last docutils">
<colgroup>
<col width="10%" />
<col width="50%" />
<col width="20%" />
<col width="10%" />
<col width="10%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Name</th>
<th class="head">Description</th>
<th class="head">Values</th>
<th class="head">Required</th>
<th class="head">Default</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><span class="target" id="attribute:ActionType:command"></span><tt class="docutils literal"><span class="pre">command</span></tt></td>
<td><blockquote class="first last">
<div>The command to run.  The command is executed within a shell,
so flow control and other shell-specific things can be used.</div></blockquote>
</td>
<td><a class="reference external" href="http://www.w3.org/TR/xmlschema-2/#string"><tt class="docutils literal"><span class="pre">string</span></tt></a></td>
<td>Yes</td>
<td>None</td>
</tr>
<tr class="row-odd"><td><span class="target" id="attribute:ActionType:name"></span><tt class="docutils literal"><span class="pre">name</span></tt></td>
<td><blockquote class="first last">
<div>The freeform name of the action.</div></blockquote>
</td>
<td><a class="reference external" href="http://www.w3.org/TR/xmlschema-2/#string"><tt class="docutils literal"><span class="pre">string</span></tt></a></td>
<td>Yes</td>
<td>None</td>
</tr>
<tr class="row-even"><td><span class="target" id="attribute:ActionType:status"></span><tt class="docutils literal"><span class="pre">status</span></tt></td>
<td><blockquote class="first last">
<div>Whether or not to check the return code of the action.  If
this is &#8220;check&#8221;, then a non-zero return code will result in
the entry being flagged as bad.</div></blockquote>
</td>
<td><tt class="docutils literal"><span class="pre">ignore</span></tt> | <tt class="docutils literal"><span class="pre">check</span></tt></td>
<td>Yes</td>
<td>None</td>
</tr>
<tr class="row-odd"><td><span class="target" id="attribute:ActionType:timing"></span><tt class="docutils literal"><span class="pre">timing</span></tt></td>
<td><blockquote class="first last">
<div>When the action is run.</div></blockquote>
</td>
<td><tt class="docutils literal"><span class="pre">both</span></tt> | <tt class="docutils literal"><span class="pre">pre</span></tt> | <tt class="docutils literal"><span class="pre">post</span></tt></td>
<td>Yes</td>
<td>None</td>
</tr>
<tr class="row-even"><td><span class="target" id="attribute:ActionType:when"></span><tt class="docutils literal"><span class="pre">when</span></tt></td>
<td><blockquote class="first last">
<div>If the action is always run, or is only run when a bundle
has been modified.  Actions that run before bundle
installation (&#8220;pre&#8221; and &#8220;both&#8221;) ignore the setting of
<tt class="docutils literal"><span class="pre">when</span></tt> and are always run regardless.</div></blockquote>
</td>
<td><tt class="docutils literal"><span class="pre">modified</span></tt> | <tt class="docutils literal"><span class="pre">always</span></tt></td>
<td>Yes</td>
<td>None</td>
</tr>
<tr class="row-odd"><td><span class="target" id="attribute:ActionType:build"></span><tt class="docutils literal"><span class="pre">build</span></tt></td>
<td><blockquote class="first last">
<div>Also execute the action in build mode.</div></blockquote>
</td>
<td><tt class="docutils literal"><span class="pre">true</span></tt> | <tt class="docutils literal"><span class="pre">false</span></tt></td>
<td>No</td>
<td><tt class="first last docutils literal"><span class="pre">true</span></tt></td>
</tr>
</tbody>
</table>
</dd>
<dt>Attribute groups:</dt>
<dd><ul class="first last simple">
<li><a class="reference internal" href="../../server/genshi-xml.html#attributeGroup:py:genshiAttrs"><tt class="docutils literal"><span class="pre">py:genshiAttrs</span></tt></a></li>
</ul>
</dd>
</dl>
</dd>
</dl>

<p>Note that the status attribute tells the bcfg2 client to ignore
return status, causing failures to still not be centrally reported. If
central reporting of action failure is desired, set this attribute to
&#8216;check&#8217;. Also note that Action entries included in Base will not be
executed.</p>
<p>Actions cannot be completely defined inside of a bundle; they are a bound
entry, much like Packages, Services or Paths. The Rules plugin can bind
these entries. For example to include the above action in a bundle,
first the Action entry must be included in the bundle:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Bundle</span> <span class="na">name=</span><span class="s">&#39;bundle_name&#39;</span><span class="nt">&gt;</span>
  ...
  <span class="nt">&lt;Action</span> <span class="na">name=</span><span class="s">&#39;action_name&#39;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/Bundle&gt;</span>
</pre></div>
</div>
<p>Then a corresponding entry must be included in the Rules directory, like:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Rules</span> <span class="na">priority=</span><span class="s">&#39;0&#39;</span><span class="nt">&gt;</span>
  <span class="nt">&lt;Action</span> <span class="na">timing=</span><span class="s">&#39;post&#39;</span> <span class="na">when=</span><span class="s">&#39;modified&#39;</span> <span class="na">name=</span><span class="s">&#39;action_name&#39;</span>
          <span class="na">command=</span><span class="s">&#39;/path/to/command arg1 arg2&#39;</span> <span class="na">status=</span><span class="s">&#39;ignore&#39;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/Rules&gt;</span>
</pre></div>
</div>
<p>This allows different clients to get different actions as a part of the
same bundle based on group membership.</p>
<div class="section" id="example-action-add-apt-keys">
<h2>Example Action (add APT keys)<a class="headerlink" href="#example-action-add-apt-keys" title="Permalink to this headline">¶</a></h2>
<p>This example will add the &#8216;0C5A2783&#8217; for aptitude. It is useful to run
this during the client bootstrap process so that the proper keys are
installed prior to the bcfg2 client trying to install a package which
requires this key.</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Rules</span> <span class="na">priority=</span><span class="s">&#39;0&#39;</span><span class="nt">&gt;</span>
  <span class="nt">&lt;Group</span> <span class="na">name=</span><span class="s">&#39;ubuntu&#39;</span><span class="nt">&gt;</span>
    <span class="nt">&lt;Action</span> <span class="na">timing=</span><span class="s">&#39;post&#39;</span> <span class="na">name=</span><span class="s">&#39;apt-key-update&#39;</span> <span class="na">command=</span><span class="s">&#39;apt-key adv --recv-keys --keyserver hkp://pgp.mit.edu 0C5A2783&#39;</span> <span class="na">when=</span><span class="s">&#39;modified&#39;</span> <span class="na">status=</span><span class="s">&#39;check&#39;</span><span class="nt">/&gt;</span>
  <span class="nt">&lt;/Group&gt;</span>
<span class="nt">&lt;/Rules&gt;</span>
</pre></div>
</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="#">Actions</a><ul>
<li><a class="reference internal" href="#example-action-add-apt-keys">Example Action (add APT keys)</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="../tools.html"
                        title="previous chapter">Client Tool Drivers</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="apt.html"
                        title="next chapter">APT Client Tool</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../_sources/client/tools/actions.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="apt.html" title="APT Client Tool"
             >next</a> |</li>
        <li class="right" >
          <a href="../tools.html" title="Client Tool Drivers"
             >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" >The Bcfg2 Client</a> &raquo;</li>
          <li><a href="../tools.html" >Client Tool Drivers</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>