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::Generators::AgentGenerator</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/generators/agent_generator_rb.html?TB_iframe=true&height=550&width=785"
32 class="thickbox" title="lib/mcollective/generators/agent_generator.rb">lib/mcollective/generators/agent_generator.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">Base</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="#M000245">::new</a></li>
64 <li><a href="#M000248">#action_help</a></li>
66 <li><a href="#M000246">#create_ddl</a></li>
68 <li><a href="#M000247">#create_plugin_content</a></li>
74 <!-- Included Modules -->
78 <div id="project-metadata">
81 <div id="fileindex-section" class="section project-section">
82 <h3 class="section-header">Files</h3>
85 <li class="file"><a href="../../COPYING.html">COPYING</a></li>
87 <li class="file"><a href="../../Gemfile.html">Gemfile</a></li>
89 <li class="file"><a href="../../README.html">README</a></li>
91 <li class="file"><a href="../../Rakefile.html">Rakefile</a></li>
93 <li class="file"><a href="../../etc/client_cfg_dist.html">client.cfg.dist</a></li>
95 <li class="file"><a href="../../etc/data-help_erb.html">data-help.erb</a></li>
97 <li class="file"><a href="../../etc/discovery-help_erb.html">discovery-help.erb</a></li>
99 <li class="file"><a href="../../etc/facts_yaml_dist.html">facts.yaml.dist</a></li>
101 <li class="file"><a href="../../etc/metadata-help_erb.html">metadata-help.erb</a></li>
103 <li class="file"><a href="../../etc/msg-help_erb.html">msg-help.erb</a></li>
105 <li class="file"><a href="../../etc/rpc-help_erb.html">rpc-help.erb</a></li>
107 <li class="file"><a href="../../etc/server_cfg_dist.html">server.cfg.dist</a></li>
109 <li class="file"><a href="../../etc/ssl/PLACEHOLDER.html">PLACEHOLDER</a></li>
111 <li class="file"><a href="../../etc/ssl/clients/PLACEHOLDER.html">PLACEHOLDER</a></li>
113 <li class="file"><a href="../../lib/mcollective/generators/templates/action_snippet_erb.html">action_snippet.erb</a></li>
115 <li class="file"><a href="../../lib/mcollective/generators/templates/data_input_snippet_erb.html">data_input_snippet.erb</a></li>
117 <li class="file"><a href="../../lib/mcollective/generators/templates/ddl_erb.html">ddl.erb</a></li>
119 <li class="file"><a href="../../lib/mcollective/generators/templates/plugin_erb.html">plugin.erb</a></li>
121 <li class="file"><a href="../../lib/mcollective/locales/en_yml.html">en.yml</a></li>
123 <li class="file"><a href="../../mcollective_init.html">mcollective.init</a></li>
129 <div id="classindex-section" class="section project-section">
130 <h3 class="section-header">Class Index
131 <span class="search-toggle"><img src="../../images/find.png"
132 height="16" width="16" alt="[+]"
133 title="show/hide quicksearch" /></span></h3>
134 <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
136 <legend>Quicksearch</legend>
137 <input type="text" name="quicksearch" value=""
138 class="quicksearch-field" />
142 <ul class="link-list">
144 <li><a href="../../MCollective.html">MCollective</a></li>
146 <li><a href="../../MCollective/Agent.html">MCollective::Agent</a></li>
148 <li><a href="../../MCollective/Agents.html">MCollective::Agents</a></li>
150 <li><a href="../../MCollective/Aggregate.html">MCollective::Aggregate</a></li>
152 <li><a href="../../MCollective/Aggregate/Base.html">MCollective::Aggregate::Base</a></li>
154 <li><a href="../../MCollective/Aggregate/Result.html">MCollective::Aggregate::Result</a></li>
156 <li><a href="../../MCollective/Aggregate/Result/Base.html">MCollective::Aggregate::Result::Base</a></li>
158 <li><a href="../../MCollective/Aggregate/Result/CollectionResult.html">MCollective::Aggregate::Result::CollectionResult</a></li>
160 <li><a href="../../MCollective/Aggregate/Result/NumericResult.html">MCollective::Aggregate::Result::NumericResult</a></li>
162 <li><a href="../../MCollective/Application.html">MCollective::Application</a></li>
164 <li><a href="../../MCollective/Applications.html">MCollective::Applications</a></li>
166 <li><a href="../../MCollective/Cache.html">MCollective::Cache</a></li>
168 <li><a href="../../MCollective/Client.html">MCollective::Client</a></li>
170 <li><a href="../../MCollective/CodedError.html">MCollective::CodedError</a></li>
172 <li><a href="../../MCollective/Config.html">MCollective::Config</a></li>
174 <li><a href="../../MCollective/Connector.html">MCollective::Connector</a></li>
176 <li><a href="../../MCollective/Connector/Base.html">MCollective::Connector::Base</a></li>
178 <li><a href="../../MCollective/DDL.html">MCollective::DDL</a></li>
180 <li><a href="../../MCollective/DDL/AgentDDL.html">MCollective::DDL::AgentDDL</a></li>
182 <li><a href="../../MCollective/DDL/Base.html">MCollective::DDL::Base</a></li>
184 <li><a href="../../MCollective/DDL/DataDDL.html">MCollective::DDL::DataDDL</a></li>
186 <li><a href="../../MCollective/DDL/DiscoveryDDL.html">MCollective::DDL::DiscoveryDDL</a></li>
188 <li><a href="../../MCollective/DDL/ValidatorDDL.html">MCollective::DDL::ValidatorDDL</a></li>
190 <li><a href="../../MCollective/DDLValidationError.html">MCollective::DDLValidationError</a></li>
192 <li><a href="../../MCollective/Data.html">MCollective::Data</a></li>
194 <li><a href="../../MCollective/Data/Base.html">MCollective::Data::Base</a></li>
196 <li><a href="../../MCollective/Data/Result.html">MCollective::Data::Result</a></li>
198 <li><a href="../../MCollective/Discovery.html">MCollective::Discovery</a></li>
200 <li><a href="../../MCollective/Facts.html">MCollective::Facts</a></li>
202 <li><a href="../../MCollective/Facts/Base.html">MCollective::Facts::Base</a></li>
204 <li><a href="../../MCollective/Generators.html">MCollective::Generators</a></li>
206 <li><a href="../../MCollective/Generators/AgentGenerator.html">MCollective::Generators::AgentGenerator</a></li>
208 <li><a href="../../MCollective/Generators/Base.html">MCollective::Generators::Base</a></li>
210 <li><a href="../../MCollective/Generators/DataGenerator.html">MCollective::Generators::DataGenerator</a></li>
212 <li><a href="../../MCollective/InvalidRPCData.html">MCollective::InvalidRPCData</a></li>
214 <li><a href="../../MCollective/Log.html">MCollective::Log</a></li>
216 <li><a href="../../MCollective/Logger.html">MCollective::Logger</a></li>
218 <li><a href="../../MCollective/Logger/Base.html">MCollective::Logger::Base</a></li>
220 <li><a href="../../MCollective/Logger/Console_logger.html">MCollective::Logger::Console_logger</a></li>
222 <li><a href="../../MCollective/Logger/File_logger.html">MCollective::Logger::File_logger</a></li>
224 <li><a href="../../MCollective/Logger/Syslog_logger.html">MCollective::Logger::Syslog_logger</a></li>
226 <li><a href="../../MCollective/Matcher.html">MCollective::Matcher</a></li>
228 <li><a href="../../MCollective/Matcher/Parser.html">MCollective::Matcher::Parser</a></li>
230 <li><a href="../../MCollective/Matcher/Scanner.html">MCollective::Matcher::Scanner</a></li>
232 <li><a href="../../MCollective/Message.html">MCollective::Message</a></li>
234 <li><a href="../../MCollective/MissingRPCData.html">MCollective::MissingRPCData</a></li>
236 <li><a href="../../MCollective/MsgDoesNotMatchRequestID.html">MCollective::MsgDoesNotMatchRequestID</a></li>
238 <li><a href="../../MCollective/MsgTTLExpired.html">MCollective::MsgTTLExpired</a></li>
240 <li><a href="../../MCollective/NotTargettedAtUs.html">MCollective::NotTargettedAtUs</a></li>
242 <li><a href="../../MCollective/Optionparser.html">MCollective::Optionparser</a></li>
244 <li><a href="../../MCollective/PluginManager.html">MCollective::PluginManager</a></li>
246 <li><a href="../../MCollective/PluginPackager.html">MCollective::PluginPackager</a></li>
248 <li><a href="../../MCollective/PluginPackager/AgentDefinition.html">MCollective::PluginPackager::AgentDefinition</a></li>
250 <li><a href="../../MCollective/PluginPackager/StandardDefinition.html">MCollective::PluginPackager::StandardDefinition</a></li>
252 <li><a href="../../MCollective/RPC.html">MCollective::RPC</a></li>
254 <li><a href="../../MCollective/RPC/ActionRunner.html">MCollective::RPC::ActionRunner</a></li>
256 <li><a href="../../MCollective/RPC/Agent.html">MCollective::RPC::Agent</a></li>
258 <li><a href="../../MCollective/RPC/Audit.html">MCollective::RPC::Audit</a></li>
260 <li><a href="../../MCollective/RPC/Client.html">MCollective::RPC::Client</a></li>
262 <li><a href="../../MCollective/RPC/Helpers.html">MCollective::RPC::Helpers</a></li>
264 <li><a href="../../MCollective/RPC/Progress.html">MCollective::RPC::Progress</a></li>
266 <li><a href="../../MCollective/RPC/Reply.html">MCollective::RPC::Reply</a></li>
268 <li><a href="../../MCollective/RPC/Request.html">MCollective::RPC::Request</a></li>
270 <li><a href="../../MCollective/RPC/Result.html">MCollective::RPC::Result</a></li>
272 <li><a href="../../MCollective/RPC/Stats.html">MCollective::RPC::Stats</a></li>
274 <li><a href="../../MCollective/RPCAborted.html">MCollective::RPCAborted</a></li>
276 <li><a href="../../MCollective/RPCError.html">MCollective::RPCError</a></li>
278 <li><a href="../../MCollective/Registration.html">MCollective::Registration</a></li>
280 <li><a href="../../MCollective/Registration/Base.html">MCollective::Registration::Base</a></li>
282 <li><a href="../../MCollective/Runner.html">MCollective::Runner</a></li>
284 <li><a href="../../MCollective/RunnerStats.html">MCollective::RunnerStats</a></li>
286 <li><a href="../../MCollective/SSL.html">MCollective::SSL</a></li>
288 <li><a href="../../MCollective/Security.html">MCollective::Security</a></li>
290 <li><a href="../../MCollective/Security/Base.html">MCollective::Security::Base</a></li>
292 <li><a href="../../MCollective/SecurityValidationFailed.html">MCollective::SecurityValidationFailed</a></li>
294 <li><a href="../../MCollective/Shell.html">MCollective::Shell</a></li>
296 <li><a href="../../MCollective/Translatable.html">MCollective::Translatable</a></li>
298 <li><a href="../../MCollective/UnixDaemon.html">MCollective::UnixDaemon</a></li>
300 <li><a href="../../MCollective/UnknownRPCAction.html">MCollective::UnknownRPCAction</a></li>
302 <li><a href="../../MCollective/UnknownRPCError.html">MCollective::UnknownRPCError</a></li>
304 <li><a href="../../MCollective/Util.html">MCollective::Util</a></li>
306 <li><a href="../../MCollective/Validator.html">MCollective::Validator</a></li>
308 <li><a href="../../MCollective/ValidatorError.html">MCollective::ValidatorError</a></li>
310 <li><a href="../../MCollective/WindowsDaemon.html">MCollective::WindowsDaemon</a></li>
312 <li><a href="../../Array.html">Array</a></li>
314 <li><a href="../../Dir.html">Dir</a></li>
316 <li><a href="../../Object.html">Object</a></li>
318 <li><a href="../../String.html">String</a></li>
320 <li><a href="../../Symbol.html">Symbol</a></li>
323 <div id="no-class-search-results" style="display: none;">No matching classes.</div>
330 <div id="documentation">
331 <h1 class="class">MCollective::Generators::AgentGenerator</h1>
333 <div id="description">
342 <div id="attribute-method-details" class="method-section section">
343 <h3 class="section-header">Attributes</h3>
346 <div id="ddl-attribute-method" class="method-detail">
351 <div class="method-heading attribute-method-heading">
352 <span class="method-name">ddl</span><span
353 class="attribute-access-type">[RW]</span>
356 <div class="method-description">
358 <p class="missing-docs">(Not documented)</p>
363 <div id="content-attribute-method" class="method-detail">
364 <a name="content"></a>
366 <a name="content="></a>
368 <div class="method-heading attribute-method-heading">
369 <span class="method-name">content</span><span
370 class="attribute-access-type">[RW]</span>
373 <div class="method-description">
375 <p class="missing-docs">(Not documented)</p>
385 <div id="public-class-method-details" class="method-section section">
386 <h3 class="section-header">Public Class Methods</h3>
389 <div id="new-method" class="method-detail ">
390 <a name="M000245"></a>
392 <div class="method-heading">
394 <span class="method-name">new</span><span
395 class="method-args">(plugin_name, actions = [], name = nil, description = nil, author = nil , license = nil, version = nil, url = nil, timeout = nil)</span>
396 <span class="method-click-advice">click to toggle source</span>
400 <div class="method-description">
402 <p class="missing-docs">(Not documented)</p>
406 <div class="method-source-code"
409 <span class="ruby-comment cmt"># File lib/mcollective/generators/agent_generator.rb, line 7</span>
410 7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">plugin_name</span>, <span class="ruby-identifier">actions</span> = [], <span class="ruby-identifier">name</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">description</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">author</span> = <span class="ruby-keyword kw">nil</span> ,
411 8: <span class="ruby-identifier">license</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">version</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">url</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">timeout</span> = <span class="ruby-keyword kw">nil</span>)
413 10: <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">description</span>, <span class="ruby-identifier">author</span>, <span class="ruby-identifier">license</span>, <span class="ruby-identifier">version</span>, <span class="ruby-identifier">url</span>, <span class="ruby-identifier">timeout</span>)
414 11: <span class="ruby-ivar">@plugin_name</span> = <span class="ruby-identifier">plugin_name</span>
415 12: <span class="ruby-ivar">@actions</span> = <span class="ruby-identifier">actions</span> <span class="ruby-operator">||</span> []
416 13: <span class="ruby-ivar">@ddl</span> = <span class="ruby-identifier">create_ddl</span>
417 14: <span class="ruby-ivar">@mod_name</span> = <span class="ruby-value str">"Agent"</span>
418 15: <span class="ruby-ivar">@pclass</span> = <span class="ruby-value str">"RPC::Agent"</span>
419 16: <span class="ruby-ivar">@content</span> = <span class="ruby-identifier">create_plugin_content</span>
420 17: <span class="ruby-ivar">@plugin</span> = <span class="ruby-identifier">create_plugin_string</span>
421 18: <span class="ruby-identifier">write_plugins</span>
422 19: <span class="ruby-keyword kw">end</span></pre>
433 <div id="public-instance-method-details" class="method-section section">
434 <h3 class="section-header">Public Instance Methods</h3>
437 <div id="action-help-method" class="method-detail ">
438 <a name="M000248"></a>
440 <div class="method-heading">
442 <span class="method-name">action_help</span><span
443 class="method-args">()</span>
444 <span class="method-click-advice">click to toggle source</span>
448 <div class="method-description">
450 <p class="missing-docs">(Not documented)</p>
454 <div class="method-source-code"
455 id="action-help-source">
457 <span class="ruby-comment cmt"># File lib/mcollective/generators/agent_generator.rb, line 45</span>
458 45: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">action_help</span>
459 46: <span class="ruby-identifier">action_snippet</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>), <span class="ruby-value str">"templates"</span>, <span class="ruby-value str">"action_snippet.erb"</span>))
460 47: <span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">action_snippet</span>).<span class="ruby-identifier">result</span>
461 48: <span class="ruby-keyword kw">end</span></pre>
470 <div id="create-ddl-method" class="method-detail ">
471 <a name="M000246"></a>
473 <div class="method-heading">
475 <span class="method-name">create_ddl</span><span
476 class="method-args">()</span>
477 <span class="method-click-advice">click to toggle source</span>
481 <div class="method-description">
483 <p class="missing-docs">(Not documented)</p>
487 <div class="method-source-code"
488 id="create-ddl-source">
490 <span class="ruby-comment cmt"># File lib/mcollective/generators/agent_generator.rb, line 21</span>
491 21: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_ddl</span>
492 22: <span class="ruby-identifier">action_text</span> = <span class="ruby-value str">""</span>
493 23: <span class="ruby-ivar">@actions</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">action</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
494 24: <span class="ruby-identifier">action_text</span> <span class="ruby-operator">+=</span> <span class="ruby-node">"action \"#{action}\", :description => \"%ACTIONDESCRIPTION%\" do\n"</span>
495 25: <span class="ruby-identifier">action_text</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">action_help</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
496 26: <span class="ruby-identifier">action_text</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">"end\n"</span>
497 27: <span class="ruby-identifier">action_text</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">"\n"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@actions</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> (<span class="ruby-identifier">i</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>)
498 28: <span class="ruby-keyword kw">end</span>
499 29: <span class="ruby-comment cmt"># Use inherited method to create metadata part of the ddl</span>
500 30: <span class="ruby-identifier">create_metadata_string</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">action_text</span>
501 31: <span class="ruby-keyword kw">end</span></pre>
510 <div id="create-plugin-content-method" class="method-detail ">
511 <a name="M000247"></a>
513 <div class="method-heading">
515 <span class="method-name">create_plugin_content</span><span
516 class="method-args">()</span>
517 <span class="method-click-advice">click to toggle source</span>
521 <div class="method-description">
523 <p class="missing-docs">(Not documented)</p>
527 <div class="method-source-code"
528 id="create-plugin-content-source">
530 <span class="ruby-comment cmt"># File lib/mcollective/generators/agent_generator.rb, line 33</span>
531 33: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_plugin_content</span>
532 34: <span class="ruby-identifier">content_text</span> = <span class="ruby-value str">""</span>
534 36: <span class="ruby-comment cmt"># Add actions to agent file</span>
535 37: <span class="ruby-ivar">@actions</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">action</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
536 38: <span class="ruby-identifier">content_text</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">"%6s%s"</span> <span class="ruby-operator">%</span> [<span class="ruby-value str">" "</span>, <span class="ruby-node">"action \"#{action}\" do\n"</span>]
537 39: <span class="ruby-identifier">content_text</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">"%6s%s"</span> <span class="ruby-operator">%</span> [<span class="ruby-value str">" "</span>, <span class="ruby-value str">"end\n"</span>]
538 40: <span class="ruby-identifier">content_text</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">"\n"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@actions</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> (<span class="ruby-identifier">i</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>)
539 41: <span class="ruby-keyword kw">end</span>
540 42: <span class="ruby-identifier">content_text</span>
541 43: <span class="ruby-keyword kw">end</span></pre>
556 <div id="rdoc-debugging-section-dump" class="debugging-section">
558 <p>Disabled; run with --debug to generate this.</p>
562 <div id="validator-badges">
563 <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
564 <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
565 Rdoc Generator</a> 1.1.6</small>.</p>