1 <?xml version="1.0" encoding="iso-8859-1"?>
3 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
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">
15 function popupCode( url ) {
16 window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
19 function toggleCode( id ) {
20 if ( document.getElementById )
21 elem = document.getElementById( id );
22 else if ( document.all )
23 elem = eval( "document.all." + id );
27 elemStyle = elem.style;
29 if ( elemStyle.display != "block" ) {
30 elemStyle.display = "block"
32 elemStyle.display = "none"
38 // Make codeblocks hidden by default
39 document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
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>
55 <tr class="top-aligned-row">
56 <td><strong>In:</strong></td>
58 <a href="../../files/lib/mcollective/facts/base_rb.html">
59 lib/mcollective/facts/base.rb
62 <a href="../../files/lib/mcollective/facts_rb.html">
63 lib/mcollective/facts.rb
71 <!-- banner header -->
73 <div id="bodyContent">
77 <div id="contextContent">
79 <div id="description">
81 This is a class that gives access to the configured fact provider such as
82 MCollectives::Facts::Facter that uses Reductive Labs facter
85 The actual provider is pluggable and configurable using the
86 ‘factsource’ configuration option.
89 To develop a new factsource simply create a class under <a
90 href="Facts.html">MCollective::Facts</a>:: and provide the following
98 You can also just inherit from <a
99 href="Facts/Base.html">MCollective::Facts::Base</a> and provide just the
105 method that should return a hash of facts.
113 <div id="method-list">
114 <h3 class="section-bar">Methods</h3>
116 <div class="name-list">
117 <a href="#M000018">[]</a>
118 <a href="#M000017">get_fact</a>
119 <a href="#M000016">has_fact?</a>
130 <div id="class-list">
131 <h3 class="section-bar">Classes and Modules</h3>
133 Class <a href="Facts/Base.html" class="link">MCollective::Facts::Base</a><br />
143 <!-- if method_list -->
145 <h3 class="section-bar">Public Class methods</h3>
147 <div id="method-M000018" class="method-detail">
148 <a name="M000018"></a>
150 <div class="method-heading">
151 <a href="#M000018" class="method-signature">
152 <span class="method-name">[]</span><span class="method-args">(fact)</span>
156 <div class="method-description">
158 Get the value of a fact
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">
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">"facts_plugin"</span>].<span class="ruby-identifier">get_fact</span>(<span class="ruby-identifier">fact</span>)
167 37: <span class="ruby-keyword kw">end</span>
173 <div id="method-M000017" class="method-detail">
174 <a name="M000017"></a>
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>
182 <div class="method-description">
184 Get the value of a fact
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">
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">"facts_plugin"</span>].<span class="ruby-identifier">get_fact</span>(<span class="ruby-identifier">fact</span>)
193 32: <span class="ruby-keyword kw">end</span>
199 <div id="method-M000016" class="method-detail">
200 <a name="M000016"></a>
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>
208 <div class="method-description">
210 True if we know of a specific fact else false
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">
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">"facts_plugin"</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>
232 <div id="validator-badges">
233 <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>