Update version according to OSCI-856
[packages/precise/mcollective.git] / doc / classes / MCollective / Facts.html
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE html 
3      PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
6 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7 <head>
8   <title>Module: MCollective::Facts</title>
9   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10   <meta http-equiv="Content-Script-Type" content="text/javascript" />
11   <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12   <script type="text/javascript">
13   // <![CDATA[
14
15   function popupCode( url ) {
16     window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17   }
18
19   function toggleCode( id ) {
20     if ( document.getElementById )
21       elem = document.getElementById( id );
22     else if ( document.all )
23       elem = eval( "document.all." + id );
24     else
25       return false;
26
27     elemStyle = elem.style;
28     
29     if ( elemStyle.display != "block" ) {
30       elemStyle.display = "block"
31     } else {
32       elemStyle.display = "none"
33     }
34
35     return true;
36   }
37   
38   // Make codeblocks hidden by default
39   document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40   
41   // ]]>
42   </script>
43
44 </head>
45 <body>
46
47
48
49     <div id="classHeader">
50         <table class="header-table">
51         <tr class="top-aligned-row">
52           <td><strong>Module</strong></td>
53           <td class="class-name-in-header">MCollective::Facts</td>
54         </tr>
55         <tr class="top-aligned-row">
56             <td><strong>In:</strong></td>
57             <td>
58                 <a href="../../files/lib/mcollective/facts/base_rb.html">
59                 lib/mcollective/facts/base.rb
60                 </a>
61         <br />
62                 <a href="../../files/lib/mcollective/facts_rb.html">
63                 lib/mcollective/facts.rb
64                 </a>
65         <br />
66             </td>
67         </tr>
68
69         </table>
70     </div>
71   <!-- banner header -->
72
73   <div id="bodyContent">
74
75
76
77   <div id="contextContent">
78
79     <div id="description">
80       <p>
81 This is a class that gives access to the configured fact provider such as
82 MCollectives::Facts::Facter that uses Reductive Labs facter
83 </p>
84 <p>
85 The actual provider is pluggable and configurable using the
86 &#8216;factsource&#8217; configuration option.
87 </p>
88 <p>
89 To develop a new factsource simply create a class under <a
90 href="Facts.html">MCollective::Facts</a>:: and provide the following
91 classes:
92 </p>
93 <pre>
94   self.get_fact(fact)
95   self.has_fact?(fact)
96 </pre>
97 <p>
98 You can also just inherit from <a
99 href="Facts/Base.html">MCollective::Facts::Base</a> and provide just the
100 </p>
101 <pre>
102   self.get_facts
103 </pre>
104 <p>
105 method that should return a hash of facts.
106 </p>
107
108     </div>
109
110
111    </div>
112
113     <div id="method-list">
114       <h3 class="section-bar">Methods</h3>
115
116       <div class="name-list">
117       <a href="#M000018">[]</a>&nbsp;&nbsp;
118       <a href="#M000017">get_fact</a>&nbsp;&nbsp;
119       <a href="#M000016">has_fact?</a>&nbsp;&nbsp;
120       </div>
121     </div>
122
123   </div>
124
125
126     <!-- if includes -->
127
128     <div id="section">
129
130     <div id="class-list">
131       <h3 class="section-bar">Classes and Modules</h3>
132
133       Class <a href="Facts/Base.html" class="link">MCollective::Facts::Base</a><br />
134
135     </div>
136
137
138
139
140       
141
142
143     <!-- if method_list -->
144     <div id="methods">
145       <h3 class="section-bar">Public Class methods</h3>
146
147       <div id="method-M000018" class="method-detail">
148         <a name="M000018"></a>
149
150         <div class="method-heading">
151           <a href="#M000018" class="method-signature">
152           <span class="method-name">[]</span><span class="method-args">(fact)</span>
153           </a>
154         </div>
155       
156         <div class="method-description">
157           <p>
158 Get the value of a fact
159 </p>
160           <p><a class="source-toggle" href="#"
161             onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
162           <div class="method-source-code" id="M000018-source">
163 <pre>
164     <span class="ruby-comment cmt"># File lib/mcollective/facts.rb, line 35</span>
165 35:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-operator">[]</span>(<span class="ruby-identifier">fact</span>)
166 36:       <span class="ruby-constant">PluginManager</span>[<span class="ruby-value str">&quot;facts_plugin&quot;</span>].<span class="ruby-identifier">get_fact</span>(<span class="ruby-identifier">fact</span>)
167 37:     <span class="ruby-keyword kw">end</span>
168 </pre>
169           </div>
170         </div>
171       </div>
172
173       <div id="method-M000017" class="method-detail">
174         <a name="M000017"></a>
175
176         <div class="method-heading">
177           <a href="#M000017" class="method-signature">
178           <span class="method-name">get_fact</span><span class="method-args">(fact)</span>
179           </a>
180         </div>
181       
182         <div class="method-description">
183           <p>
184 Get the value of a fact
185 </p>
186           <p><a class="source-toggle" href="#"
187             onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
188           <div class="method-source-code" id="M000017-source">
189 <pre>
190     <span class="ruby-comment cmt"># File lib/mcollective/facts.rb, line 30</span>
191 30:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_fact</span>(<span class="ruby-identifier">fact</span>)
192 31:       <span class="ruby-constant">PluginManager</span>[<span class="ruby-value str">&quot;facts_plugin&quot;</span>].<span class="ruby-identifier">get_fact</span>(<span class="ruby-identifier">fact</span>)
193 32:     <span class="ruby-keyword kw">end</span>
194 </pre>
195           </div>
196         </div>
197       </div>
198
199       <div id="method-M000016" class="method-detail">
200         <a name="M000016"></a>
201
202         <div class="method-heading">
203           <a href="#M000016" class="method-signature">
204           <span class="method-name">has_fact?</span><span class="method-args">(fact, value)</span>
205           </a>
206         </div>
207       
208         <div class="method-description">
209           <p>
210 True if we know of a specific fact else false
211 </p>
212           <p><a class="source-toggle" href="#"
213             onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
214           <div class="method-source-code" id="M000016-source">
215 <pre>
216     <span class="ruby-comment cmt"># File lib/mcollective/facts.rb, line 25</span>
217 25:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">has_fact?</span>(<span class="ruby-identifier">fact</span>, <span class="ruby-identifier">value</span>)
218 26:       <span class="ruby-constant">PluginManager</span>[<span class="ruby-value str">&quot;facts_plugin&quot;</span>].<span class="ruby-identifier">get_fact</span>(<span class="ruby-identifier">fact</span>) <span class="ruby-operator">==</span> <span class="ruby-identifier">value</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">true</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">false</span>
219 27:     <span class="ruby-keyword kw">end</span>
220 </pre>
221           </div>
222         </div>
223       </div>
224
225
226     </div>
227
228
229   </div>
230
231
232 <div id="validator-badges">
233   <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
234 </div>
235
236 </body>
237 </html>