Sophie

Sophie

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

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>altsrc &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="Plugins" href="../index.html" />
    <link rel="next" title="Base" href="base.html" />
    <link rel="prev" title="yp" href="bundler/yp.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="base.html" title="Base"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="bundler/yp.html" title="yp"
             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 Server</a> &raquo;</li>
          <li><a href="../index.html" accesskey="U">Plugins</a> &raquo;</li> 
      </ul>
    </div>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="altsrc">
<span id="server-plugins-structures-altsrc"></span><h1>altsrc<a class="headerlink" href="#altsrc" title="Permalink to this headline">¶</a></h1>
<p class="versionadded">
<span class="versionmodified">New in version 0.9.5.</span></p>
<p>Altsrc is a generic, Bcfg2 server-side mechanism for performing
configuration entry name remapping for the purpose of data binding.
Altsrc can be used as a parameter for any entry type, and can be used
in any structure, including Bundler and Base.</p>
<div class="section" id="use-cases">
<h2>Use Cases<a class="headerlink" href="#use-cases" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li>Equivalent configuration entries on different architectures with
different names</li>
<li>Mapping entries with the same name to different bind results in a
configuration (two packages with the same name but different types)</li>
<li>A single configuration entry across multiple specifications
(multi-plugin, or multi-repo)</li>
</ul>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
<ul>
<li><p class="first">Consider the case of /etc/hosts on linux and /etc/inet/hosts on
solaris. These files contain the same data in the same format, and
should typically be synchronized, however, exist in different
locations. Classically, one would need to create one entry for each
in Cfg and perform manual synchronization. Or, you could use
symlinks and pray. Altsrc is driven from the bundle side. For
example:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Bundle</span> <span class="na">name=</span><span class="s">&#39;netinfo&#39;</span><span class="nt">&gt;</span>
   <span class="nt">&lt;Group</span> <span class="na">name=</span><span class="s">&#39;solaris&#39;</span><span class="nt">&gt;</span>
     <span class="nt">&lt;Path</span> <span class="na">name=</span><span class="s">&#39;/etc/inet/hosts&#39;</span> <span class="na">altsrc=</span><span class="s">&#39;/etc/hosts&#39;</span><span class="nt">/&gt;</span>
   <span class="nt">&lt;/Group&gt;</span>
   <span class="nt">&lt;Group</span> <span class="na">name=</span><span class="s">&#39;linux&#39;</span><span class="nt">&gt;</span>
     <span class="nt">&lt;Path</span> <span class="na">name=</span><span class="s">&#39;/etc/hosts&#39;</span><span class="nt">/&gt;</span>
   <span class="nt">&lt;/Group&gt;</span>
<span class="nt">&lt;/Bundle&gt;</span>
</pre></div>
</div>
<p>In this case, when a solaris host gets the &#8216;netinfo&#8217; bundle, it will
get the first Path entry, which includes an altsrc parameter. This
will cause the server to bind the entry as if it were a Path
called <tt class="docutils literal"><span class="pre">/etc/hosts</span></tt>. This configuration entry is still called
<tt class="docutils literal"><span class="pre">/etc/inet/hosts</span></tt>, and is installed as such.</p>
</li>
<li><p class="first">On encap systems, frequently multiple packages of the same name, but
of different types will exist. For example, there might be an openssl
encap package, and an openssl rpm package. This can be dealt with
using a bundle like:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Bundle</span> <span class="na">name=</span><span class="s">&#39;openssl&#39;</span><span class="nt">&gt;</span>
   <span class="nt">&lt;Package</span> <span class="na">name=</span><span class="s">&#39;openssl&#39;</span> <span class="na">altsrc=</span><span class="s">&#39;openssl-encap&#39;</span><span class="nt">/&gt;</span>
   <span class="nt">&lt;Package</span> <span class="na">name=</span><span class="s">&#39;openssl&#39;</span> <span class="na">altsrc=</span><span class="s">&#39;openssl-rpm&#39;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/Bundle&gt;</span>
</pre></div>
</div>
<p>This bundle will bind data for the packages &#8220;openssl-encap&#8221; and
&#8220;openssl-rpm&#8221;, but will be delivered to the client with both packages
named &#8220;openssl&#8221; with different types.</p>
</li>
<li><p class="first">Consider the case where there exist complicated, but completely
independent specifications for the same configuration entry but
different groups of clients. The following bundle will allow the use
of two different templates /etc/firewall-rules-external and
/etc/firewall-rules-internal for different clients based on their
group membership.</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Bundle</span> <span class="na">name=</span><span class="s">&#39;firewall&#39;</span><span class="nt">&gt;</span>
   ...
   <span class="nt">&lt;Group</span> <span class="na">name=</span><span class="s">&#39;conduit&#39;</span><span class="nt">&gt;</span>
     <span class="nt">&lt;Path</span> <span class="na">name=</span><span class="s">&#39;/etc/firewall-rules&#39;</span> <span class="na">altsrc=</span><span class="s">&#39;/etc/firewall-rules-external&#39;</span><span class="nt">/&gt;</span>
   <span class="nt">&lt;/Group&gt;</span>
   <span class="nt">&lt;Group</span> <span class="na">name=</span><span class="s">&#39;internal&#39;</span><span class="nt">&gt;</span>
     <span class="nt">&lt;Path</span> <span class="na">name=</span><span class="s">&#39;/etc/firewall-rules&#39;</span> <span class="na">altsrc=</span><span class="s">&#39;/etc/firewall-rules-internal&#39;</span><span class="nt">/&gt;</span>
   <span class="nt">&lt;/Group&gt;</span>
<span class="nt">&lt;/Bundle&gt;</span>
</pre></div>
</div>
</li>
<li><p class="first">Consider the case where a variety of files can be constructed by a
single <a class="reference internal" href="../generators/cfg.html#server-plugins-generators-cfg-genshi"><em>Genshi</em></a> or
<a class="reference internal" href="../generators/cfg.html#server-plugins-generators-cfg-cheetah"><em>Cheetah</em></a> template. It
would be possible to copy this template into the proper location for
each file, but that requires proper synchronization upon
modification and knowing up front what the files will all be
called. Instead, the following bundle allows the use of a single
template for all proper config file instances.</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Bundle</span> <span class="na">name=</span><span class="s">&#39;netconfig&#39;</span><span class="nt">&gt;</span>
  <span class="nt">&lt;Path</span> <span class="na">name=</span><span class="s">&#39;/etc/sysconfig/network-scripts/ifcfg-eth0&#39;</span> <span class="na">altsrc=</span><span class="s">&#39;/etc/ifcfg-template&#39;</span><span class="nt">/&gt;</span>
  <span class="nt">&lt;Path</span> <span class="na">name=</span><span class="s">&#39;/etc/sysconfig/network-scripts/ifcfg-eth1&#39;</span> <span class="na">altsrc=</span><span class="s">&#39;/etc/ifcfg-template&#39;</span><span class="nt">/&gt;</span>
  <span class="nt">&lt;Path</span> <span class="na">name=</span><span class="s">&#39;/etc/sysconfig/network-scripts/ifcfg-eth2&#39;</span> <span class="na">altsrc=</span><span class="s">&#39;/etc/ifcfg-template&#39;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/Bundle&gt;</span>
</pre></div>
</div>
</li>
</ul>
</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="#">altsrc</a><ul>
<li><a class="reference internal" href="#use-cases">Use Cases</a></li>
<li><a class="reference internal" href="#examples">Examples</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="bundler/yp.html"
                        title="previous chapter">yp</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="base.html"
                        title="next chapter">Base</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../../_sources/server/plugins/structures/altsrc.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="base.html" title="Base"
             >next</a> |</li>
        <li class="right" >
          <a href="bundler/yp.html" title="yp"
             >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 Server</a> &raquo;</li>
          <li><a href="../index.html" >Plugins</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>