Update version according to OSCI-883
[packages/precise/mcollective.git] / doc / MCollective / Applications.html
diff --git a/doc/MCollective/Applications.html b/doc/MCollective/Applications.html
new file mode 100644 (file)
index 0000000..f0f346a
--- /dev/null
@@ -0,0 +1,677 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+       <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
+
+       <title>Class: MCollective::Applications</title>
+
+       <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
+
+       <script src="../js/jquery.js" type="text/javascript"
+               charset="utf-8"></script>
+       <script src="../js/thickbox-compressed.js" type="text/javascript"
+               charset="utf-8"></script>
+       <script src="../js/quicksearch.js" type="text/javascript"
+               charset="utf-8"></script>
+       <script src="../js/darkfish.js" type="text/javascript"
+               charset="utf-8"></script>
+
+</head>
+<body class="class">
+
+       <div id="metadata">
+               <div id="file-metadata">
+                       <div id="file-list-section" class="section">
+                               <h3 class="section-header">In Files</h3>
+                               <div class="section-body">
+                                       <ul>
+                                       
+                                               <li><a href="../lib/mcollective/applications_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
+                                                       class="thickbox" title="lib/mcollective/applications.rb">lib/mcollective/applications.rb</a></li>
+                                       
+                                       </ul>
+                               </div>
+                       </div>
+
+                       
+               </div>
+
+               <div id="class-metadata">
+
+                       <!-- Parent Class -->
+                       
+                       <div id="parent-class-section" class="section">
+                               <h3 class="section-header">Parent</h3>
+                               
+                               <p class="link"><a href="../Object.html">Object</a></p>
+                               
+                       </div>
+                       
+
+                       <!-- Namespace Contents -->
+                       
+
+                       <!-- Method Quickref -->
+                       
+                       <div id="method-list-section" class="section">
+                               <h3 class="section-header">Methods</h3>
+                               <ul class="link-list">
+                                       
+                                       <li><a href="#M000095">::[]</a></li>
+                                       
+                                       <li><a href="#M000099">::filter_extra_options</a></li>
+                                       
+                                       <li><a href="#M000098">::list</a></li>
+                                       
+                                       <li><a href="#M000097">::load_application</a></li>
+                                       
+                                       <li><a href="#M000100">::load_config</a></li>
+                                       
+                                       <li><a href="#M000096">::run</a></li>
+                                       
+                               </ul>
+                       </div>
+                       
+
+                       <!-- Included Modules -->
+                       
+               </div>
+
+               <div id="project-metadata">
+                       
+                       
+                       <div id="fileindex-section" class="section project-section">
+                               <h3 class="section-header">Files</h3>
+                               <ul>
+                               
+                                       <li class="file"><a href="../COPYING.html">COPYING</a></li>
+                               
+                                       <li class="file"><a href="../Gemfile.html">Gemfile</a></li>
+                               
+                                       <li class="file"><a href="../README.html">README</a></li>
+                               
+                                       <li class="file"><a href="../Rakefile.html">Rakefile</a></li>
+                               
+                                       <li class="file"><a href="../etc/client_cfg_dist.html">client.cfg.dist</a></li>
+                               
+                                       <li class="file"><a href="../etc/data-help_erb.html">data-help.erb</a></li>
+                               
+                                       <li class="file"><a href="../etc/discovery-help_erb.html">discovery-help.erb</a></li>
+                               
+                                       <li class="file"><a href="../etc/facts_yaml_dist.html">facts.yaml.dist</a></li>
+                               
+                                       <li class="file"><a href="../etc/metadata-help_erb.html">metadata-help.erb</a></li>
+                               
+                                       <li class="file"><a href="../etc/msg-help_erb.html">msg-help.erb</a></li>
+                               
+                                       <li class="file"><a href="../etc/rpc-help_erb.html">rpc-help.erb</a></li>
+                               
+                                       <li class="file"><a href="../etc/server_cfg_dist.html">server.cfg.dist</a></li>
+                               
+                                       <li class="file"><a href="../etc/ssl/PLACEHOLDER.html">PLACEHOLDER</a></li>
+                               
+                                       <li class="file"><a href="../etc/ssl/clients/PLACEHOLDER.html">PLACEHOLDER</a></li>
+                               
+                                       <li class="file"><a href="../lib/mcollective/generators/templates/action_snippet_erb.html">action_snippet.erb</a></li>
+                               
+                                       <li class="file"><a href="../lib/mcollective/generators/templates/data_input_snippet_erb.html">data_input_snippet.erb</a></li>
+                               
+                                       <li class="file"><a href="../lib/mcollective/generators/templates/ddl_erb.html">ddl.erb</a></li>
+                               
+                                       <li class="file"><a href="../lib/mcollective/generators/templates/plugin_erb.html">plugin.erb</a></li>
+                               
+                                       <li class="file"><a href="../lib/mcollective/locales/en_yml.html">en.yml</a></li>
+                               
+                                       <li class="file"><a href="../mcollective_init.html">mcollective.init</a></li>
+                               
+                               </ul>
+                       </div>
+                       
+
+                       <div id="classindex-section" class="section project-section">
+                               <h3 class="section-header">Class Index
+                                       <span class="search-toggle"><img src="../images/find.png"
+                                               height="16" width="16" alt="[+]"
+                                               title="show/hide quicksearch" /></span></h3>
+                               <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
+                               <fieldset>
+                                       <legend>Quicksearch</legend>
+                                       <input type="text" name="quicksearch" value=""
+                                               class="quicksearch-field" />
+                               </fieldset>
+                               </form>
+
+                               <ul class="link-list">
+                               
+                                       <li><a href="../MCollective.html">MCollective</a></li>
+                               
+                                       <li><a href="../MCollective/Agent.html">MCollective::Agent</a></li>
+                               
+                                       <li><a href="../MCollective/Agents.html">MCollective::Agents</a></li>
+                               
+                                       <li><a href="../MCollective/Aggregate.html">MCollective::Aggregate</a></li>
+                               
+                                       <li><a href="../MCollective/Aggregate/Base.html">MCollective::Aggregate::Base</a></li>
+                               
+                                       <li><a href="../MCollective/Aggregate/Result.html">MCollective::Aggregate::Result</a></li>
+                               
+                                       <li><a href="../MCollective/Aggregate/Result/Base.html">MCollective::Aggregate::Result::Base</a></li>
+                               
+                                       <li><a href="../MCollective/Aggregate/Result/CollectionResult.html">MCollective::Aggregate::Result::CollectionResult</a></li>
+                               
+                                       <li><a href="../MCollective/Aggregate/Result/NumericResult.html">MCollective::Aggregate::Result::NumericResult</a></li>
+                               
+                                       <li><a href="../MCollective/Application.html">MCollective::Application</a></li>
+                               
+                                       <li><a href="../MCollective/Applications.html">MCollective::Applications</a></li>
+                               
+                                       <li><a href="../MCollective/Cache.html">MCollective::Cache</a></li>
+                               
+                                       <li><a href="../MCollective/Client.html">MCollective::Client</a></li>
+                               
+                                       <li><a href="../MCollective/CodedError.html">MCollective::CodedError</a></li>
+                               
+                                       <li><a href="../MCollective/Config.html">MCollective::Config</a></li>
+                               
+                                       <li><a href="../MCollective/Connector.html">MCollective::Connector</a></li>
+                               
+                                       <li><a href="../MCollective/Connector/Base.html">MCollective::Connector::Base</a></li>
+                               
+                                       <li><a href="../MCollective/DDL.html">MCollective::DDL</a></li>
+                               
+                                       <li><a href="../MCollective/DDL/AgentDDL.html">MCollective::DDL::AgentDDL</a></li>
+                               
+                                       <li><a href="../MCollective/DDL/Base.html">MCollective::DDL::Base</a></li>
+                               
+                                       <li><a href="../MCollective/DDL/DataDDL.html">MCollective::DDL::DataDDL</a></li>
+                               
+                                       <li><a href="../MCollective/DDL/DiscoveryDDL.html">MCollective::DDL::DiscoveryDDL</a></li>
+                               
+                                       <li><a href="../MCollective/DDL/ValidatorDDL.html">MCollective::DDL::ValidatorDDL</a></li>
+                               
+                                       <li><a href="../MCollective/DDLValidationError.html">MCollective::DDLValidationError</a></li>
+                               
+                                       <li><a href="../MCollective/Data.html">MCollective::Data</a></li>
+                               
+                                       <li><a href="../MCollective/Data/Base.html">MCollective::Data::Base</a></li>
+                               
+                                       <li><a href="../MCollective/Data/Result.html">MCollective::Data::Result</a></li>
+                               
+                                       <li><a href="../MCollective/Discovery.html">MCollective::Discovery</a></li>
+                               
+                                       <li><a href="../MCollective/Facts.html">MCollective::Facts</a></li>
+                               
+                                       <li><a href="../MCollective/Facts/Base.html">MCollective::Facts::Base</a></li>
+                               
+                                       <li><a href="../MCollective/Generators.html">MCollective::Generators</a></li>
+                               
+                                       <li><a href="../MCollective/Generators/AgentGenerator.html">MCollective::Generators::AgentGenerator</a></li>
+                               
+                                       <li><a href="../MCollective/Generators/Base.html">MCollective::Generators::Base</a></li>
+                               
+                                       <li><a href="../MCollective/Generators/DataGenerator.html">MCollective::Generators::DataGenerator</a></li>
+                               
+                                       <li><a href="../MCollective/InvalidRPCData.html">MCollective::InvalidRPCData</a></li>
+                               
+                                       <li><a href="../MCollective/Log.html">MCollective::Log</a></li>
+                               
+                                       <li><a href="../MCollective/Logger.html">MCollective::Logger</a></li>
+                               
+                                       <li><a href="../MCollective/Logger/Base.html">MCollective::Logger::Base</a></li>
+                               
+                                       <li><a href="../MCollective/Logger/Console_logger.html">MCollective::Logger::Console_logger</a></li>
+                               
+                                       <li><a href="../MCollective/Logger/File_logger.html">MCollective::Logger::File_logger</a></li>
+                               
+                                       <li><a href="../MCollective/Logger/Syslog_logger.html">MCollective::Logger::Syslog_logger</a></li>
+                               
+                                       <li><a href="../MCollective/Matcher.html">MCollective::Matcher</a></li>
+                               
+                                       <li><a href="../MCollective/Matcher/Parser.html">MCollective::Matcher::Parser</a></li>
+                               
+                                       <li><a href="../MCollective/Matcher/Scanner.html">MCollective::Matcher::Scanner</a></li>
+                               
+                                       <li><a href="../MCollective/Message.html">MCollective::Message</a></li>
+                               
+                                       <li><a href="../MCollective/MissingRPCData.html">MCollective::MissingRPCData</a></li>
+                               
+                                       <li><a href="../MCollective/MsgDoesNotMatchRequestID.html">MCollective::MsgDoesNotMatchRequestID</a></li>
+                               
+                                       <li><a href="../MCollective/MsgTTLExpired.html">MCollective::MsgTTLExpired</a></li>
+                               
+                                       <li><a href="../MCollective/NotTargettedAtUs.html">MCollective::NotTargettedAtUs</a></li>
+                               
+                                       <li><a href="../MCollective/Optionparser.html">MCollective::Optionparser</a></li>
+                               
+                                       <li><a href="../MCollective/PluginManager.html">MCollective::PluginManager</a></li>
+                               
+                                       <li><a href="../MCollective/PluginPackager.html">MCollective::PluginPackager</a></li>
+                               
+                                       <li><a href="../MCollective/PluginPackager/AgentDefinition.html">MCollective::PluginPackager::AgentDefinition</a></li>
+                               
+                                       <li><a href="../MCollective/PluginPackager/StandardDefinition.html">MCollective::PluginPackager::StandardDefinition</a></li>
+                               
+                                       <li><a href="../MCollective/RPC.html">MCollective::RPC</a></li>
+                               
+                                       <li><a href="../MCollective/RPC/ActionRunner.html">MCollective::RPC::ActionRunner</a></li>
+                               
+                                       <li><a href="../MCollective/RPC/Agent.html">MCollective::RPC::Agent</a></li>
+                               
+                                       <li><a href="../MCollective/RPC/Audit.html">MCollective::RPC::Audit</a></li>
+                               
+                                       <li><a href="../MCollective/RPC/Client.html">MCollective::RPC::Client</a></li>
+                               
+                                       <li><a href="../MCollective/RPC/Helpers.html">MCollective::RPC::Helpers</a></li>
+                               
+                                       <li><a href="../MCollective/RPC/Progress.html">MCollective::RPC::Progress</a></li>
+                               
+                                       <li><a href="../MCollective/RPC/Reply.html">MCollective::RPC::Reply</a></li>
+                               
+                                       <li><a href="../MCollective/RPC/Request.html">MCollective::RPC::Request</a></li>
+                               
+                                       <li><a href="../MCollective/RPC/Result.html">MCollective::RPC::Result</a></li>
+                               
+                                       <li><a href="../MCollective/RPC/Stats.html">MCollective::RPC::Stats</a></li>
+                               
+                                       <li><a href="../MCollective/RPCAborted.html">MCollective::RPCAborted</a></li>
+                               
+                                       <li><a href="../MCollective/RPCError.html">MCollective::RPCError</a></li>
+                               
+                                       <li><a href="../MCollective/Registration.html">MCollective::Registration</a></li>
+                               
+                                       <li><a href="../MCollective/Registration/Base.html">MCollective::Registration::Base</a></li>
+                               
+                                       <li><a href="../MCollective/Runner.html">MCollective::Runner</a></li>
+                               
+                                       <li><a href="../MCollective/RunnerStats.html">MCollective::RunnerStats</a></li>
+                               
+                                       <li><a href="../MCollective/SSL.html">MCollective::SSL</a></li>
+                               
+                                       <li><a href="../MCollective/Security.html">MCollective::Security</a></li>
+                               
+                                       <li><a href="../MCollective/Security/Base.html">MCollective::Security::Base</a></li>
+                               
+                                       <li><a href="../MCollective/SecurityValidationFailed.html">MCollective::SecurityValidationFailed</a></li>
+                               
+                                       <li><a href="../MCollective/Shell.html">MCollective::Shell</a></li>
+                               
+                                       <li><a href="../MCollective/Translatable.html">MCollective::Translatable</a></li>
+                               
+                                       <li><a href="../MCollective/UnixDaemon.html">MCollective::UnixDaemon</a></li>
+                               
+                                       <li><a href="../MCollective/UnknownRPCAction.html">MCollective::UnknownRPCAction</a></li>
+                               
+                                       <li><a href="../MCollective/UnknownRPCError.html">MCollective::UnknownRPCError</a></li>
+                               
+                                       <li><a href="../MCollective/Util.html">MCollective::Util</a></li>
+                               
+                                       <li><a href="../MCollective/Validator.html">MCollective::Validator</a></li>
+                               
+                                       <li><a href="../MCollective/ValidatorError.html">MCollective::ValidatorError</a></li>
+                               
+                                       <li><a href="../MCollective/WindowsDaemon.html">MCollective::WindowsDaemon</a></li>
+                               
+                                       <li><a href="../Array.html">Array</a></li>
+                               
+                                       <li><a href="../Dir.html">Dir</a></li>
+                               
+                                       <li><a href="../Object.html">Object</a></li>
+                               
+                                       <li><a href="../String.html">String</a></li>
+                               
+                                       <li><a href="../Symbol.html">Symbol</a></li>
+                               
+                               </ul>
+                               <div id="no-class-search-results" style="display: none;">No matching classes.</div>
+                       </div>
+
+                       
+               </div>
+       </div>
+
+       <div id="documentation">
+               <h1 class="class">MCollective::Applications</h1>
+
+               <div id="description">
+                       
+               </div>
+
+               <!-- Constants -->
+               
+
+               <!-- Attributes -->
+               
+
+               <!-- Methods -->
+               
+               <div id="public-class-method-details" class="method-section section">
+                       <h3 class="section-header">Public Class Methods</h3>
+
+               
+                       <div id="--method" class="method-detail ">
+                               <a name="M000095"></a>
+
+                               <div class="method-heading">
+                               
+                                       <span class="method-name">[]</span><span
+                                               class="method-args">(appname)</span>
+                                       <span class="method-click-advice">click to toggle source</span>
+                               
+                               </div>
+
+                               <div class="method-description">
+                                       
+                                       <p class="missing-docs">(Not documented)</p>
+                                       
+
+                                       
+                                       <div class="method-source-code"
+                                               id="--source">
+<pre>
+   <span class="ruby-comment cmt"># File lib/mcollective/applications.rb, line 3</span>
+3:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-operator">[]</span>(<span class="ruby-identifier">appname</span>)
+4:       <span class="ruby-identifier">load_application</span>(<span class="ruby-identifier">appname</span>)
+5:       <span class="ruby-constant">PluginManager</span>[<span class="ruby-node">&quot;#{appname}_application&quot;</span>]
+6:     <span class="ruby-keyword kw">end</span></pre>
+                                       </div>
+                                       
+                               </div>
+
+                               
+                       </div>
+
+               
+                       <div id="filter-extra-options-method" class="method-detail ">
+                               <a name="M000099"></a>
+
+                               <div class="method-heading">
+                               
+                                       <span class="method-name">filter_extra_options</span><span
+                                               class="method-args">(opts)</span>
+                                       <span class="method-click-advice">click to toggle source</span>
+                               
+                               </div>
+
+                               <div class="method-description">
+                                       
+                                       <p>
+Filters a string of opts out using Shellwords keeping only things related
+to &#8212;config and -c
+</p>
+                                       
+
+                                       
+                                       <div class="method-source-code"
+                                               id="filter-extra-options-source">
+<pre>
+    <span class="ruby-comment cmt"># File lib/mcollective/applications.rb, line 49</span>
+49:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">filter_extra_options</span>(<span class="ruby-identifier">opts</span>)
+50:       <span class="ruby-identifier">res</span> = <span class="ruby-value str">&quot;&quot;</span>
+51:       <span class="ruby-identifier">words</span> = <span class="ruby-constant">Shellwords</span>.<span class="ruby-identifier">shellwords</span>(<span class="ruby-identifier">opts</span>)
+52:       <span class="ruby-identifier">words</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">word</span>,<span class="ruby-identifier">idx</span><span class="ruby-operator">|</span>
+53:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">word</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;-c&quot;</span>
+54:           <span class="ruby-keyword kw">return</span> <span class="ruby-node">&quot;--config=#{words[idx + 1]}&quot;</span>
+55:         <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">word</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;--config&quot;</span>
+56:           <span class="ruby-keyword kw">return</span> <span class="ruby-node">&quot;--config=#{words[idx + 1]}&quot;</span>
+57:         <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">word</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\-c=/</span>
+58:           <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">word</span>
+59:         <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">word</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\-\-config=/</span>
+60:           <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">word</span>
+61:         <span class="ruby-keyword kw">end</span>
+62:       <span class="ruby-keyword kw">end</span>
+63: 
+64:       <span class="ruby-keyword kw">return</span> <span class="ruby-value str">&quot;&quot;</span>
+65:     <span class="ruby-keyword kw">end</span></pre>
+                                       </div>
+                                       
+                               </div>
+
+                               
+                       </div>
+
+               
+                       <div id="list-method" class="method-detail ">
+                               <a name="M000098"></a>
+
+                               <div class="method-heading">
+                               
+                                       <span class="method-name">list</span><span
+                                               class="method-args">()</span>
+                                       <span class="method-click-advice">click to toggle source</span>
+                               
+                               </div>
+
+                               <div class="method-description">
+                                       
+                                       <p>
+Returns an array of applications found in the lib dirs
+</p>
+                                       
+
+                                       
+                                       <div class="method-source-code"
+                                               id="list-source">
+<pre>
+    <span class="ruby-comment cmt"># File lib/mcollective/applications.rb, line 36</span>
+36:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">list</span>
+37:       <span class="ruby-identifier">load_config</span>
+38: 
+39:       <span class="ruby-constant">PluginManager</span>.<span class="ruby-identifier">find</span>(<span class="ruby-value str">&quot;application&quot;</span>)
+40:     <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">SystemExit</span>
+41:       <span class="ruby-identifier">exit</span> <span class="ruby-value">1</span>
+42:     <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
+43:       <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Failed to generate application list: #{e.class}: #{e}&quot;</span>
+44:       <span class="ruby-identifier">exit</span> <span class="ruby-value">1</span>
+45:     <span class="ruby-keyword kw">end</span></pre>
+                                       </div>
+                                       
+                               </div>
+
+                               
+                       </div>
+
+               
+                       <div id="load-application-method" class="method-detail ">
+                               <a name="M000097"></a>
+
+                               <div class="method-heading">
+                               
+                                       <span class="method-name">load_application</span><span
+                                               class="method-args">(appname)</span>
+                                       <span class="method-click-advice">click to toggle source</span>
+                               
+                               </div>
+
+                               <div class="method-description">
+                                       
+                                       <p class="missing-docs">(Not documented)</p>
+                                       
+
+                                       
+                                       <div class="method-source-code"
+                                               id="load-application-source">
+<pre>
+    <span class="ruby-comment cmt"># File lib/mcollective/applications.rb, line 26</span>
+26:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">load_application</span>(<span class="ruby-identifier">appname</span>)
+27:       <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">PluginManager</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-node">&quot;#{appname}_application&quot;</span>)
+28: 
+29:       <span class="ruby-identifier">load_config</span>
+30: 
+31:       <span class="ruby-constant">PluginManager</span>.<span class="ruby-identifier">loadclass</span> <span class="ruby-node">&quot;MCollective::Application::#{appname.capitalize}&quot;</span>
+32:       <span class="ruby-constant">PluginManager</span> <span class="ruby-operator">&lt;&lt;</span> {<span class="ruby-identifier">:type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;#{appname}_application&quot;</span>, <span class="ruby-identifier">:class</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;MCollective::Application::#{appname.capitalize}&quot;</span>}
+33:     <span class="ruby-keyword kw">end</span></pre>
+                                       </div>
+                                       
+                               </div>
+
+                               
+                       </div>
+
+               
+                       <div id="load-config-method" class="method-detail ">
+                               <a name="M000100"></a>
+
+                               <div class="method-heading">
+                               
+                                       <span class="method-name">load_config</span><span
+                                               class="method-args">()</span>
+                                       <span class="method-click-advice">click to toggle source</span>
+                               
+                               </div>
+
+                               <div class="method-description">
+                                       
+                                       <p>
+We need to know the config file in order to know the libdir so that we can
+find applications.
+</p>
+<p>
+The problem is the CLI might be stuffed with options only the app in the
+libdir might understand so we have a chicken and egg situation.
+</p>
+<p>
+We&#8217;re parsing and filtering MCOLLECTIVE_EXTRA_OPTS removing all but
+config related options and parsing the options looking just for the config
+file.
+</p>
+<p>
+We&#8217;re handling failures gracefully and finally restoring the ARG and
+MCOLLECTIVE_EXTRA_OPTS to the state they were before we started parsing.
+</p>
+<p>
+This is mostly a hack, when we&#8217;re redoing how config works this stuff
+should be made less sucky
+</p>
+                                       
+
+                                       
+                                       <div class="method-source-code"
+                                               id="load-config-source">
+<pre>
+     <span class="ruby-comment cmt"># File lib/mcollective/applications.rb, line 84</span>
+ 84:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">load_config</span>
+ 85:       <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Config</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">configured</span>
+ 86: 
+ 87:       <span class="ruby-identifier">original_argv</span> = <span class="ruby-constant">ARGV</span>.<span class="ruby-identifier">clone</span>
+ 88:       <span class="ruby-identifier">original_extra_opts</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">&quot;MCOLLECTIVE_EXTRA_OPTS&quot;</span>].<span class="ruby-identifier">clone</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
+ 89:       <span class="ruby-identifier">configfile</span> = <span class="ruby-keyword kw">nil</span>
+ 90: 
+ 91:       <span class="ruby-identifier">parser</span> = <span class="ruby-constant">OptionParser</span>.<span class="ruby-identifier">new</span>
+ 92:       <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;--config CONFIG&quot;</span>, <span class="ruby-value str">&quot;-c&quot;</span>, <span class="ruby-value str">&quot;Config file&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
+ 93:         <span class="ruby-identifier">configfile</span> = <span class="ruby-identifier">f</span>
+ 94:       <span class="ruby-keyword kw">end</span>
+ 95: 
+ 96:       <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">program_name</span> = <span class="ruby-identifier">$0</span>
+ 97: 
+ 98:       <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;--help&quot;</span>)
+ 99: 
+100:       <span class="ruby-comment cmt"># avoid option parsers own internal version handling that sux</span>
+101:       <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-v&quot;</span>, <span class="ruby-value str">&quot;--verbose&quot;</span>)
+102: 
+103:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">original_extra_opts</span>
+104:         <span class="ruby-keyword kw">begin</span>
+105:           <span class="ruby-comment cmt"># optparse will parse the whole ENV in one go and refuse</span>
+106:           <span class="ruby-comment cmt"># to play along with the retry trick I do below so in</span>
+107:           <span class="ruby-comment cmt"># order to handle unknown options properly I parse out</span>
+108:           <span class="ruby-comment cmt"># only -c and --config deleting everything else and</span>
+109:           <span class="ruby-comment cmt"># then restore the environment variable later when I</span>
+110:           <span class="ruby-comment cmt"># am done with it</span>
+111:           <span class="ruby-constant">ENV</span>[<span class="ruby-value str">&quot;MCOLLECTIVE_EXTRA_OPTS&quot;</span>] = <span class="ruby-identifier">filter_extra_options</span>(<span class="ruby-constant">ENV</span>[<span class="ruby-value str">&quot;MCOLLECTIVE_EXTRA_OPTS&quot;</span>].<span class="ruby-identifier">clone</span>)
+112:           <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">environment</span>(<span class="ruby-value str">&quot;MCOLLECTIVE_EXTRA_OPTS&quot;</span>)
+113:         <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
+114:           <span class="ruby-constant">Log</span>.<span class="ruby-identifier">error</span>(<span class="ruby-node">&quot;Failed to parse MCOLLECTIVE_EXTRA_OPTS: #{e}&quot;</span>)
+115:         <span class="ruby-keyword kw">end</span>
+116: 
+117:         <span class="ruby-constant">ENV</span>[<span class="ruby-value str">&quot;MCOLLECTIVE_EXTRA_OPTS&quot;</span>] = <span class="ruby-identifier">original_extra_opts</span>.<span class="ruby-identifier">clone</span>
+118:       <span class="ruby-keyword kw">end</span>
+119: 
+120:       <span class="ruby-keyword kw">begin</span>
+121:         <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">parse!</span>
+122:       <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">OptionParser</span><span class="ruby-operator">::</span><span class="ruby-constant">InvalidOption</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
+123:         <span class="ruby-keyword kw">retry</span>
+124:       <span class="ruby-keyword kw">end</span>
+125: 
+126:       <span class="ruby-constant">ARGV</span>.<span class="ruby-identifier">clear</span>
+127:       <span class="ruby-identifier">original_argv</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-constant">ARGV</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">a</span>}
+128: 
+129:       <span class="ruby-identifier">configfile</span> = <span class="ruby-constant">Util</span>.<span class="ruby-identifier">config_file_for_user</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">configfile</span>
+130: 
+131:       <span class="ruby-constant">Config</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">loadconfig</span>(<span class="ruby-identifier">configfile</span>)
+132:     <span class="ruby-keyword kw">end</span></pre>
+                                       </div>
+                                       
+                               </div>
+
+                               
+                       </div>
+
+               
+                       <div id="run-method" class="method-detail ">
+                               <a name="M000096"></a>
+
+                               <div class="method-heading">
+                               
+                                       <span class="method-name">run</span><span
+                                               class="method-args">(appname)</span>
+                                       <span class="method-click-advice">click to toggle source</span>
+                               
+                               </div>
+
+                               <div class="method-description">
+                                       
+                                       <p class="missing-docs">(Not documented)</p>
+                                       
+
+                                       
+                                       <div class="method-source-code"
+                                               id="run-source">
+<pre>
+    <span class="ruby-comment cmt"># File lib/mcollective/applications.rb, line 8</span>
+ 8:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">run</span>(<span class="ruby-identifier">appname</span>)
+ 9:       <span class="ruby-identifier">load_config</span>
+10: 
+11:       <span class="ruby-keyword kw">begin</span>
+12:         <span class="ruby-identifier">load_application</span>(<span class="ruby-identifier">appname</span>)
+13:       <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
+14:         <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Util</span>.<span class="ruby-identifier">colorize</span>(<span class="ruby-identifier">:red</span>, <span class="ruby-value str">&quot;  &lt;----&quot;</span>)
+15:         <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Application '#{appname}' failed to load:&quot;</span>
+16:         <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span>
+17:         <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-constant">Util</span>.<span class="ruby-identifier">colorize</span>(<span class="ruby-identifier">:red</span>, <span class="ruby-node">&quot;   #{e} (#{e.class})&quot;</span>)
+18:         <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span>
+19:         <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;       %s&quot;</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;\n       &quot;</span>)]
+20:         <span class="ruby-identifier">exit</span> <span class="ruby-value">1</span>
+21:       <span class="ruby-keyword kw">end</span>
+22: 
+23:       <span class="ruby-constant">PluginManager</span>[<span class="ruby-node">&quot;#{appname}_application&quot;</span>].<span class="ruby-identifier">run</span>
+24:     <span class="ruby-keyword kw">end</span></pre>
+                                       </div>
+                                       
+                               </div>
+
+                               
+                       </div>
+
+               
+               </div>
+       
+
+       </div>
+
+
+       <div id="rdoc-debugging-section-dump" class="debugging-section">
+       
+               <p>Disabled; run with --debug to generate this.</p>
+       
+       </div>
+
+       <div id="validator-badges">
+               <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+               <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
+                       Rdoc Generator</a> 1.1.6</small>.</p>
+       </div>
+
+</body>
+</html>
+