1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6 <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
8 <title>Class: MCollective::Discovery</title>
10 <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
12 <script src="../js/jquery.js" type="text/javascript"
13 charset="utf-8"></script>
14 <script src="../js/thickbox-compressed.js" type="text/javascript"
15 charset="utf-8"></script>
16 <script src="../js/quicksearch.js" type="text/javascript"
17 charset="utf-8"></script>
18 <script src="../js/darkfish.js" type="text/javascript"
19 charset="utf-8"></script>
25 <div id="file-metadata">
26 <div id="file-list-section" class="section">
27 <h3 class="section-header">In Files</h3>
28 <div class="section-body">
31 <li><a href="../lib/mcollective/discovery_rb.html?TB_iframe=true&height=550&width=785"
32 class="thickbox" title="lib/mcollective/discovery.rb">lib/mcollective/discovery.rb</a></li>
41 <div id="class-metadata">
45 <div id="parent-class-section" class="section">
46 <h3 class="section-header">Parent</h3>
48 <p class="link"><a href="../Object.html">Object</a></p>
53 <!-- Namespace Contents -->
56 <!-- Method Quickref -->
58 <div id="method-list-section" class="section">
59 <h3 class="section-header">Methods</h3>
60 <ul class="link-list">
62 <li><a href="#M000141">::new</a></li>
64 <li><a href="#M000148">#check_capabilities</a></li>
66 <li><a href="#M000147">#ddl</a></li>
68 <li><a href="#M000152">#discover</a></li>
70 <li><a href="#M000146">#discovery_class</a></li>
72 <li><a href="#M000145">#discovery_method</a></li>
74 <li><a href="#M000151">#discovery_timeout</a></li>
76 <li><a href="#M000142">#find_known_methods</a></li>
78 <li><a href="#M000144">#force_direct_mode?</a></li>
80 <li><a href="#M000149">#force_discovery_method_by_filter</a></li>
82 <li><a href="#M000143">#has_method?</a></li>
84 <li><a href="#M000150">#timeout_for_compound_filter</a></li>
90 <!-- Included Modules -->
94 <div id="project-metadata">
97 <div id="fileindex-section" class="section project-section">
98 <h3 class="section-header">Files</h3>
101 <li class="file"><a href="../COPYING.html">COPYING</a></li>
103 <li class="file"><a href="../Gemfile.html">Gemfile</a></li>
105 <li class="file"><a href="../README.html">README</a></li>
107 <li class="file"><a href="../Rakefile.html">Rakefile</a></li>
109 <li class="file"><a href="../etc/client_cfg_dist.html">client.cfg.dist</a></li>
111 <li class="file"><a href="../etc/data-help_erb.html">data-help.erb</a></li>
113 <li class="file"><a href="../etc/discovery-help_erb.html">discovery-help.erb</a></li>
115 <li class="file"><a href="../etc/facts_yaml_dist.html">facts.yaml.dist</a></li>
117 <li class="file"><a href="../etc/metadata-help_erb.html">metadata-help.erb</a></li>
119 <li class="file"><a href="../etc/msg-help_erb.html">msg-help.erb</a></li>
121 <li class="file"><a href="../etc/rpc-help_erb.html">rpc-help.erb</a></li>
123 <li class="file"><a href="../etc/server_cfg_dist.html">server.cfg.dist</a></li>
125 <li class="file"><a href="../etc/ssl/PLACEHOLDER.html">PLACEHOLDER</a></li>
127 <li class="file"><a href="../etc/ssl/clients/PLACEHOLDER.html">PLACEHOLDER</a></li>
129 <li class="file"><a href="../lib/mcollective/generators/templates/action_snippet_erb.html">action_snippet.erb</a></li>
131 <li class="file"><a href="../lib/mcollective/generators/templates/data_input_snippet_erb.html">data_input_snippet.erb</a></li>
133 <li class="file"><a href="../lib/mcollective/generators/templates/ddl_erb.html">ddl.erb</a></li>
135 <li class="file"><a href="../lib/mcollective/generators/templates/plugin_erb.html">plugin.erb</a></li>
137 <li class="file"><a href="../lib/mcollective/locales/en_yml.html">en.yml</a></li>
139 <li class="file"><a href="../mcollective_init.html">mcollective.init</a></li>
145 <div id="classindex-section" class="section project-section">
146 <h3 class="section-header">Class Index
147 <span class="search-toggle"><img src="../images/find.png"
148 height="16" width="16" alt="[+]"
149 title="show/hide quicksearch" /></span></h3>
150 <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
152 <legend>Quicksearch</legend>
153 <input type="text" name="quicksearch" value=""
154 class="quicksearch-field" />
158 <ul class="link-list">
160 <li><a href="../MCollective.html">MCollective</a></li>
162 <li><a href="../MCollective/Agent.html">MCollective::Agent</a></li>
164 <li><a href="../MCollective/Agents.html">MCollective::Agents</a></li>
166 <li><a href="../MCollective/Aggregate.html">MCollective::Aggregate</a></li>
168 <li><a href="../MCollective/Aggregate/Base.html">MCollective::Aggregate::Base</a></li>
170 <li><a href="../MCollective/Aggregate/Result.html">MCollective::Aggregate::Result</a></li>
172 <li><a href="../MCollective/Aggregate/Result/Base.html">MCollective::Aggregate::Result::Base</a></li>
174 <li><a href="../MCollective/Aggregate/Result/CollectionResult.html">MCollective::Aggregate::Result::CollectionResult</a></li>
176 <li><a href="../MCollective/Aggregate/Result/NumericResult.html">MCollective::Aggregate::Result::NumericResult</a></li>
178 <li><a href="../MCollective/Application.html">MCollective::Application</a></li>
180 <li><a href="../MCollective/Applications.html">MCollective::Applications</a></li>
182 <li><a href="../MCollective/Cache.html">MCollective::Cache</a></li>
184 <li><a href="../MCollective/Client.html">MCollective::Client</a></li>
186 <li><a href="../MCollective/CodedError.html">MCollective::CodedError</a></li>
188 <li><a href="../MCollective/Config.html">MCollective::Config</a></li>
190 <li><a href="../MCollective/Connector.html">MCollective::Connector</a></li>
192 <li><a href="../MCollective/Connector/Base.html">MCollective::Connector::Base</a></li>
194 <li><a href="../MCollective/DDL.html">MCollective::DDL</a></li>
196 <li><a href="../MCollective/DDL/AgentDDL.html">MCollective::DDL::AgentDDL</a></li>
198 <li><a href="../MCollective/DDL/Base.html">MCollective::DDL::Base</a></li>
200 <li><a href="../MCollective/DDL/DataDDL.html">MCollective::DDL::DataDDL</a></li>
202 <li><a href="../MCollective/DDL/DiscoveryDDL.html">MCollective::DDL::DiscoveryDDL</a></li>
204 <li><a href="../MCollective/DDL/ValidatorDDL.html">MCollective::DDL::ValidatorDDL</a></li>
206 <li><a href="../MCollective/DDLValidationError.html">MCollective::DDLValidationError</a></li>
208 <li><a href="../MCollective/Data.html">MCollective::Data</a></li>
210 <li><a href="../MCollective/Data/Base.html">MCollective::Data::Base</a></li>
212 <li><a href="../MCollective/Data/Result.html">MCollective::Data::Result</a></li>
214 <li><a href="../MCollective/Discovery.html">MCollective::Discovery</a></li>
216 <li><a href="../MCollective/Facts.html">MCollective::Facts</a></li>
218 <li><a href="../MCollective/Facts/Base.html">MCollective::Facts::Base</a></li>
220 <li><a href="../MCollective/Generators.html">MCollective::Generators</a></li>
222 <li><a href="../MCollective/Generators/AgentGenerator.html">MCollective::Generators::AgentGenerator</a></li>
224 <li><a href="../MCollective/Generators/Base.html">MCollective::Generators::Base</a></li>
226 <li><a href="../MCollective/Generators/DataGenerator.html">MCollective::Generators::DataGenerator</a></li>
228 <li><a href="../MCollective/InvalidRPCData.html">MCollective::InvalidRPCData</a></li>
230 <li><a href="../MCollective/Log.html">MCollective::Log</a></li>
232 <li><a href="../MCollective/Logger.html">MCollective::Logger</a></li>
234 <li><a href="../MCollective/Logger/Base.html">MCollective::Logger::Base</a></li>
236 <li><a href="../MCollective/Logger/Console_logger.html">MCollective::Logger::Console_logger</a></li>
238 <li><a href="../MCollective/Logger/File_logger.html">MCollective::Logger::File_logger</a></li>
240 <li><a href="../MCollective/Logger/Syslog_logger.html">MCollective::Logger::Syslog_logger</a></li>
242 <li><a href="../MCollective/Matcher.html">MCollective::Matcher</a></li>
244 <li><a href="../MCollective/Matcher/Parser.html">MCollective::Matcher::Parser</a></li>
246 <li><a href="../MCollective/Matcher/Scanner.html">MCollective::Matcher::Scanner</a></li>
248 <li><a href="../MCollective/Message.html">MCollective::Message</a></li>
250 <li><a href="../MCollective/MissingRPCData.html">MCollective::MissingRPCData</a></li>
252 <li><a href="../MCollective/MsgDoesNotMatchRequestID.html">MCollective::MsgDoesNotMatchRequestID</a></li>
254 <li><a href="../MCollective/MsgTTLExpired.html">MCollective::MsgTTLExpired</a></li>
256 <li><a href="../MCollective/NotTargettedAtUs.html">MCollective::NotTargettedAtUs</a></li>
258 <li><a href="../MCollective/Optionparser.html">MCollective::Optionparser</a></li>
260 <li><a href="../MCollective/PluginManager.html">MCollective::PluginManager</a></li>
262 <li><a href="../MCollective/PluginPackager.html">MCollective::PluginPackager</a></li>
264 <li><a href="../MCollective/PluginPackager/AgentDefinition.html">MCollective::PluginPackager::AgentDefinition</a></li>
266 <li><a href="../MCollective/PluginPackager/StandardDefinition.html">MCollective::PluginPackager::StandardDefinition</a></li>
268 <li><a href="../MCollective/RPC.html">MCollective::RPC</a></li>
270 <li><a href="../MCollective/RPC/ActionRunner.html">MCollective::RPC::ActionRunner</a></li>
272 <li><a href="../MCollective/RPC/Agent.html">MCollective::RPC::Agent</a></li>
274 <li><a href="../MCollective/RPC/Audit.html">MCollective::RPC::Audit</a></li>
276 <li><a href="../MCollective/RPC/Client.html">MCollective::RPC::Client</a></li>
278 <li><a href="../MCollective/RPC/Helpers.html">MCollective::RPC::Helpers</a></li>
280 <li><a href="../MCollective/RPC/Progress.html">MCollective::RPC::Progress</a></li>
282 <li><a href="../MCollective/RPC/Reply.html">MCollective::RPC::Reply</a></li>
284 <li><a href="../MCollective/RPC/Request.html">MCollective::RPC::Request</a></li>
286 <li><a href="../MCollective/RPC/Result.html">MCollective::RPC::Result</a></li>
288 <li><a href="../MCollective/RPC/Stats.html">MCollective::RPC::Stats</a></li>
290 <li><a href="../MCollective/RPCAborted.html">MCollective::RPCAborted</a></li>
292 <li><a href="../MCollective/RPCError.html">MCollective::RPCError</a></li>
294 <li><a href="../MCollective/Registration.html">MCollective::Registration</a></li>
296 <li><a href="../MCollective/Registration/Base.html">MCollective::Registration::Base</a></li>
298 <li><a href="../MCollective/Runner.html">MCollective::Runner</a></li>
300 <li><a href="../MCollective/RunnerStats.html">MCollective::RunnerStats</a></li>
302 <li><a href="../MCollective/SSL.html">MCollective::SSL</a></li>
304 <li><a href="../MCollective/Security.html">MCollective::Security</a></li>
306 <li><a href="../MCollective/Security/Base.html">MCollective::Security::Base</a></li>
308 <li><a href="../MCollective/SecurityValidationFailed.html">MCollective::SecurityValidationFailed</a></li>
310 <li><a href="../MCollective/Shell.html">MCollective::Shell</a></li>
312 <li><a href="../MCollective/Translatable.html">MCollective::Translatable</a></li>
314 <li><a href="../MCollective/UnixDaemon.html">MCollective::UnixDaemon</a></li>
316 <li><a href="../MCollective/UnknownRPCAction.html">MCollective::UnknownRPCAction</a></li>
318 <li><a href="../MCollective/UnknownRPCError.html">MCollective::UnknownRPCError</a></li>
320 <li><a href="../MCollective/Util.html">MCollective::Util</a></li>
322 <li><a href="../MCollective/Validator.html">MCollective::Validator</a></li>
324 <li><a href="../MCollective/ValidatorError.html">MCollective::ValidatorError</a></li>
326 <li><a href="../MCollective/WindowsDaemon.html">MCollective::WindowsDaemon</a></li>
328 <li><a href="../Array.html">Array</a></li>
330 <li><a href="../Dir.html">Dir</a></li>
332 <li><a href="../Object.html">Object</a></li>
334 <li><a href="../String.html">String</a></li>
336 <li><a href="../Symbol.html">Symbol</a></li>
339 <div id="no-class-search-results" style="display: none;">No matching classes.</div>
346 <div id="documentation">
347 <h1 class="class">MCollective::Discovery</h1>
349 <div id="description">
361 <div id="public-class-method-details" class="method-section section">
362 <h3 class="section-header">Public Class Methods</h3>
365 <div id="new-method" class="method-detail ">
366 <a name="M000141"></a>
368 <div class="method-heading">
370 <span class="method-name">new</span><span
371 class="method-args">(client)</span>
372 <span class="method-click-advice">click to toggle source</span>
376 <div class="method-description">
378 <p class="missing-docs">(Not documented)</p>
382 <div class="method-source-code"
385 <span class="ruby-comment cmt"># File lib/mcollective/discovery.rb, line 3</span>
386 3: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">client</span>)
387 4: <span class="ruby-ivar">@known_methods</span> = <span class="ruby-identifier">find_known_methods</span>
388 5: <span class="ruby-ivar">@default_method</span> = <span class="ruby-constant">Config</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">default_discovery_method</span>
389 6: <span class="ruby-ivar">@client</span> = <span class="ruby-identifier">client</span>
390 7: <span class="ruby-keyword kw">end</span></pre>
401 <div id="public-instance-method-details" class="method-section section">
402 <h3 class="section-header">Public Instance Methods</h3>
405 <div id="check-capabilities-method" class="method-detail ">
406 <a name="M000148"></a>
408 <div class="method-heading">
410 <span class="method-name">check_capabilities</span><span
411 class="method-args">(filter)</span>
412 <span class="method-click-advice">click to toggle source</span>
416 <div class="method-description">
419 <a href="Agent.html">Agent</a> filters are always present no matter what,
420 so we cant raise an error if the capabilities suggest the discovery method
421 cant do agents we just have to rely on the discovery plugin to not do
422 stupid things in the presense of a agent filter
427 <div class="method-source-code"
428 id="check-capabilities-source">
430 <span class="ruby-comment cmt"># File lib/mcollective/discovery.rb, line 62</span>
431 62: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">check_capabilities</span>(<span class="ruby-identifier">filter</span>)
432 63: <span class="ruby-identifier">capabilities</span> = <span class="ruby-identifier">ddl</span>.<span class="ruby-identifier">discovery_interface</span>[<span class="ruby-identifier">:capabilities</span>]
434 65: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">capabilities</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:classes</span>)
435 66: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"Cannot use class filters while using the '%s' discovery method"</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">discovery_method</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">filter</span>[<span class="ruby-value str">"cf_class"</span>].<span class="ruby-identifier">empty?</span>
436 67: <span class="ruby-keyword kw">end</span>
438 69: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">capabilities</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:facts</span>)
439 70: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"Cannot use fact filters while using the '%s' discovery method"</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">discovery_method</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">filter</span>[<span class="ruby-value str">"fact"</span>].<span class="ruby-identifier">empty?</span>
440 71: <span class="ruby-keyword kw">end</span>
442 73: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">capabilities</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:identity</span>)
443 74: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"Cannot use identity filters while using the '%s' discovery method"</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">discovery_method</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">filter</span>[<span class="ruby-value str">"identity"</span>].<span class="ruby-identifier">empty?</span>
444 75: <span class="ruby-keyword kw">end</span>
446 77: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">capabilities</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:compound</span>)
447 78: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"Cannot use compound filters while using the '%s' discovery method"</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">discovery_method</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">filter</span>[<span class="ruby-value str">"compound"</span>].<span class="ruby-identifier">empty?</span>
448 79: <span class="ruby-keyword kw">end</span>
449 80: <span class="ruby-keyword kw">end</span></pre>
458 <div id="ddl-method" class="method-detail ">
459 <a name="M000147"></a>
461 <div class="method-heading">
463 <span class="method-name">ddl</span><span
464 class="method-args">()</span>
465 <span class="method-click-advice">click to toggle source</span>
469 <div class="method-description">
471 <p class="missing-docs">(Not documented)</p>
475 <div class="method-source-code"
478 <span class="ruby-comment cmt"># File lib/mcollective/discovery.rb, line 47</span>
479 47: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ddl</span>
480 48: <span class="ruby-ivar">@ddl</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">DDL</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">discovery_method</span>, <span class="ruby-identifier">:discovery</span>)
482 50: <span class="ruby-comment cmt"># if the discovery method got changed we might have an old DDL cached</span>
483 51: <span class="ruby-comment cmt"># this will detect that and reread the correct DDL from disk</span>
484 52: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@ddl</span>.<span class="ruby-identifier">meta</span>[<span class="ruby-identifier">:name</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">discovery_method</span>
485 53: <span class="ruby-ivar">@ddl</span> = <span class="ruby-constant">DDL</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">discovery_method</span>, <span class="ruby-identifier">:discovery</span>)
486 54: <span class="ruby-keyword kw">end</span>
488 56: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@ddl</span>
489 57: <span class="ruby-keyword kw">end</span></pre>
498 <div id="discover-method" class="method-detail ">
499 <a name="M000152"></a>
501 <div class="method-heading">
503 <span class="method-name">discover</span><span
504 class="method-args">(filter, timeout, limit)</span>
505 <span class="method-click-advice">click to toggle source</span>
509 <div class="method-description">
511 <p class="missing-docs">(Not documented)</p>
515 <div class="method-source-code"
516 id="discover-source">
518 <span class="ruby-comment cmt"># File lib/mcollective/discovery.rb, line 127</span>
519 127: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">discover</span>(<span class="ruby-identifier">filter</span>, <span class="ruby-identifier">timeout</span>, <span class="ruby-identifier">limit</span>)
520 128: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"Limit has to be an integer"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">limit</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Fixnum</span>)
522 130: <span class="ruby-identifier">force_discovery_method_by_filter</span>(<span class="ruby-identifier">filter</span>)
524 132: <span class="ruby-identifier">check_capabilities</span>(<span class="ruby-identifier">filter</span>)
526 134: <span class="ruby-identifier">discovered</span> = <span class="ruby-identifier">discovery_class</span>.<span class="ruby-identifier">discover</span>(<span class="ruby-identifier">filter</span>, <span class="ruby-identifier">discovery_timeout</span>(<span class="ruby-identifier">timeout</span>, <span class="ruby-identifier">filter</span>), <span class="ruby-identifier">limit</span>, <span class="ruby-ivar">@client</span>)
528 136: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">limit</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
529 137: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">discovered</span>[<span class="ruby-value">0</span>,<span class="ruby-identifier">limit</span>]
530 138: <span class="ruby-keyword kw">else</span>
531 139: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">discovered</span>
532 140: <span class="ruby-keyword kw">end</span>
533 141: <span class="ruby-keyword kw">end</span></pre>
542 <div id="discovery-class-method" class="method-detail ">
543 <a name="M000146"></a>
545 <div class="method-heading">
547 <span class="method-name">discovery_class</span><span
548 class="method-args">()</span>
549 <span class="method-click-advice">click to toggle source</span>
553 <div class="method-description">
555 <p class="missing-docs">(Not documented)</p>
559 <div class="method-source-code"
560 id="discovery-class-source">
562 <span class="ruby-comment cmt"># File lib/mcollective/discovery.rb, line 39</span>
563 39: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">discovery_class</span>
564 40: <span class="ruby-identifier">method</span> = <span class="ruby-identifier">discovery_method</span>.<span class="ruby-identifier">capitalize</span>
566 42: <span class="ruby-constant">PluginManager</span>.<span class="ruby-identifier">loadclass</span>(<span class="ruby-node">"MCollective::Discovery::#{method}"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">const_defined?</span>(<span class="ruby-identifier">method</span>)
568 44: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">method</span>)
569 45: <span class="ruby-keyword kw">end</span></pre>
578 <div id="discovery-method-method" class="method-detail ">
579 <a name="M000145"></a>
581 <div class="method-heading">
583 <span class="method-name">discovery_method</span><span
584 class="method-args">()</span>
585 <span class="method-click-advice">click to toggle source</span>
589 <div class="method-description">
591 <p class="missing-docs">(Not documented)</p>
595 <div class="method-source-code"
596 id="discovery-method-source">
598 <span class="ruby-comment cmt"># File lib/mcollective/discovery.rb, line 21</span>
599 21: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">discovery_method</span>
600 22: <span class="ruby-identifier">method</span> = <span class="ruby-value str">"mc"</span>
602 24: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:discovery_method</span>]
603 25: <span class="ruby-identifier">method</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:discovery_method</span>]
604 26: <span class="ruby-keyword kw">else</span>
605 27: <span class="ruby-identifier">method</span> = <span class="ruby-ivar">@default_method</span>
606 28: <span class="ruby-keyword kw">end</span>
608 30: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"Unknown discovery method %s"</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">method</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">has_method?</span>(<span class="ruby-identifier">method</span>)
610 32: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">method</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"mc"</span>
611 33: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"Custom discovery methods require direct addressing mode"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">Config</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">direct_addressing</span>
612 34: <span class="ruby-keyword kw">end</span>
614 36: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">method</span>
615 37: <span class="ruby-keyword kw">end</span></pre>
624 <div id="discovery-timeout-method" class="method-detail ">
625 <a name="M000151"></a>
627 <div class="method-heading">
629 <span class="method-name">discovery_timeout</span><span
630 class="method-args">(timeout, filter)</span>
631 <span class="method-click-advice">click to toggle source</span>
635 <div class="method-description">
637 <p class="missing-docs">(Not documented)</p>
641 <div class="method-source-code"
642 id="discovery-timeout-source">
644 <span class="ruby-comment cmt"># File lib/mcollective/discovery.rb, line 117</span>
645 117: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">discovery_timeout</span>(<span class="ruby-identifier">timeout</span>, <span class="ruby-identifier">filter</span>)
646 118: <span class="ruby-identifier">timeout</span> = <span class="ruby-identifier">ddl</span>.<span class="ruby-identifier">meta</span>[<span class="ruby-identifier">:timeout</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">timeout</span>
648 120: <span class="ruby-keyword kw">unless</span> (<span class="ruby-identifier">filter</span>[<span class="ruby-value str">"compound"</span>] <span class="ruby-operator">&&</span> <span class="ruby-identifier">filter</span>[<span class="ruby-value str">"compound"</span>].<span class="ruby-identifier">empty?</span>)
649 121: <span class="ruby-identifier">timeout</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">timeout_for_compound_filter</span>(<span class="ruby-identifier">filter</span>[<span class="ruby-value str">"compound"</span>])
650 122: <span class="ruby-keyword kw">else</span>
651 123: <span class="ruby-identifier">timeout</span>
652 124: <span class="ruby-keyword kw">end</span>
653 125: <span class="ruby-keyword kw">end</span></pre>
662 <div id="find-known-methods-method" class="method-detail ">
663 <a name="M000142"></a>
665 <div class="method-heading">
667 <span class="method-name">find_known_methods</span><span
668 class="method-args">()</span>
669 <span class="method-click-advice">click to toggle source</span>
673 <div class="method-description">
675 <p class="missing-docs">(Not documented)</p>
679 <div class="method-source-code"
680 id="find-known-methods-source">
682 <span class="ruby-comment cmt"># File lib/mcollective/discovery.rb, line 9</span>
683 9: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_known_methods</span>
684 10: <span class="ruby-constant">PluginManager</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value str">"discovery"</span>)
685 11: <span class="ruby-keyword kw">end</span></pre>
694 <div id="force-direct-mode--method" class="method-detail ">
695 <a name="M000144"></a>
697 <div class="method-heading">
699 <span class="method-name">force_direct_mode?</span><span
700 class="method-args">()</span>
701 <span class="method-click-advice">click to toggle source</span>
705 <div class="method-description">
707 <p class="missing-docs">(Not documented)</p>
711 <div class="method-source-code"
712 id="force-direct-mode--source">
714 <span class="ruby-comment cmt"># File lib/mcollective/discovery.rb, line 17</span>
715 17: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">force_direct_mode?</span>
716 18: <span class="ruby-identifier">discovery_method</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">"mc"</span>
717 19: <span class="ruby-keyword kw">end</span></pre>
726 <div id="force-discovery-method-by-filter-method" class="method-detail ">
727 <a name="M000149"></a>
729 <div class="method-heading">
731 <span class="method-name">force_discovery_method_by_filter</span><span
732 class="method-args">(filter)</span>
733 <span class="method-click-advice">click to toggle source</span>
737 <div class="method-description">
740 checks if compound filters are used and then forces the ‘mc’
746 <div class="method-source-code"
747 id="force-discovery-method-by-filter-source">
749 <span class="ruby-comment cmt"># File lib/mcollective/discovery.rb, line 83</span>
750 83: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">force_discovery_method_by_filter</span>(<span class="ruby-identifier">filter</span>)
751 84: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">discovery_method</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"mc"</span>
752 85: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">filter</span>[<span class="ruby-value str">"compound"</span>].<span class="ruby-identifier">empty?</span>
753 86: <span class="ruby-constant">Log</span>.<span class="ruby-identifier">info</span> <span class="ruby-value str">"Switching to mc discovery method because compound filters are used"</span>
754 87: <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:discovery_method</span>] = <span class="ruby-value str">"mc"</span>
756 89: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
757 90: <span class="ruby-keyword kw">end</span>
758 91: <span class="ruby-keyword kw">end</span>
760 93: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
761 94: <span class="ruby-keyword kw">end</span></pre>
770 <div id="has-method--method" class="method-detail ">
771 <a name="M000143"></a>
773 <div class="method-heading">
775 <span class="method-name">has_method?</span><span
776 class="method-args">(method)</span>
777 <span class="method-click-advice">click to toggle source</span>
781 <div class="method-description">
783 <p class="missing-docs">(Not documented)</p>
787 <div class="method-source-code"
788 id="has-method--source">
790 <span class="ruby-comment cmt"># File lib/mcollective/discovery.rb, line 13</span>
791 13: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_method?</span>(<span class="ruby-identifier">method</span>)
792 14: <span class="ruby-ivar">@known_methods</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">method</span>)
793 15: <span class="ruby-keyword kw">end</span></pre>
802 <div id="timeout-for-compound-filter-method" class="method-detail ">
803 <a name="M000150"></a>
805 <div class="method-heading">
807 <span class="method-name">timeout_for_compound_filter</span><span
808 class="method-args">(compound_filter)</span>
809 <span class="method-click-advice">click to toggle source</span>
813 <div class="method-description">
816 if a compound filter is specified and it has any function then we read the
817 <a href="DDL.html">DDL</a> for each of those plugins and sum up the timeout
818 declared in the <a href="DDL.html">DDL</a>
823 <div class="method-source-code"
824 id="timeout-for-compound-filter-source">
826 <span class="ruby-comment cmt"># File lib/mcollective/discovery.rb, line 99</span>
827 99: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">timeout_for_compound_filter</span>(<span class="ruby-identifier">compound_filter</span>)
828 100: <span class="ruby-keyword kw">return</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">compound_filter</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">compound_filter</span>.<span class="ruby-identifier">empty?</span>
830 102: <span class="ruby-identifier">timeout</span> = <span class="ruby-value">0</span>
832 104: <span class="ruby-identifier">compound_filter</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">filter</span><span class="ruby-operator">|</span>
833 105: <span class="ruby-identifier">filter</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">statement</span><span class="ruby-operator">|</span>
834 106: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">statement</span>[<span class="ruby-value str">"fstatement"</span>]
835 107: <span class="ruby-identifier">pluginname</span> = <span class="ruby-constant">Data</span>.<span class="ruby-identifier">pluginname</span>(<span class="ruby-identifier">statement</span>[<span class="ruby-value str">"fstatement"</span>][<span class="ruby-value str">"name"</span>])
836 108: <span class="ruby-identifier">ddl</span> = <span class="ruby-constant">DDL</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pluginname</span>, <span class="ruby-identifier">:data</span>)
837 109: <span class="ruby-identifier">timeout</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">ddl</span>.<span class="ruby-identifier">meta</span>[<span class="ruby-identifier">:timeout</span>]
838 110: <span class="ruby-keyword kw">end</span>
839 111: <span class="ruby-keyword kw">end</span>
840 112: <span class="ruby-keyword kw">end</span>
842 114: <span class="ruby-identifier">timeout</span>
843 115: <span class="ruby-keyword kw">end</span></pre>
858 <div id="rdoc-debugging-section-dump" class="debugging-section">
860 <p>Disabled; run with --debug to generate this.</p>
864 <div id="validator-badges">
865 <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
866 <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
867 Rdoc Generator</a> 1.1.6</small>.</p>