blob: a0fa38793e88f486e5def4f8507d2ff5747a540d [file] [log] [blame]
martin f. krafft3cd2a332014-10-28 15:58:23 +01001<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
4
5<html xmlns="http://www.w3.org/1999/xhtml">
6 <head>
7 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
9 <title>reclass to-do list &mdash; reclass 1.4.1 documentation</title>
10
11 <link rel="stylesheet" href="_static/default.css" type="text/css" />
12 <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
13
14 <script type="text/javascript">
15 var DOCUMENTATION_OPTIONS = {
16 URL_ROOT: './',
17 VERSION: '1.4.1',
18 COLLAPSE_INDEX: false,
19 FILE_SUFFIX: '.html',
20 HAS_SOURCE: true
21 };
22 </script>
23 <script type="text/javascript" src="_static/jquery.js"></script>
24 <script type="text/javascript" src="_static/underscore.js"></script>
25 <script type="text/javascript" src="_static/doctools.js"></script>
26 <link rel="top" title="reclass 1.4.1 documentation" href="index.html" />
27 <link rel="next" title="ChangeLog" href="changelog.html" />
28 <link rel="prev" title="Hacking on reclass" href="hacking.html" />
29 </head>
30 <body>
31 <div class="related">
32 <h3>Navigation</h3>
33 <ul>
34 <li class="right" style="margin-right: 10px">
35 <a href="genindex.html" title="General Index"
36 accesskey="I">index</a></li>
37 <li class="right" >
38 <a href="changelog.html" title="ChangeLog"
39 accesskey="N">next</a> |</li>
40 <li class="right" >
41 <a href="hacking.html" title="Hacking on reclass"
42 accesskey="P">previous</a> |</li>
43 <li><a href="index.html">reclass</a> &raquo;</li>
44 </ul>
45 </div>
46
47 <div class="document">
48 <div class="documentwrapper">
49 <div class="bodywrapper">
50 <div class="body">
51
52 <div class="section" id="reclass-to-do-list">
53<h1>reclass to-do list<a class="headerlink" href="#reclass-to-do-list" title="Permalink to this headline"></a></h1>
54<div class="section" id="common-set-of-classes">
55<h2>Common set of classes<a class="headerlink" href="#common-set-of-classes" title="Permalink to this headline"></a></h2>
56<p>A lot of the classes I have set up during the various stages of development of
57<strong>reclass</strong> are generic. It would probably be sensible to make them available as
58part of <strong>reclass</strong>, to give people a common baseline to work from, and to
59ensure a certain level of consistency between users.</p>
60<p>This could also provide a more realistic example to users on how to use
61<strong>reclass</strong>.</p>
62</div>
63<div class="section" id="testing-framework">
64<h2>Testing framework<a class="headerlink" href="#testing-framework" title="Permalink to this headline"></a></h2>
65<p>There is rudimentary testing in place, but it&#8217;s inconsistent. I got
66side-tracked into discussions about the philosphy of mocking objects. This
67could all be fixed and unified.</p>
68<p>Also, storage, outputters, CLI and adapters have absolutely no tests yet…</p>
69<p>The testing framework should also incorporate the example classes mentioned
70above.</p>
71</div>
72<div class="section" id="configurable-file-extension">
73<h2>Configurable file extension<a class="headerlink" href="#configurable-file-extension" title="Permalink to this headline"></a></h2>
74<p>Right now, <tt class="docutils literal"><span class="pre">.yml</span></tt> is hard-coded. This could be exported to the
75configuration file, or even given as a list, so that <tt class="docutils literal"><span class="pre">.yml</span></tt> and <tt class="docutils literal"><span class="pre">.yaml</span></tt>
76can both be used.</p>
77<p>Actually, I don&#8217;t think this is such a good idea. If we create too many
78options right now, it&#8217;ll be harder to unify later. Please also see <a href="#id1"><span class="problematic" id="id2">`issue #17
79&lt;https://github.com/madduck/reclass/issues/17`_</span></a> for a discussion about this.</p>
80</div>
81<div class="section" id="verbosity-debugging">
82<h2>Verbosity, debugging<a class="headerlink" href="#verbosity-debugging" title="Permalink to this headline"></a></h2>
83<p>Verbose output and debug logging would be a very useful addition to help
84people understand what&#8217;s going on, where data are being changed/merged, and to
85help solve problems.</p>
86</div>
87<div class="section" id="data-from-cms-for-interpolation">
88<h2>Data from CMS for interpolation<a class="headerlink" href="#data-from-cms-for-interpolation" title="Permalink to this headline"></a></h2>
89<p>Depending on the CMS in question, it would be nice if <strong>reclass</strong> had access to
90the host-specific data (facts, grains, etc.) and could use those in parameter
91interpolation. I can imagine this working for Salt, where the <tt class="docutils literal"><span class="pre">grains</span></tt>
92dictionary (and results from previous external node classifiers) is made
93available to the external node classifiers, but I am not convinced this will
94be possible in Ansible and Puppet.</p>
95<p>On the other hand, providing CMS-specific data to reclass will make people
96depend on it, meaning Salt cannot be used with multiple tools anymore.</p>
97<p>The way to deal with that would be to map grains, facts, whatever the CMS
98calls them, to a shared naming scheme/taxonomy, but that&#8217;s a painful task,
99I think. It would mean, however, that even templates could be shared between
100CMSs if they only use the data provided by reclass (i.e. grains/facts become
101pillar data).</p>
102</div>
103<div class="section" id="membership-information">
104<h2>Membership information<a class="headerlink" href="#membership-information" title="Permalink to this headline"></a></h2>
105<p>It would be nice if <strong>reclass</strong> could provide e.g. the Nagios master node with
106a list of clients that define it as their master. That would short-circuit
107Puppet&#8217;s <tt class="docutils literal"><span class="pre">storeconfigs</span></tt> and Salt&#8217;s <tt class="docutils literal"><span class="pre">mine</span></tt>.</p>
108<p>The way I envision this currently is to provide something I call &#8220;inventory
109queries&#8221;. For instance, the Nagios master node&#8217;s reclass data would contain
110the following (<tt class="docutils literal"><span class="pre">$[…]</span></tt> would denote interpolation to create a list, a bit
111like list comprehension):</p>
112<div class="highlight-python"><div class="highlight"><pre>parameters:
113 nagios:
114 hosts: $[nagios:master == SELF.nodename]
115</pre></div>
116</div>
117<p>This would cause <strong>reclass</strong> to iterate the inventory and generate a list of all
118the nodes that define a parameter <tt class="docutils literal"><span class="pre">nagios:master</span></tt> whose value equals to the
119name of the current node.</p>
120<p>This could be greatly simplified. For instance, we could simply limit
121comparisons against the name of the current node and just specify</p>
122<div class="highlight-python"><div class="highlight"><pre>$[nagios:master]
123</pre></div>
124</div>
125<p>which would be expanded to a list of node names whose pillar data includes
126<tt class="docutils literal"><span class="pre">${nagios:master}</span></tt> that matches the current node&#8217;s name.</p>
127<p>Or it could be made arbitrarily complex and flexible, e.g. any of the
128following:</p>
129<div class="highlight-python"><div class="highlight"><pre>$[nagios:master == SELF.nodename] # replace with nodename
130$[nagios:master == SELF.nodename | nodename] # name replacement value
131$[nagios:master == SELF.nodename | nagios:nodeid] # replace with pillar data
132$[x:nagios:nodeid foreach x | x:nagios:master == SELF.nodename]
133
134</pre></div>
135</div>
136<p>I&#8217;d rather not code this up from scratch, so I am looking for ideas for reuse…</p>
137</div>
138<div class="section" id="configuration-file-lookup-improvements">
139<h2>Configuration file lookup improvements<a class="headerlink" href="#configuration-file-lookup-improvements" title="Permalink to this headline"></a></h2>
140<p>Right now, the adapters and the CLI look for the <a class="reference internal" href="configfile.html"><em>configuration file</em></a> in a fixed set of locations. On of those derives from
141<tt class="docutils literal"><span class="pre">OPT_INVENTORY_BASE_URI</span></tt>, the default inventory base URI (<tt class="docutils literal"><span class="pre">/etc/reclass</span></tt>).
142This should probably be updated in case the user changes the URI.</p>
143<p>Furthermore, <tt class="docutils literal"><span class="pre">$CWD</span></tt> and <tt class="docutils literal"><span class="pre">~</span></tt> might not make a lot of sense in all
144use-cases.</p>
145<p>However, this might be better addressed by the following point:</p>
146</div>
147<div class="section" id="adapter-class-hierarchy">
148<h2>Adapter class hierarchy<a class="headerlink" href="#adapter-class-hierarchy" title="Permalink to this headline"></a></h2>
149<p>At the moment, adapters are just imperative code. It might make more sense to
150wrap them in classes, which customise things like command-line and config file
151parsing.</p>
152<p>One nice way would be to generalise configuration file reading, integrate it
153with command-line parsing, and then allow the consumers (the adapters) to
154configure them, for instance, in the Salt adapter:</p>
155<div class="highlight-python"><div class="highlight"><pre><span class="n">config_proxy</span> <span class="o">=</span> <span class="n">ConfigProxy</span><span class="p">()</span>
156<span class="n">config_proxy</span><span class="o">.</span><span class="n">set_configfile_search_path</span><span class="p">([</span><span class="s">&#39;/etc/reclass&#39;</span><span class="p">,</span> <span class="s">&#39;/etc/salt&#39;</span><span class="p">])</span>
157<span class="n">config_proxy</span><span class="o">.</span><span class="n">lock_config_option</span><span class="p">(</span><span class="s">&#39;output&#39;</span><span class="p">,</span> <span class="s">&#39;yaml&#39;</span><span class="p">)</span>
158</pre></div>
159</div>
160<p>The last call would effectively remove the <tt class="docutils literal"><span class="pre">--output</span></tt> config option from the
161CLI, and yield an error (or warning) if the option was encountered while
162parsing the configuration file.</p>
163<p>Furthermore, the class instances could become long-lived and keep a reference
164to a storage proxy, e.g. to prevent having to reload storage on every request.</p>
165</div>
166<div class="section" id="node-lists">
167<h2>Node lists<a class="headerlink" href="#node-lists" title="Permalink to this headline"></a></h2>
168<p>Class mappings are still experimental, and one of the reasons I am not too
169happy with them right now is that one would still need to provide node files
170for all nodes for <tt class="docutils literal"><span class="pre">inventory</span></tt> invocations. This is because class mappings
171can assign classes based on patterns or regular expressions, but it is not
172possible to turn a pattern or regular expression into a list of valid nodes.</p>
173<p><a class="reference external" href="https://github.com/madduck/reclass/issues/9">Issue #9</a> contains a lengthy
174discussion on this. At the moment, I am unsure what the best way forward is.</p>
175</div>
176<div class="section" id="inventory-filters">
177<h2>Inventory filters<a class="headerlink" href="#inventory-filters" title="Permalink to this headline"></a></h2>
178<p>As described in <a class="reference external" href="https://github.com/madduck/reclass/issues/11">issue #11</a>:
179provide a means to limit the enumeration of the inventory, according to node
180name patterns, or using classes white-/blacklists.</p>
181</div>
182</div>
183
184
185 </div>
186 </div>
187 </div>
188 <div class="sphinxsidebar">
189 <div class="sphinxsidebarwrapper">
190 <h3><a href="index.html">Table Of Contents</a></h3>
191 <ul>
192<li><a class="reference internal" href="#">reclass to-do list</a><ul>
193<li><a class="reference internal" href="#common-set-of-classes">Common set of classes</a></li>
194<li><a class="reference internal" href="#testing-framework">Testing framework</a></li>
195<li><a class="reference internal" href="#configurable-file-extension">Configurable file extension</a></li>
196<li><a class="reference internal" href="#verbosity-debugging">Verbosity, debugging</a></li>
197<li><a class="reference internal" href="#data-from-cms-for-interpolation">Data from CMS for interpolation</a></li>
198<li><a class="reference internal" href="#membership-information">Membership information</a></li>
199<li><a class="reference internal" href="#configuration-file-lookup-improvements">Configuration file lookup improvements</a></li>
200<li><a class="reference internal" href="#adapter-class-hierarchy">Adapter class hierarchy</a></li>
201<li><a class="reference internal" href="#node-lists">Node lists</a></li>
202<li><a class="reference internal" href="#inventory-filters">Inventory filters</a></li>
203</ul>
204</li>
205</ul>
206
207 <h4>Previous topic</h4>
208 <p class="topless"><a href="hacking.html"
209 title="previous chapter">Hacking on reclass</a></p>
210 <h4>Next topic</h4>
211 <p class="topless"><a href="changelog.html"
212 title="next chapter">ChangeLog</a></p>
213<div id="searchbox" style="display: none">
214 <h3>Quick search</h3>
215 <form class="search" action="search.html" method="get">
216 <input type="text" name="q" />
217 <input type="submit" value="Go" />
218 <input type="hidden" name="check_keywords" value="yes" />
219 <input type="hidden" name="area" value="default" />
220 </form>
221 <p class="searchtip" style="font-size: 90%">
222 Enter search terms or a module, class or function name.
223 </p>
224</div>
225<script type="text/javascript">$('#searchbox').show(0);</script>
226 </div>
227 </div>
228 <div class="clearer"></div>
229 </div>
230 <div class="related">
231 <h3>Navigation</h3>
232 <ul>
233 <li class="right" style="margin-right: 10px">
234 <a href="genindex.html" title="General Index"
235 >index</a></li>
236 <li class="right" >
237 <a href="changelog.html" title="ChangeLog"
238 >next</a> |</li>
239 <li class="right" >
240 <a href="hacking.html" title="Hacking on reclass"
241 >previous</a> |</li>
242 <li><a href="index.html">reclass</a> &raquo;</li>
243 </ul>
244 </div>
245 <div class="footer">
246 &copy; Copyright 2013, martin f. krafft.
247 Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
248 </div>
249 </body>
250</html>