Update version according to OSCI-856
[packages/precise/mcollective.git] / doc / MCollective / DDL / Base.html
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">
5 <head>
6         <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7
8         <title>Class: MCollective::DDL::Base</title>
9
10         <link rel="stylesheet" href="../../rdoc.css" type="text/css" media="screen" />
11
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>
20
21 </head>
22 <body class="class">
23
24         <div id="metadata">
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">
29                                         <ul>
30                                         
31                                                 <li><a href="../../lib/mcollective/ddl/base_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
32                                                         class="thickbox" title="lib/mcollective/ddl/base.rb">lib/mcollective/ddl/base.rb</a></li>
33                                         
34                                         </ul>
35                                 </div>
36                         </div>
37
38                         
39                 </div>
40
41                 <div id="class-metadata">
42
43                         <!-- Parent Class -->
44                         
45                         <div id="parent-class-section" class="section">
46                                 <h3 class="section-header">Parent</h3>
47                                 
48                                 <p class="link"><a href="../../Object.html">Object</a></p>
49                                 
50                         </div>
51                         
52
53                         <!-- Namespace Contents -->
54                         
55
56                         <!-- Method Quickref -->
57                         
58                         <div id="method-list-section" class="section">
59                                 <h3 class="section-header">Methods</h3>
60                                 <ul class="link-list">
61                                         
62                                         <li><a href="#M000278">::new</a></li>
63                                         
64                                         <li><a href="#M000283">#findddlfile</a></li>
65                                         
66                                         <li><a href="#M000279">#help</a></li>
67                                         
68                                         <li><a href="#M000288">#input</a></li>
69                                         
70                                         <li><a href="#M000282">#loadddlfile</a></li>
71                                         
72                                         <li><a href="#M000292">#metadata</a></li>
73                                         
74                                         <li><a href="#M000290">#output</a></li>
75                                         
76                                         <li><a href="#M000291">#requires</a></li>
77                                         
78                                         <li><a href="#M000281">#template_for_plugintype</a></li>
79                                         
80                                         <li><a href="#M000280">#usage</a></li>
81                                         
82                                         <li><a href="#M000285">#validate_input_argument</a></li>
83                                         
84                                         <li><a href="#M000284">#validate_requirements</a></li>
85                                         
86                                 </ul>
87                         </div>
88                         
89
90                         <!-- Included Modules -->
91                         
92                         <div id="includes-section" class="section">
93                                 <h3 class="section-header">Included Modules</h3>
94                                 <ul class="link-list">
95                                 
96                                 
97                                         <li><a class="include" href="../Validator.html">MCollective::Validator</a></li>
98                                 
99                                 
100                                 </ul>
101                         </div>
102                         
103                 </div>
104
105                 <div id="project-metadata">
106                         
107                         
108                         <div id="fileindex-section" class="section project-section">
109                                 <h3 class="section-header">Files</h3>
110                                 <ul>
111                                 
112                                         <li class="file"><a href="../../COPYING.html">COPYING</a></li>
113                                 
114                                         <li class="file"><a href="../../Gemfile.html">Gemfile</a></li>
115                                 
116                                         <li class="file"><a href="../../README.html">README</a></li>
117                                 
118                                         <li class="file"><a href="../../Rakefile.html">Rakefile</a></li>
119                                 
120                                         <li class="file"><a href="../../etc/client_cfg_dist.html">client.cfg.dist</a></li>
121                                 
122                                         <li class="file"><a href="../../etc/data-help_erb.html">data-help.erb</a></li>
123                                 
124                                         <li class="file"><a href="../../etc/discovery-help_erb.html">discovery-help.erb</a></li>
125                                 
126                                         <li class="file"><a href="../../etc/facts_yaml_dist.html">facts.yaml.dist</a></li>
127                                 
128                                         <li class="file"><a href="../../etc/metadata-help_erb.html">metadata-help.erb</a></li>
129                                 
130                                         <li class="file"><a href="../../etc/msg-help_erb.html">msg-help.erb</a></li>
131                                 
132                                         <li class="file"><a href="../../etc/rpc-help_erb.html">rpc-help.erb</a></li>
133                                 
134                                         <li class="file"><a href="../../etc/server_cfg_dist.html">server.cfg.dist</a></li>
135                                 
136                                         <li class="file"><a href="../../etc/ssl/PLACEHOLDER.html">PLACEHOLDER</a></li>
137                                 
138                                         <li class="file"><a href="../../etc/ssl/clients/PLACEHOLDER.html">PLACEHOLDER</a></li>
139                                 
140                                         <li class="file"><a href="../../lib/mcollective/generators/templates/action_snippet_erb.html">action_snippet.erb</a></li>
141                                 
142                                         <li class="file"><a href="../../lib/mcollective/generators/templates/data_input_snippet_erb.html">data_input_snippet.erb</a></li>
143                                 
144                                         <li class="file"><a href="../../lib/mcollective/generators/templates/ddl_erb.html">ddl.erb</a></li>
145                                 
146                                         <li class="file"><a href="../../lib/mcollective/generators/templates/plugin_erb.html">plugin.erb</a></li>
147                                 
148                                         <li class="file"><a href="../../lib/mcollective/locales/en_yml.html">en.yml</a></li>
149                                 
150                                         <li class="file"><a href="../../mcollective_init.html">mcollective.init</a></li>
151                                 
152                                 </ul>
153                         </div>
154                         
155
156                         <div id="classindex-section" class="section project-section">
157                                 <h3 class="section-header">Class Index
158                                         <span class="search-toggle"><img src="../../images/find.png"
159                                                 height="16" width="16" alt="[+]"
160                                                 title="show/hide quicksearch" /></span></h3>
161                                 <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
162                                 <fieldset>
163                                         <legend>Quicksearch</legend>
164                                         <input type="text" name="quicksearch" value=""
165                                                 class="quicksearch-field" />
166                                 </fieldset>
167                                 </form>
168
169                                 <ul class="link-list">
170                                 
171                                         <li><a href="../../MCollective.html">MCollective</a></li>
172                                 
173                                         <li><a href="../../MCollective/Agent.html">MCollective::Agent</a></li>
174                                 
175                                         <li><a href="../../MCollective/Agents.html">MCollective::Agents</a></li>
176                                 
177                                         <li><a href="../../MCollective/Aggregate.html">MCollective::Aggregate</a></li>
178                                 
179                                         <li><a href="../../MCollective/Aggregate/Base.html">MCollective::Aggregate::Base</a></li>
180                                 
181                                         <li><a href="../../MCollective/Aggregate/Result.html">MCollective::Aggregate::Result</a></li>
182                                 
183                                         <li><a href="../../MCollective/Aggregate/Result/Base.html">MCollective::Aggregate::Result::Base</a></li>
184                                 
185                                         <li><a href="../../MCollective/Aggregate/Result/CollectionResult.html">MCollective::Aggregate::Result::CollectionResult</a></li>
186                                 
187                                         <li><a href="../../MCollective/Aggregate/Result/NumericResult.html">MCollective::Aggregate::Result::NumericResult</a></li>
188                                 
189                                         <li><a href="../../MCollective/Application.html">MCollective::Application</a></li>
190                                 
191                                         <li><a href="../../MCollective/Applications.html">MCollective::Applications</a></li>
192                                 
193                                         <li><a href="../../MCollective/Cache.html">MCollective::Cache</a></li>
194                                 
195                                         <li><a href="../../MCollective/Client.html">MCollective::Client</a></li>
196                                 
197                                         <li><a href="../../MCollective/CodedError.html">MCollective::CodedError</a></li>
198                                 
199                                         <li><a href="../../MCollective/Config.html">MCollective::Config</a></li>
200                                 
201                                         <li><a href="../../MCollective/Connector.html">MCollective::Connector</a></li>
202                                 
203                                         <li><a href="../../MCollective/Connector/Base.html">MCollective::Connector::Base</a></li>
204                                 
205                                         <li><a href="../../MCollective/DDL.html">MCollective::DDL</a></li>
206                                 
207                                         <li><a href="../../MCollective/DDL/AgentDDL.html">MCollective::DDL::AgentDDL</a></li>
208                                 
209                                         <li><a href="../../MCollective/DDL/Base.html">MCollective::DDL::Base</a></li>
210                                 
211                                         <li><a href="../../MCollective/DDL/DataDDL.html">MCollective::DDL::DataDDL</a></li>
212                                 
213                                         <li><a href="../../MCollective/DDL/DiscoveryDDL.html">MCollective::DDL::DiscoveryDDL</a></li>
214                                 
215                                         <li><a href="../../MCollective/DDL/ValidatorDDL.html">MCollective::DDL::ValidatorDDL</a></li>
216                                 
217                                         <li><a href="../../MCollective/DDLValidationError.html">MCollective::DDLValidationError</a></li>
218                                 
219                                         <li><a href="../../MCollective/Data.html">MCollective::Data</a></li>
220                                 
221                                         <li><a href="../../MCollective/Data/Base.html">MCollective::Data::Base</a></li>
222                                 
223                                         <li><a href="../../MCollective/Data/Result.html">MCollective::Data::Result</a></li>
224                                 
225                                         <li><a href="../../MCollective/Discovery.html">MCollective::Discovery</a></li>
226                                 
227                                         <li><a href="../../MCollective/Facts.html">MCollective::Facts</a></li>
228                                 
229                                         <li><a href="../../MCollective/Facts/Base.html">MCollective::Facts::Base</a></li>
230                                 
231                                         <li><a href="../../MCollective/Generators.html">MCollective::Generators</a></li>
232                                 
233                                         <li><a href="../../MCollective/Generators/AgentGenerator.html">MCollective::Generators::AgentGenerator</a></li>
234                                 
235                                         <li><a href="../../MCollective/Generators/Base.html">MCollective::Generators::Base</a></li>
236                                 
237                                         <li><a href="../../MCollective/Generators/DataGenerator.html">MCollective::Generators::DataGenerator</a></li>
238                                 
239                                         <li><a href="../../MCollective/InvalidRPCData.html">MCollective::InvalidRPCData</a></li>
240                                 
241                                         <li><a href="../../MCollective/Log.html">MCollective::Log</a></li>
242                                 
243                                         <li><a href="../../MCollective/Logger.html">MCollective::Logger</a></li>
244                                 
245                                         <li><a href="../../MCollective/Logger/Base.html">MCollective::Logger::Base</a></li>
246                                 
247                                         <li><a href="../../MCollective/Logger/Console_logger.html">MCollective::Logger::Console_logger</a></li>
248                                 
249                                         <li><a href="../../MCollective/Logger/File_logger.html">MCollective::Logger::File_logger</a></li>
250                                 
251                                         <li><a href="../../MCollective/Logger/Syslog_logger.html">MCollective::Logger::Syslog_logger</a></li>
252                                 
253                                         <li><a href="../../MCollective/Matcher.html">MCollective::Matcher</a></li>
254                                 
255                                         <li><a href="../../MCollective/Matcher/Parser.html">MCollective::Matcher::Parser</a></li>
256                                 
257                                         <li><a href="../../MCollective/Matcher/Scanner.html">MCollective::Matcher::Scanner</a></li>
258                                 
259                                         <li><a href="../../MCollective/Message.html">MCollective::Message</a></li>
260                                 
261                                         <li><a href="../../MCollective/MissingRPCData.html">MCollective::MissingRPCData</a></li>
262                                 
263                                         <li><a href="../../MCollective/MsgDoesNotMatchRequestID.html">MCollective::MsgDoesNotMatchRequestID</a></li>
264                                 
265                                         <li><a href="../../MCollective/MsgTTLExpired.html">MCollective::MsgTTLExpired</a></li>
266                                 
267                                         <li><a href="../../MCollective/NotTargettedAtUs.html">MCollective::NotTargettedAtUs</a></li>
268                                 
269                                         <li><a href="../../MCollective/Optionparser.html">MCollective::Optionparser</a></li>
270                                 
271                                         <li><a href="../../MCollective/PluginManager.html">MCollective::PluginManager</a></li>
272                                 
273                                         <li><a href="../../MCollective/PluginPackager.html">MCollective::PluginPackager</a></li>
274                                 
275                                         <li><a href="../../MCollective/PluginPackager/AgentDefinition.html">MCollective::PluginPackager::AgentDefinition</a></li>
276                                 
277                                         <li><a href="../../MCollective/PluginPackager/StandardDefinition.html">MCollective::PluginPackager::StandardDefinition</a></li>
278                                 
279                                         <li><a href="../../MCollective/RPC.html">MCollective::RPC</a></li>
280                                 
281                                         <li><a href="../../MCollective/RPC/ActionRunner.html">MCollective::RPC::ActionRunner</a></li>
282                                 
283                                         <li><a href="../../MCollective/RPC/Agent.html">MCollective::RPC::Agent</a></li>
284                                 
285                                         <li><a href="../../MCollective/RPC/Audit.html">MCollective::RPC::Audit</a></li>
286                                 
287                                         <li><a href="../../MCollective/RPC/Client.html">MCollective::RPC::Client</a></li>
288                                 
289                                         <li><a href="../../MCollective/RPC/Helpers.html">MCollective::RPC::Helpers</a></li>
290                                 
291                                         <li><a href="../../MCollective/RPC/Progress.html">MCollective::RPC::Progress</a></li>
292                                 
293                                         <li><a href="../../MCollective/RPC/Reply.html">MCollective::RPC::Reply</a></li>
294                                 
295                                         <li><a href="../../MCollective/RPC/Request.html">MCollective::RPC::Request</a></li>
296                                 
297                                         <li><a href="../../MCollective/RPC/Result.html">MCollective::RPC::Result</a></li>
298                                 
299                                         <li><a href="../../MCollective/RPC/Stats.html">MCollective::RPC::Stats</a></li>
300                                 
301                                         <li><a href="../../MCollective/RPCAborted.html">MCollective::RPCAborted</a></li>
302                                 
303                                         <li><a href="../../MCollective/RPCError.html">MCollective::RPCError</a></li>
304                                 
305                                         <li><a href="../../MCollective/Registration.html">MCollective::Registration</a></li>
306                                 
307                                         <li><a href="../../MCollective/Registration/Base.html">MCollective::Registration::Base</a></li>
308                                 
309                                         <li><a href="../../MCollective/Runner.html">MCollective::Runner</a></li>
310                                 
311                                         <li><a href="../../MCollective/RunnerStats.html">MCollective::RunnerStats</a></li>
312                                 
313                                         <li><a href="../../MCollective/SSL.html">MCollective::SSL</a></li>
314                                 
315                                         <li><a href="../../MCollective/Security.html">MCollective::Security</a></li>
316                                 
317                                         <li><a href="../../MCollective/Security/Base.html">MCollective::Security::Base</a></li>
318                                 
319                                         <li><a href="../../MCollective/SecurityValidationFailed.html">MCollective::SecurityValidationFailed</a></li>
320                                 
321                                         <li><a href="../../MCollective/Shell.html">MCollective::Shell</a></li>
322                                 
323                                         <li><a href="../../MCollective/Translatable.html">MCollective::Translatable</a></li>
324                                 
325                                         <li><a href="../../MCollective/UnixDaemon.html">MCollective::UnixDaemon</a></li>
326                                 
327                                         <li><a href="../../MCollective/UnknownRPCAction.html">MCollective::UnknownRPCAction</a></li>
328                                 
329                                         <li><a href="../../MCollective/UnknownRPCError.html">MCollective::UnknownRPCError</a></li>
330                                 
331                                         <li><a href="../../MCollective/Util.html">MCollective::Util</a></li>
332                                 
333                                         <li><a href="../../MCollective/Validator.html">MCollective::Validator</a></li>
334                                 
335                                         <li><a href="../../MCollective/ValidatorError.html">MCollective::ValidatorError</a></li>
336                                 
337                                         <li><a href="../../MCollective/WindowsDaemon.html">MCollective::WindowsDaemon</a></li>
338                                 
339                                         <li><a href="../../Array.html">Array</a></li>
340                                 
341                                         <li><a href="../../Dir.html">Dir</a></li>
342                                 
343                                         <li><a href="../../Object.html">Object</a></li>
344                                 
345                                         <li><a href="../../String.html">String</a></li>
346                                 
347                                         <li><a href="../../Symbol.html">Symbol</a></li>
348                                 
349                                 </ul>
350                                 <div id="no-class-search-results" style="display: none;">No matching classes.</div>
351                         </div>
352
353                         
354                 </div>
355         </div>
356
357         <div id="documentation">
358                 <h1 class="class">MCollective::DDL::Base</h1>
359
360                 <div id="description">
361                         <p>
362 The base class for all kinds of <a href="../DDL.html">DDL</a> files. <a
363 href="../DDL.html">DDL</a> files when run gets parsed and builds up a hash
364 of the basic primitive types, ideally restricted so it can be converted to
365 JSON though today there are some Ruby Symbols in them which might be fixed
366 laster on.
367 </p>
368 <p>
369 The Hash being built should be stored in @entities, the format is generally
370 not prescribed but there&#8217;s a definite feel to how <a
371 href="../DDL.html">DDL</a> files look so study the agent and discovery ones
372 to see how the structure applies to very different use cases.
373 </p>
374 <p>
375 For every plugin type you should have a single word name - that corresponds
376 to the directory in the libdir where these plugins live. If you need
377 anything above and beyond &#8216;metadata&#8217; in your plugin <a
378 href="../DDL.html">DDL</a> then add a PlugintypeDDL class here and add your
379 specific behaviors to those.
380 </p>
381
382                 </div>
383
384                 <!-- Constants -->
385                 
386
387                 <!-- Attributes -->
388                 
389                 <div id="attribute-method-details" class="method-section section">
390                         <h3 class="section-header">Attributes</h3>
391
392                         
393                         <div id="meta-attribute-method" class="method-detail">
394                                 <a name="meta"></a>
395                                 
396                                 <div class="method-heading attribute-method-heading">
397                                         <span class="method-name">meta</span><span
398                                                 class="attribute-access-type">[R]</span>
399                                 </div>
400
401                                 <div class="method-description">
402                                 
403                                 <p class="missing-docs">(Not documented)</p>
404                                 
405                                 </div>
406                         </div>
407                         
408                         <div id="entities-attribute-method" class="method-detail">
409                                 <a name="entities"></a>
410                                 
411                                 <div class="method-heading attribute-method-heading">
412                                         <span class="method-name">entities</span><span
413                                                 class="attribute-access-type">[R]</span>
414                                 </div>
415
416                                 <div class="method-description">
417                                 
418                                 <p class="missing-docs">(Not documented)</p>
419                                 
420                                 </div>
421                         </div>
422                         
423                         <div id="pluginname-attribute-method" class="method-detail">
424                                 <a name="pluginname"></a>
425                                 
426                                 <div class="method-heading attribute-method-heading">
427                                         <span class="method-name">pluginname</span><span
428                                                 class="attribute-access-type">[R]</span>
429                                 </div>
430
431                                 <div class="method-description">
432                                 
433                                 <p class="missing-docs">(Not documented)</p>
434                                 
435                                 </div>
436                         </div>
437                         
438                         <div id="plugintype-attribute-method" class="method-detail">
439                                 <a name="plugintype"></a>
440                                 
441                                 <div class="method-heading attribute-method-heading">
442                                         <span class="method-name">plugintype</span><span
443                                                 class="attribute-access-type">[R]</span>
444                                 </div>
445
446                                 <div class="method-description">
447                                 
448                                 <p class="missing-docs">(Not documented)</p>
449                                 
450                                 </div>
451                         </div>
452                         
453                         <div id="usage-attribute-method" class="method-detail">
454                                 <a name="usage"></a>
455                                 
456                                 <div class="method-heading attribute-method-heading">
457                                         <span class="method-name">usage</span><span
458                                                 class="attribute-access-type">[R]</span>
459                                 </div>
460
461                                 <div class="method-description">
462                                 
463                                 <p class="missing-docs">(Not documented)</p>
464                                 
465                                 </div>
466                         </div>
467                         
468                         <div id="requirements-attribute-method" class="method-detail">
469                                 <a name="requirements"></a>
470                                 
471                                 <div class="method-heading attribute-method-heading">
472                                         <span class="method-name">requirements</span><span
473                                                 class="attribute-access-type">[R]</span>
474                                 </div>
475
476                                 <div class="method-description">
477                                 
478                                 <p class="missing-docs">(Not documented)</p>
479                                 
480                                 </div>
481                         </div>
482                         
483                 </div>
484                 
485
486                 <!-- Methods -->
487                 
488                 <div id="public-class-method-details" class="method-section section">
489                         <h3 class="section-header">Public Class Methods</h3>
490
491                 
492                         <div id="new-method" class="method-detail ">
493                                 <a name="M000278"></a>
494
495                                 <div class="method-heading">
496                                 
497                                         <span class="method-name">new</span><span
498                                                 class="method-args">(plugin, plugintype=:agent, loadddl=true)</span>
499                                         <span class="method-click-advice">click to toggle source</span>
500                                 
501                                 </div>
502
503                                 <div class="method-description">
504                                         
505                                         <p class="missing-docs">(Not documented)</p>
506                                         
507
508                                         
509                                         <div class="method-source-code"
510                                                 id="new-source">
511 <pre>
512     <span class="ruby-comment cmt"># File lib/mcollective/ddl/base.rb, line 24</span>
513 24:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">plugin</span>, <span class="ruby-identifier">plugintype</span>=<span class="ruby-identifier">:agent</span>, <span class="ruby-identifier">loadddl</span>=<span class="ruby-keyword kw">true</span>)
514 25:         <span class="ruby-ivar">@entities</span> = {}
515 26:         <span class="ruby-ivar">@meta</span> = {}
516 27:         <span class="ruby-ivar">@usage</span> = <span class="ruby-value str">&quot;&quot;</span>
517 28:         <span class="ruby-ivar">@config</span> = <span class="ruby-constant">Config</span>.<span class="ruby-identifier">instance</span>
518 29:         <span class="ruby-ivar">@pluginname</span> = <span class="ruby-identifier">plugin</span>
519 30:         <span class="ruby-ivar">@plugintype</span> = <span class="ruby-identifier">plugintype</span>.<span class="ruby-identifier">to_sym</span>
520 31:         <span class="ruby-ivar">@requirements</span> = {}
521 32: 
522 33:         <span class="ruby-identifier">loadddlfile</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">loadddl</span>
523 34:       <span class="ruby-keyword kw">end</span></pre>
524                                         </div>
525                                         
526                                 </div>
527
528                                 
529                         </div>
530
531                 
532                 </div>
533         
534                 <div id="public-instance-method-details" class="method-section section">
535                         <h3 class="section-header">Public Instance Methods</h3>
536
537                 
538                         <div id="findddlfile-method" class="method-detail ">
539                                 <a name="M000283"></a>
540
541                                 <div class="method-heading">
542                                 
543                                         <span class="method-name">findddlfile</span><span
544                                                 class="method-args">(ddlname=nil, ddltype=nil)</span>
545                                         <span class="method-click-advice">click to toggle source</span>
546                                 
547                                 </div>
548
549                                 <div class="method-description">
550                                         
551                                         <p class="missing-docs">(Not documented)</p>
552                                         
553
554                                         
555                                         <div class="method-source-code"
556                                                 id="findddlfile-source">
557 <pre>
558      <span class="ruby-comment cmt"># File lib/mcollective/ddl/base.rb, line 89</span>
559  89:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">findddlfile</span>(<span class="ruby-identifier">ddlname</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">ddltype</span>=<span class="ruby-keyword kw">nil</span>)
560  90:         <span class="ruby-identifier">ddlname</span> = <span class="ruby-ivar">@pluginname</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">ddlname</span>
561  91:         <span class="ruby-identifier">ddltype</span> = <span class="ruby-ivar">@plugintype</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">ddltype</span>
562  92: 
563  93:         <span class="ruby-ivar">@config</span>.<span class="ruby-identifier">libdir</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">libdir</span><span class="ruby-operator">|</span>
564  94:           <span class="ruby-identifier">ddlfile</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>([<span class="ruby-identifier">libdir</span>, <span class="ruby-value str">&quot;mcollective&quot;</span>, <span class="ruby-identifier">ddltype</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-node">&quot;#{ddlname}.ddl&quot;</span>])
565  95:           <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">ddlfile</span>)
566  96:             <span class="ruby-identifier">log_code</span>(<span class="ruby-identifier">:PLMC18</span>, <span class="ruby-value str">&quot;Found %{ddlname} ddl at %{ddlfile}&quot;</span>, <span class="ruby-identifier">:debug</span>, <span class="ruby-identifier">:ddlname</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ddlname</span>, <span class="ruby-identifier">:ddlfile</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ddlfile</span>)
567  97:             <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ddlfile</span>
568  98:           <span class="ruby-keyword kw">end</span>
569  99:         <span class="ruby-keyword kw">end</span>
570 100:         <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
571 101:       <span class="ruby-keyword kw">end</span></pre>
572                                         </div>
573                                         
574                                 </div>
575
576                                 
577                         </div>
578
579                 
580                         <div id="help-method" class="method-detail ">
581                                 <a name="M000279"></a>
582
583                                 <div class="method-heading">
584                                 
585                                         <span class="method-name">help</span><span
586                                                 class="method-args">(template=nil)</span>
587                                         <span class="method-click-advice">click to toggle source</span>
588                                 
589                                 </div>
590
591                                 <div class="method-description">
592                                         
593                                         <p>
594 Generates help using the template based on the data created with metadata
595 and input.
596 </p>
597 <p>
598 If no template name is provided one will be chosen based on the plugin
599 type. If the provided template path is not absolute then the template will
600 be loaded either from the config dir and if that does not exist, default to
601 /etc/mcollective
602 </p>
603                                         
604
605                                         
606                                         <div class="method-source-code"
607                                                 id="help-source">
608 <pre>
609     <span class="ruby-comment cmt"># File lib/mcollective/ddl/base.rb, line 44</span>
610 44:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">help</span>(<span class="ruby-identifier">template</span>=<span class="ruby-keyword kw">nil</span>)
611 45:         <span class="ruby-identifier">template</span> = <span class="ruby-identifier">template_for_plugintype</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">template</span>
612 46:         <span class="ruby-identifier">template</span> = <span class="ruby-constant">Util</span>.<span class="ruby-identifier">templatepath</span>(<span class="ruby-identifier">template</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">Util</span>.<span class="ruby-identifier">absolute_path?</span>(<span class="ruby-identifier">template</span>)
613 47: 
614 48:         <span class="ruby-identifier">template</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">template</span>)
615 49:         <span class="ruby-identifier">meta</span> = <span class="ruby-ivar">@meta</span>
616 50:         <span class="ruby-identifier">entities</span> = <span class="ruby-ivar">@entities</span>
617 51: 
618 52:         <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">template</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;metadata-help.erb&quot;</span>
619 53:           <span class="ruby-identifier">metadata_template</span> = <span class="ruby-constant">Util</span>.<span class="ruby-identifier">templatepath</span>(<span class="ruby-value str">&quot;metadata-help.erb&quot;</span>)
620 54:           <span class="ruby-identifier">metadata_template</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">metadata_template</span>)
621 55:           <span class="ruby-identifier">metastring</span> = <span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">metadata_template</span>, <span class="ruby-value">0</span>, <span class="ruby-value str">'%'</span>)
622 56:           <span class="ruby-identifier">metastring</span> = <span class="ruby-identifier">metastring</span>.<span class="ruby-identifier">result</span>(<span class="ruby-identifier">binding</span>)
623 57:         <span class="ruby-keyword kw">end</span>
624 58: 
625 59:         <span class="ruby-identifier">erb</span> = <span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">template</span>, <span class="ruby-value">0</span>, <span class="ruby-value str">'%'</span>)
626 60:         <span class="ruby-identifier">erb</span>.<span class="ruby-identifier">result</span>(<span class="ruby-identifier">binding</span>)
627 61:       <span class="ruby-keyword kw">end</span></pre>
628                                         </div>
629                                         
630                                 </div>
631
632                                 
633                         </div>
634
635                 
636                         <div id="input-method" class="method-detail ">
637                                 <a name="M000288"></a>
638
639                                 <div class="method-heading">
640                                 
641                                         <span class="method-name">input</span><span
642                                                 class="method-args">(argument, properties)</span>
643                                         <span class="method-click-advice">click to toggle source</span>
644                                 
645                                 </div>
646
647                                 <div class="method-description">
648                                         
649                                         <p>
650 Registers an input argument for a given action
651 </p>
652 <p>
653 See the documentation for action for how to use this
654 </p>
655                                         
656
657                                         
658                                         <div class="method-source-code"
659                                                 id="input-source">
660 <pre>
661      <span class="ruby-comment cmt"># File lib/mcollective/ddl/base.rb, line 153</span>
662 153:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">input</span>(<span class="ruby-identifier">argument</span>, <span class="ruby-identifier">properties</span>)
663 154:         <span class="ruby-identifier">raise_code</span>(<span class="ruby-identifier">:PLMC22</span>, <span class="ruby-value str">&quot;Cannot determine what entity input '%{entity}' belongs to&quot;</span>, <span class="ruby-identifier">:error</span>, <span class="ruby-identifier">:entity</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@current_entity</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@current_entity</span>
664 155: 
665 156:         <span class="ruby-identifier">entity</span> = <span class="ruby-ivar">@current_entity</span>
666 157: 
667 158:         [<span class="ruby-identifier">:prompt</span>, <span class="ruby-identifier">:description</span>, <span class="ruby-identifier">:type</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span>
668 159:           <span class="ruby-identifier">raise_code</span>(<span class="ruby-identifier">:PLMC23</span>, <span class="ruby-value str">&quot;Input needs a :%{property} property&quot;</span>, <span class="ruby-identifier">:debug</span>, <span class="ruby-identifier">:property</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">arg</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">properties</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">arg</span>)
669 160:         <span class="ruby-keyword kw">end</span>
670 161: 
671 162:         <span class="ruby-ivar">@entities</span>[<span class="ruby-identifier">entity</span>][<span class="ruby-identifier">:input</span>][<span class="ruby-identifier">argument</span>] = {<span class="ruby-identifier">:prompt</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:prompt</span>],
672 163:                                                <span class="ruby-identifier">:description</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:description</span>],
673 164:                                                <span class="ruby-identifier">:type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:type</span>],
674 165:                                                <span class="ruby-identifier">:default</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:default</span>],
675 166:                                                <span class="ruby-identifier">:optional</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:optional</span>]}
676 167: 
677 168:         <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:type</span>]
678 169:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:string</span>
679 170:             <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Input type :string needs a :validation argument&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">properties</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:validation</span>)
680 171:             <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Input type :string needs a :maxlength argument&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">properties</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:maxlength</span>)
681 172: 
682 173:             <span class="ruby-ivar">@entities</span>[<span class="ruby-identifier">entity</span>][<span class="ruby-identifier">:input</span>][<span class="ruby-identifier">argument</span>][<span class="ruby-identifier">:validation</span>] = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:validation</span>]
683 174:             <span class="ruby-ivar">@entities</span>[<span class="ruby-identifier">entity</span>][<span class="ruby-identifier">:input</span>][<span class="ruby-identifier">argument</span>][<span class="ruby-identifier">:maxlength</span>] = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:maxlength</span>]
684 175: 
685 176:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:list</span>
686 177:             <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Input type :list needs a :list argument&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">properties</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:list</span>)
687 178: 
688 179:             <span class="ruby-ivar">@entities</span>[<span class="ruby-identifier">entity</span>][<span class="ruby-identifier">:input</span>][<span class="ruby-identifier">argument</span>][<span class="ruby-identifier">:list</span>] = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:list</span>]
689 180:         <span class="ruby-keyword kw">end</span>
690 181:       <span class="ruby-keyword kw">end</span></pre>
691                                         </div>
692                                         
693                                 </div>
694
695                                 
696                         </div>
697
698                 
699                         <div id="loadddlfile-method" class="method-detail ">
700                                 <a name="M000282"></a>
701
702                                 <div class="method-heading">
703                                 
704                                         <span class="method-name">loadddlfile</span><span
705                                                 class="method-args">()</span>
706                                         <span class="method-click-advice">click to toggle source</span>
707                                 
708                                 </div>
709
710                                 <div class="method-description">
711                                         
712                                         <p class="missing-docs">(Not documented)</p>
713                                         
714
715                                         
716                                         <div class="method-source-code"
717                                                 id="loadddlfile-source">
718 <pre>
719     <span class="ruby-comment cmt"># File lib/mcollective/ddl/base.rb, line 81</span>
720 81:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">loadddlfile</span>
721 82:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ddlfile</span> = <span class="ruby-identifier">findddlfile</span>
722 83:           <span class="ruby-identifier">instance_eval</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">ddlfile</span>), <span class="ruby-identifier">ddlfile</span>, <span class="ruby-value">1</span>)
723 84:         <span class="ruby-keyword kw">else</span>
724 85:           <span class="ruby-identifier">raise_code</span>(<span class="ruby-identifier">:PLMC40</span>, <span class="ruby-value str">&quot;Can't find DDL for %{type} plugin '%{name}'&quot;</span>, <span class="ruby-identifier">:debug</span>, <span class="ruby-identifier">:type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@plugintype</span>, <span class="ruby-identifier">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@pluginname</span>)
725 86:         <span class="ruby-keyword kw">end</span>
726 87:       <span class="ruby-keyword kw">end</span></pre>
727                                         </div>
728                                         
729                                 </div>
730
731                                 
732                         </div>
733
734                 
735                         <div id="metadata-method" class="method-detail ">
736                                 <a name="M000292"></a>
737
738                                 <div class="method-heading">
739                                 
740                                         <span class="method-name">metadata</span><span
741                                                 class="method-args">(meta)</span>
742                                         <span class="method-click-advice">click to toggle source</span>
743                                 
744                                 </div>
745
746                                 <div class="method-description">
747                                         
748                                         <p>
749 Registers meta data for the introspection hash
750 </p>
751                                         
752
753                                         
754                                         <div class="method-source-code"
755                                                 id="metadata-source">
756 <pre>
757      <span class="ruby-comment cmt"># File lib/mcollective/ddl/base.rb, line 215</span>
758 215:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">metadata</span>(<span class="ruby-identifier">meta</span>)
759 216:         [<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>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span>
760 217:           <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Metadata needs a :#{arg} property&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">meta</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">arg</span>)
761 218:         <span class="ruby-keyword kw">end</span>
762 219: 
763 220:         <span class="ruby-ivar">@meta</span> = <span class="ruby-identifier">meta</span>
764 221:       <span class="ruby-keyword kw">end</span></pre>
765                                         </div>
766                                         
767                                 </div>
768
769                                 
770                         </div>
771
772                 
773                         <div id="output-method" class="method-detail ">
774                                 <a name="M000290"></a>
775
776                                 <div class="method-heading">
777                                 
778                                         <span class="method-name">output</span><span
779                                                 class="method-args">(argument, properties)</span>
780                                         <span class="method-click-advice">click to toggle source</span>
781                                 
782                                 </div>
783
784                                 <div class="method-description">
785                                         
786                                         <p>
787 Registers an output argument for a given action
788 </p>
789 <p>
790 See the documentation for action for how to use this
791 </p>
792                                         
793
794                                         
795                                         <div class="method-source-code"
796                                                 id="output-source">
797 <pre>
798      <span class="ruby-comment cmt"># File lib/mcollective/ddl/base.rb, line 186</span>
799 186:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">output</span>(<span class="ruby-identifier">argument</span>, <span class="ruby-identifier">properties</span>)
800 187:         <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Cannot figure out what action input #{argument} belongs to&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@current_entity</span>
801 188:         <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Output #{argument} needs a description argument&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">properties</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:description</span>)
802 189:         <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Output #{argument} needs a display_as argument&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">properties</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:display_as</span>)
803 190: 
804 191:         <span class="ruby-identifier">action</span> = <span class="ruby-ivar">@current_entity</span>
805 192: 
806 193:         <span class="ruby-ivar">@entities</span>[<span class="ruby-identifier">action</span>][<span class="ruby-identifier">:output</span>][<span class="ruby-identifier">argument</span>] = {<span class="ruby-identifier">:description</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:description</span>],
807 194:                                                 <span class="ruby-identifier">:display_as</span>  =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:display_as</span>],
808 195:                                                 <span class="ruby-identifier">:default</span>     =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:default</span>]}
809 196:       <span class="ruby-keyword kw">end</span></pre>
810                                         </div>
811                                         
812                                 </div>
813
814                                 
815                         </div>
816
817                 
818                         <div id="requires-method" class="method-detail ">
819                                 <a name="M000291"></a>
820
821                                 <div class="method-heading">
822                                 
823                                         <span class="method-name">requires</span><span
824                                                 class="method-args">(requirement)</span>
825                                         <span class="method-click-advice">click to toggle source</span>
826                                 
827                                 </div>
828
829                                 <div class="method-description">
830                                         
831                                         <p class="missing-docs">(Not documented)</p>
832                                         
833
834                                         
835                                         <div class="method-source-code"
836                                                 id="requires-source">
837 <pre>
838      <span class="ruby-comment cmt"># File lib/mcollective/ddl/base.rb, line 198</span>
839 198:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">requires</span>(<span class="ruby-identifier">requirement</span>)
840 199:         <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Requirement should be a hash in the form :item =&gt; 'requirement'&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">requirement</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
841 200: 
842 201:         <span class="ruby-identifier">valid_requirements</span> = [<span class="ruby-identifier">:mcollective</span>]
843 202: 
844 203:         <span class="ruby-identifier">requirement</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
845 204:           <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">valid_requirements</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">key</span>)
846 205:             <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Requirement %s is not a valid requirement, only %s is supported&quot;</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">key</span>, <span class="ruby-identifier">valid_requirements</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;, &quot;</span>)]
847 206:           <span class="ruby-keyword kw">end</span>
848 207: 
849 208:           <span class="ruby-ivar">@requirements</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">requirement</span>[<span class="ruby-identifier">key</span>]
850 209:         <span class="ruby-keyword kw">end</span>
851 210: 
852 211:         <span class="ruby-identifier">validate_requirements</span>
853 212:       <span class="ruby-keyword kw">end</span></pre>
854                                         </div>
855                                         
856                                 </div>
857
858                                 
859                         </div>
860
861                 
862                         <div id="template-for-plugintype-method" class="method-detail ">
863                                 <a name="M000281"></a>
864
865                                 <div class="method-heading">
866                                 
867                                         <span class="method-name">template_for_plugintype</span><span
868                                                 class="method-args">()</span>
869                                         <span class="method-click-advice">click to toggle source</span>
870                                 
871                                 </div>
872
873                                 <div class="method-description">
874                                         
875                                         <p class="missing-docs">(Not documented)</p>
876                                         
877
878                                         
879                                         <div class="method-source-code"
880                                                 id="template-for-plugintype-source">
881 <pre>
882     <span class="ruby-comment cmt"># File lib/mcollective/ddl/base.rb, line 67</span>
883 67:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">template_for_plugintype</span>
884 68:         <span class="ruby-keyword kw">case</span> <span class="ruby-ivar">@plugintype</span>
885 69:         <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:agent</span>
886 70:           <span class="ruby-keyword kw">return</span> <span class="ruby-value str">&quot;rpc-help.erb&quot;</span>
887 71:         <span class="ruby-keyword kw">else</span>
888 72:           <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-constant">Util</span>.<span class="ruby-identifier">templatepath</span>(<span class="ruby-node">&quot;#{@plugintype}-help.erb&quot;</span>))
889 73:             <span class="ruby-keyword kw">return</span> <span class="ruby-node">&quot;#{@plugintype}-help.erb&quot;</span>
890 74:           <span class="ruby-keyword kw">else</span>
891 75:             <span class="ruby-comment cmt"># Default help template gets loaded if plugintype-help does not exist.</span>
892 76:             <span class="ruby-keyword kw">return</span> <span class="ruby-value str">&quot;metadata-help.erb&quot;</span>
893 77:           <span class="ruby-keyword kw">end</span>
894 78:         <span class="ruby-keyword kw">end</span>
895 79:       <span class="ruby-keyword kw">end</span></pre>
896                                         </div>
897                                         
898                                 </div>
899
900                                 
901                         </div>
902
903                 
904                         <div id="usage-method" class="method-detail ">
905                                 <a name="M000280"></a>
906
907                                 <div class="method-heading">
908                                 
909                                         <span class="method-name">usage</span><span
910                                                 class="method-args">(usage_text)</span>
911                                         <span class="method-click-advice">click to toggle source</span>
912                                 
913                                 </div>
914
915                                 <div class="method-description">
916                                         
917                                         <p class="missing-docs">(Not documented)</p>
918                                         
919
920                                         
921                                         <div class="method-source-code"
922                                                 id="usage-source">
923 <pre>
924     <span class="ruby-comment cmt"># File lib/mcollective/ddl/base.rb, line 63</span>
925 63:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">usage</span>(<span class="ruby-identifier">usage_text</span>)
926 64:         <span class="ruby-ivar">@usage</span> = <span class="ruby-identifier">usage_text</span>
927 65:       <span class="ruby-keyword kw">end</span></pre>
928                                         </div>
929                                         
930                                 </div>
931
932                                 
933                         </div>
934
935                 
936                         <div id="validate-input-argument-method" class="method-detail ">
937                                 <a name="M000285"></a>
938
939                                 <div class="method-heading">
940                                 
941                                         <span class="method-name">validate_input_argument</span><span
942                                                 class="method-args">(input, key, argument)</span>
943                                         <span class="method-click-advice">click to toggle source</span>
944                                 
945                                 </div>
946
947                                 <div class="method-description">
948                                         
949                                         <p>
950 validate strings, lists and booleans, we&#8217;ll add more types of
951 validators when all the use cases are clear
952 </p>
953 <p>
954 only does validation for arguments actually given, since some might be
955 optional. We validate the presense of the argument earlier so this is a
956 safe assumption, just to skip them.
957 </p>
958 <p>
959 :string can have maxlength and regex. A maxlength of 0 will bypasss checks
960 :list has a array of valid values
961 </p>
962                                         
963
964                                         
965                                         <div class="method-source-code"
966                                                 id="validate-input-argument-source">
967 <pre>
968      <span class="ruby-comment cmt"># File lib/mcollective/ddl/base.rb, line 127</span>
969 127:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">validate_input_argument</span>(<span class="ruby-identifier">input</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">argument</span>)
970 128:         <span class="ruby-constant">Validator</span>.<span class="ruby-identifier">load_validators</span>
971 129: 
972 130:         <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">input</span>[<span class="ruby-identifier">key</span>][<span class="ruby-identifier">:type</span>]
973 131:         <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:string</span>
974 132:           <span class="ruby-constant">Validator</span>.<span class="ruby-identifier">validate</span>(<span class="ruby-identifier">argument</span>, <span class="ruby-identifier">:string</span>)
975 133: 
976 134:           <span class="ruby-constant">Validator</span>.<span class="ruby-identifier">length</span>(<span class="ruby-identifier">argument</span>, <span class="ruby-identifier">input</span>[<span class="ruby-identifier">key</span>][<span class="ruby-identifier">:maxlength</span>].<span class="ruby-identifier">to_i</span>)
977 135: 
978 136:           <span class="ruby-constant">Validator</span>.<span class="ruby-identifier">validate</span>(<span class="ruby-identifier">argument</span>, <span class="ruby-identifier">input</span>[<span class="ruby-identifier">key</span>][<span class="ruby-identifier">:validation</span>])
979 137: 
980 138:         <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:list</span>
981 139:           <span class="ruby-constant">Validator</span>.<span class="ruby-identifier">validate</span>(<span class="ruby-identifier">argument</span>, <span class="ruby-identifier">input</span>[<span class="ruby-identifier">key</span>][<span class="ruby-identifier">:list</span>])
982 140: 
983 141:         <span class="ruby-keyword kw">else</span>
984 142:           <span class="ruby-constant">Validator</span>.<span class="ruby-identifier">validate</span>(<span class="ruby-identifier">argument</span>, <span class="ruby-identifier">input</span>[<span class="ruby-identifier">key</span>][<span class="ruby-identifier">:type</span>])
985 143:         <span class="ruby-keyword kw">end</span>
986 144: 
987 145:         <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
988 146:       <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
989 147:         <span class="ruby-constant">DDL</span>.<span class="ruby-identifier">validation_fail!</span>(<span class="ruby-identifier">:PLMC21</span>, <span class="ruby-value str">&quot;Cannot validate input '%{input}': %{error}&quot;</span>, <span class="ruby-identifier">:debug</span>, <span class="ruby-identifier">:input</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">key</span>, <span class="ruby-identifier">:error</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">to_s</span>)
990 148:       <span class="ruby-keyword kw">end</span></pre>
991                                         </div>
992                                         
993                                 </div>
994
995                                 
996                         </div>
997
998                 
999                         <div id="validate-requirements-method" class="method-detail ">
1000                                 <a name="M000284"></a>
1001
1002                                 <div class="method-heading">
1003                                 
1004                                         <span class="method-name">validate_requirements</span><span
1005                                                 class="method-args">()</span>
1006                                         <span class="method-click-advice">click to toggle source</span>
1007                                 
1008                                 </div>
1009
1010                                 <div class="method-description">
1011                                         
1012                                         <p class="missing-docs">(Not documented)</p>
1013                                         
1014
1015                                         
1016                                         <div class="method-source-code"
1017                                                 id="validate-requirements-source">
1018 <pre>
1019      <span class="ruby-comment cmt"># File lib/mcollective/ddl/base.rb, line 103</span>
1020 103:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">validate_requirements</span>
1021 104:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">requirement</span> = <span class="ruby-ivar">@requirements</span>[<span class="ruby-identifier">:mcollective</span>]
1022 105:           <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Util</span>.<span class="ruby-identifier">mcollective_version</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;@DEVELOPMENT_VERSION@&quot;</span>
1023 106:             <span class="ruby-identifier">log_code</span>(<span class="ruby-identifier">:PLMC19</span>, <span class="ruby-value str">&quot;DDL requirements validation being skipped in development&quot;</span>, <span class="ruby-identifier">:warn</span>)
1024 107:             <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
1025 108:           <span class="ruby-keyword kw">end</span>
1026 109: 
1027 110:           <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Util</span>.<span class="ruby-identifier">versioncmp</span>(<span class="ruby-constant">Util</span>.<span class="ruby-identifier">mcollective_version</span>, <span class="ruby-identifier">requirement</span>) <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span>
1028 111:             <span class="ruby-constant">DDL</span>.<span class="ruby-identifier">validation_fail!</span>(<span class="ruby-identifier">:PLMC20</span>, <span class="ruby-value str">&quot;%{type} plugin '%{name}' requires MCollective version %{requirement} or newer&quot;</span>, <span class="ruby-identifier">:debug</span>, <span class="ruby-identifier">:type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@plugintype</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">capitalize</span>, <span class="ruby-identifier">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@pluginname</span>, <span class="ruby-identifier">:requirement</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">requirement</span>)
1029 112:           <span class="ruby-keyword kw">end</span>
1030 113:         <span class="ruby-keyword kw">end</span>
1031 114: 
1032 115:         <span class="ruby-keyword kw">true</span>
1033 116:       <span class="ruby-keyword kw">end</span></pre>
1034                                         </div>
1035                                         
1036                                 </div>
1037
1038                                 
1039                         </div>
1040
1041                 
1042                 </div>
1043         
1044
1045         </div>
1046
1047
1048         <div id="rdoc-debugging-section-dump" class="debugging-section">
1049         
1050                 <p>Disabled; run with --debug to generate this.</p>
1051         
1052         </div>
1053
1054         <div id="validator-badges">
1055                 <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
1056                 <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
1057                         Rdoc Generator</a> 1.1.6</small>.</p>
1058         </div>
1059
1060 </body>
1061 </html>
1062