Sophie

Sophie

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

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>test &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="TGenshi" href="../../tgenshi.html" />
    <link rel="next" title="Properties" href="../../../connectors/properties.html" />
    <link rel="prev" title="my.cnf" href="mycnf.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="../../../connectors/properties.html" title="Properties"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="mycnf.html" title="my.cnf"
             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" >Plugins</a> &raquo;</li>
          <li><a href="../../tgenshi.html" accesskey="U">TGenshi</a> &raquo;</li> 
      </ul>
    </div>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="test">
<h1>test<a class="headerlink" href="#test" title="Permalink to this headline">ΒΆ</a></h1>
<p>As submitted by dclark</p>
<p>This file just shows you what&#8217;s available. It assumes a
<tt class="docutils literal"><span class="pre">/var/lib/bcfg2/Properties/test.xml</span></tt> file with an entry like this:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Properties&gt;</span>
  <span class="nt">&lt;password&gt;</span>
    <span class="nt">&lt;bcfg2&gt;</span>fakeBCFG2password<span class="nt">&lt;/bcfg2&gt;</span>
  <span class="nt">&lt;/password&gt;</span>
<span class="nt">&lt;/Properties&gt;</span>
</pre></div>
</div>
<div class="highlight-python"><pre>Hostname is ${metadata.hostname}

Groups:
{% for group in metadata.groups %}\
${group} \
{% end %}\

{% if metadata.categories %}\
Categories:
{% for category in metadata.categories %}\
${category} \
{% end %}\
{% end %}\

{% if metadata.Probes %}\
Probes:
{% for probe, value in metadata.Probes.iteritems() %}\
$probe $value
{% end %}\
{% end %}\

Two main ways to get the same property value:
${metadata.Properties['test.xml'].xdata.find('password').find('bcfg2').text}
${metadata.Properties['test.xml'].xdata.xpath('password/bcfg2')[0].text}

One way to get information about metadata and properties:

dir(metadata):
{% for var in dir(metadata) %}\
${var} \
{% end %}

dir(metadata.Properties.xdata):
{% for var in dir(metadata.Properties.xdata) %}\
${var} \
{% end %}

dir(metadata.Properties.xdata.entries):
{% for var in dir(metadata.Properties.xdata.entries) %}\
${var} \
{% end %}

dir(metadata.Properties.xdata.label):
{% for var in dir(metadata.Properties.xdata.label) %}\
${var} \
{% end %}

dir(metadata.Properties.xdata.name):
{% for var in dir(metadata.Properties.xdata.name) %}\
${var} \
{% end %}

dir(metadata.Properties.xdata.properties):
{% for var in dir(metadata.Properties.xdata.properties) %}\
${var} \
{% end %}</pre>
</div>
<p>When the above file is saved as <tt class="docutils literal"><span class="pre">Cfg/test/test.genshi</span></tt> and generated
with <tt class="docutils literal"><span class="pre">bcfg2-info</span> <span class="pre">buildfile</span> <span class="pre">/test</span> <span class="pre">test.hostname.org</span></tt>, the results
look like this (below reformatted a little bit to fit in 80 columns):</p>
<div class="highlight-python"><pre>&lt;Path type="file" name="/test" owner="root" mode="644" encoding="ascii" group="root" paranoid="false"&gt;
Hostname is test.hostname.org

Groups:
bcfg2-server


Two main ways to get the same property value:
fakeBCFG2password
fakeBCFG2password

One way to get information about metadata and properties:

dir(metadata):
__class__ __delattr__ __dict__ __doc__ __getattribute__ __hash__ __init__
 __module__ __new__ __reduce__ __reduce_ex__ __repr__ __setattr__ __str__
 __weakref__ all bundles categories get_clients_by_group get_clients_by_profile
 groups hostname inGrouppassword probes uuid

dir(metadata.Properties.xdata):
HandleEvent Index __class__ __delattr__ __dict__ __doc__ __getattribute__
 __hash__ __identifier__ __init__ __iter__ __module__ __new__ __reduce__
 __reduce_ex__ __repr__ __setattr__ __str__ __weakref__ entries label name
 properties

dir(metadata.Properties.xdata.entries):
__add__ __class__ __contains__ __delattr__ __delitem__ __delslice__ __doc__
 __eq__ __ge__ __getattribute__ __getitem__ __getslice__ __gt__ __hash__
 __iadd__ __imul__ __init__ __iter__ __le__ __len__ __lt__ __mul__ __ne__
 __new__ __reduce__ __reduce_ex__ __repr__ __reversed__ __rmul__ __setattr__
 __setitem__ __setslice__ __str__ append count extend index insert pop remove
 reverse sort

dir(metadata.Properties.xdata.label):
__add__ __class__ __contains__ __delattr__ __doc__ __eq__ __ge__
 __getattribute__ __getitem__ __getnewargs__ __getslice__ __gt__ __hash__
 __init__ __le__ __len__ __lt__ __mod__ __mul__ __ne__ __new__ __reduce__
 __reduce_ex__ __repr__ __rmod__ __rmul__ __setattr__ __str__ capitalize center
 count decode encode endswith expandtabs find index isalnum isalpha isdigit
 islower isspace istitle isupper join ljust lower lstrip partition replace
 rfind rindex rjust rpartition rsplit rstrip split splitlinesstartswith strip
 swapcase title translate upper zfill

dir(metadata.Properties.xdata.name):
__add__ __class__ __contains__ __delattr__ __doc__ __eq__ __ge__
 __getattribute__ __getitem__ __getnewargs__ __getslice__ __gt__ __hash__
 __init__ __le__ __len__ __lt__ __mod__ __mul__ __ne__ __new__ __reduce__
 __reduce_ex__ __repr__ __rmod__ __rmul__ __setattr__ __str__ capitalize center
 count decode encode endswith expandtabs find index isalnum isalpha isdigit
 islower isspace istitle isupper join ljust lower lstrip partition replace
 rfind rindex rjust rpartition rsplit rstrip split splitlinesstartswith strip
 swapcase title translate upper zfill

dir(metadata.Properties.xdata.properties):
__class__ __contains__ __copy__ __deepcopy__ __delattr__ __delitem__
 __delslice__ __doc__ __getattribute__ __getitem__ __getslice__ __hash__
 __init__ __iter__ __len__ __new__ __nonzero__ __reduce__ __reduce_ex__
 __repr__ __reversed__ __setattr__ __setitem__ __setslice__ __str__ _init
 addnext addprevious append attrib clear extend find findall findtext get
 getchildren getiterator getnext getparent getprevious getroottree index insert
 items iterancestors iterchildren iterdescendants itersiblings keys makeelement
 nsmap prefix remove replace set sourceline tag tail text values xpath
&lt;/Path&gt;</pre>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="mycnf.html"
                        title="previous chapter">my.cnf</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="../../../connectors/properties.html"
                        title="next chapter">Properties</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../../../../_sources/server/plugins/generators/examples/genshi/test.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="../../../connectors/properties.html" title="Properties"
             >next</a> |</li>
        <li class="right" >
          <a href="mycnf.html" title="my.cnf"
             >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>
          <li><a href="../../tgenshi.html" >TGenshi</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>