--- /dev/null
+<?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::RPC::ActionRunner</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/rpc/actionrunner_rb.html?TB_iframe=true&height=550&width=785"
+ class="thickbox" title="lib/mcollective/rpc/actionrunner.rb">lib/mcollective/rpc/actionrunner.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="#M000372">::new</a></li>
+
+ <li><a href="#M000379">#canrun?</a></li>
+
+ <li><a href="#M000376">#load_json_results</a></li>
+
+ <li><a href="#M000375">#load_results</a></li>
+
+ <li><a href="#M000382">#path_to_command</a></li>
+
+ <li><a href="#M000373">#run</a></li>
+
+ <li><a href="#M000378">#save_json_request</a></li>
+
+ <li><a href="#M000377">#saverequest</a></li>
+
+ <li><a href="#M000374">#shell</a></li>
+
+ <li><a href="#M000381">#tempfile</a></li>
+
+ <li><a href="#M000380">#to_s</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::RPC::ActionRunner</h1>
+
+ <div id="description">
+ <p>
+A helper used by <a href="Agent.html#M000415">RPC::Agent#implemented_by</a>
+to delegate an action to an external script. At present only JSON based
+serialization is supported in future ones based on key=val pairs etc will
+be added
+</p>
+<p>
+It serializes the request object into an input file and creates an empty
+output file. It then calls the external command reading the output file at
+the end.
+</p>
+<p>
+any STDERR gets logged at error level and any STDOUT gets logged at info
+level.
+</p>
+<p>
+It will interpret the exit code from the application the same way <a
+href="Reply.html#M000386">RPC::Reply#fail!</a> and fail handles their codes
+creating a consistent interface, the message part of the fail message will
+come from STDERR
+</p>
+<p>
+Generally externals should just exit with code 1 on failure and print to
+STDERR, this is exactly what Perl die() does and translates perfectly to
+our model
+</p>
+<p>
+It uses the <a href="../Shell.html">MCollective::Shell</a> wrapper to call
+the external application
+</p>
+
+ </div>
+
+ <!-- Constants -->
+
+
+ <!-- Attributes -->
+
+ <div id="attribute-method-details" class="method-section section">
+ <h3 class="section-header">Attributes</h3>
+
+
+ <div id="command-attribute-method" class="method-detail">
+ <a name="command"></a>
+
+ <div class="method-heading attribute-method-heading">
+ <span class="method-name">command</span><span
+ class="attribute-access-type">[R]</span>
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+ </div>
+ </div>
+
+ <div id="agent-attribute-method" class="method-detail">
+ <a name="agent"></a>
+
+ <div class="method-heading attribute-method-heading">
+ <span class="method-name">agent</span><span
+ class="attribute-access-type">[R]</span>
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+ </div>
+ </div>
+
+ <div id="action-attribute-method" class="method-detail">
+ <a name="action"></a>
+
+ <div class="method-heading attribute-method-heading">
+ <span class="method-name">action</span><span
+ class="attribute-access-type">[R]</span>
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+ </div>
+ </div>
+
+ <div id="format-attribute-method" class="method-detail">
+ <a name="format"></a>
+
+ <div class="method-heading attribute-method-heading">
+ <span class="method-name">format</span><span
+ class="attribute-access-type">[R]</span>
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+ </div>
+ </div>
+
+ <div id="stdout-attribute-method" class="method-detail">
+ <a name="stdout"></a>
+
+ <div class="method-heading attribute-method-heading">
+ <span class="method-name">stdout</span><span
+ class="attribute-access-type">[R]</span>
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+ </div>
+ </div>
+
+ <div id="stderr-attribute-method" class="method-detail">
+ <a name="stderr"></a>
+
+ <div class="method-heading attribute-method-heading">
+ <span class="method-name">stderr</span><span
+ class="attribute-access-type">[R]</span>
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+ </div>
+ </div>
+
+ <div id="request-attribute-method" class="method-detail">
+ <a name="request"></a>
+
+ <div class="method-heading attribute-method-heading">
+ <span class="method-name">request</span><span
+ class="attribute-access-type">[R]</span>
+ </div>
+
+ <div class="method-description">
+
+ <p class="missing-docs">(Not documented)</p>
+
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- Methods -->
+
+ <div id="public-class-method-details" class="method-section section">
+ <h3 class="section-header">Public Class Methods</h3>
+
+
+ <div id="new-method" class="method-detail ">
+ <a name="M000372"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">new</span><span
+ class="method-args">(command, request, format=:json)</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="new-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/mcollective/rpc/actionrunner.rb, line 26</span>
+26: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">command</span>, <span class="ruby-identifier">request</span>, <span class="ruby-identifier">format</span>=<span class="ruby-identifier">:json</span>)
+27: <span class="ruby-ivar">@agent</span> = <span class="ruby-identifier">request</span>.<span class="ruby-identifier">agent</span>
+28: <span class="ruby-ivar">@action</span> = <span class="ruby-identifier">request</span>.<span class="ruby-identifier">action</span>
+29: <span class="ruby-ivar">@format</span> = <span class="ruby-identifier">format</span>
+30: <span class="ruby-ivar">@request</span> = <span class="ruby-identifier">request</span>
+31: <span class="ruby-ivar">@command</span> = <span class="ruby-identifier">path_to_command</span>(<span class="ruby-identifier">command</span>)
+32: <span class="ruby-ivar">@stdout</span> = <span class="ruby-value str">""</span>
+33: <span class="ruby-ivar">@stderr</span> = <span class="ruby-value str">""</span>
+34: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+ <div id="public-instance-method-details" class="method-section section">
+ <h3 class="section-header">Public Instance Methods</h3>
+
+
+ <div id="canrun--method" class="method-detail ">
+ <a name="M000379"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">canrun?</span><span
+ class="method-args">(command)</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="canrun--source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/mcollective/rpc/actionrunner.rb, line 117</span>
+117: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">canrun?</span>(<span class="ruby-identifier">command</span>)
+118: <span class="ruby-constant">File</span>.<span class="ruby-identifier">executable?</span>(<span class="ruby-identifier">command</span>)
+119: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="load-json-results-method" class="method-detail ">
+ <a name="M000376"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">load_json_results</span><span
+ class="method-args">(file)</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-json-results-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/mcollective/rpc/actionrunner.rb, line 91</span>
+91: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_json_results</span>(<span class="ruby-identifier">file</span>)
+92: <span class="ruby-keyword kw">return</span> {} <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">readable?</span>(<span class="ruby-identifier">file</span>)
+93:
+94: <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">load</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">file</span>)) <span class="ruby-operator">||</span> {}
+95: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">JSON</span><span class="ruby-operator">::</span><span class="ruby-constant">ParserError</span>
+96: {}
+97: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="load-results-method" class="method-detail ">
+ <a name="M000375"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">load_results</span><span
+ class="method-args">(file)</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-results-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/mcollective/rpc/actionrunner.rb, line 73</span>
+73: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_results</span>(<span class="ruby-identifier">file</span>)
+74: <span class="ruby-constant">Log</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-node">"Attempting to load results in #{format} format from #{file}"</span>)
+75:
+76: <span class="ruby-identifier">data</span> = {}
+77:
+78: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-node">"load_#{format}_results"</span>)
+79: <span class="ruby-identifier">tempdata</span> = <span class="ruby-identifier">send</span>(<span class="ruby-node">"load_#{format}_results"</span>, <span class="ruby-identifier">file</span>)
+80:
+81: <span class="ruby-identifier">tempdata</span>.<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
+82: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">k</span>.<span class="ruby-identifier">to_sym</span>] = <span class="ruby-identifier">v</span>
+83: <span class="ruby-keyword kw">end</span>
+84: <span class="ruby-keyword kw">end</span>
+85:
+86: <span class="ruby-identifier">data</span>
+87: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
+88: {}
+89: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="path-to-command-method" class="method-detail ">
+ <a name="M000382"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">path_to_command</span><span
+ class="method-args">(command)</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="path-to-command-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/mcollective/rpc/actionrunner.rb, line 129</span>
+129: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">path_to_command</span>(<span class="ruby-identifier">command</span>)
+130: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">command</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">SEPARATOR</span>
+131: <span class="ruby-constant">Config</span>.<span class="ruby-identifier">instance</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>
+132: <span class="ruby-identifier">command_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">libdir</span>, <span class="ruby-value str">"agent"</span>, <span class="ruby-identifier">agent</span>, <span class="ruby-identifier">command</span>)
+133:
+134: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">command_file</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">command_file</span>)
+135: <span class="ruby-keyword kw">end</span>
+136: <span class="ruby-keyword kw">end</span>
+137:
+138: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">command</span>
+139: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="run-method" class="method-detail ">
+ <a name="M000373"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">run</span><span
+ class="method-args">()</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/rpc/actionrunner.rb, line 36</span>
+36: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>
+37: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">canrun?</span>(<span class="ruby-identifier">command</span>)
+38: <span class="ruby-constant">Log</span>.<span class="ruby-identifier">warn</span>(<span class="ruby-node">"Cannot run #{to_s}"</span>)
+39: <span class="ruby-identifier">raise</span> <span class="ruby-constant">RPCAborted</span>, <span class="ruby-node">"Cannot execute #{to_s}"</span>
+40: <span class="ruby-keyword kw">end</span>
+41:
+42: <span class="ruby-constant">Log</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-node">"Running #{to_s}"</span>)
+43:
+44: <span class="ruby-identifier">request_file</span> = <span class="ruby-identifier">saverequest</span>(<span class="ruby-identifier">request</span>)
+45: <span class="ruby-identifier">reply_file</span> = <span class="ruby-identifier">tempfile</span>(<span class="ruby-value str">"reply"</span>)
+46: <span class="ruby-identifier">reply_file</span>.<span class="ruby-identifier">close</span>
+47:
+48: <span class="ruby-identifier">runner</span> = <span class="ruby-identifier">shell</span>(<span class="ruby-identifier">command</span>, <span class="ruby-identifier">request_file</span>.<span class="ruby-identifier">path</span>, <span class="ruby-identifier">reply_file</span>.<span class="ruby-identifier">path</span>)
+49:
+50: <span class="ruby-identifier">runner</span>.<span class="ruby-identifier">runcommand</span>
+51:
+52: <span class="ruby-constant">Log</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-node">"#{command} exited with #{runner.status.exitstatus}"</span>)
+53:
+54: <span class="ruby-identifier">stderr</span>.<span class="ruby-identifier">each_line</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span> <span class="ruby-constant">Log</span>.<span class="ruby-identifier">error</span>(<span class="ruby-node">"#{to_s}: #{l.chomp}"</span>)} <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">stderr</span>.<span class="ruby-identifier">empty?</span>
+55: <span class="ruby-identifier">stdout</span>.<span class="ruby-identifier">each_line</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span> <span class="ruby-constant">Log</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">"#{to_s}: #{l.chomp}"</span>)} <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">stdout</span>.<span class="ruby-identifier">empty?</span>
+56:
+57: {<span class="ruby-identifier">:exitstatus</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">runner</span>.<span class="ruby-identifier">status</span>.<span class="ruby-identifier">exitstatus</span>,
+58: <span class="ruby-identifier">:stdout</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">runner</span>.<span class="ruby-identifier">stdout</span>,
+59: <span class="ruby-identifier">:stderr</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">runner</span>.<span class="ruby-identifier">stderr</span>,
+60: <span class="ruby-identifier">:data</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">load_results</span>(<span class="ruby-identifier">reply_file</span>.<span class="ruby-identifier">path</span>)}
+61: <span class="ruby-keyword kw">ensure</span>
+62: <span class="ruby-identifier">request_file</span>.<span class="ruby-identifier">close!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request_file</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">"close!"</span>)
+63: <span class="ruby-identifier">reply_file</span>.<span class="ruby-identifier">close!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">reply_file</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">"close"</span>)
+64: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="save-json-request-method" class="method-detail ">
+ <a name="M000378"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">save_json_request</span><span
+ class="method-args">(req)</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="save-json-request-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/mcollective/rpc/actionrunner.rb, line 113</span>
+113: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">save_json_request</span>(<span class="ruby-identifier">req</span>)
+114: <span class="ruby-identifier">req</span>.<span class="ruby-identifier">to_json</span>
+115: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="saverequest-method" class="method-detail ">
+ <a name="M000377"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">saverequest</span><span
+ class="method-args">(req)</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="saverequest-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/mcollective/rpc/actionrunner.rb, line 99</span>
+ 99: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">saverequest</span>(<span class="ruby-identifier">req</span>)
+100: <span class="ruby-constant">Log</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-node">"Attempting to save request in #{format} format"</span>)
+101:
+102: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-node">"save_#{format}_request"</span>)
+103: <span class="ruby-identifier">data</span> = <span class="ruby-identifier">send</span>(<span class="ruby-node">"save_#{format}_request"</span>, <span class="ruby-identifier">req</span>)
+104:
+105: <span class="ruby-identifier">request_file</span> = <span class="ruby-identifier">tempfile</span>(<span class="ruby-value str">"request"</span>)
+106: <span class="ruby-identifier">request_file</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">data</span>
+107: <span class="ruby-identifier">request_file</span>.<span class="ruby-identifier">close</span>
+108: <span class="ruby-keyword kw">end</span>
+109:
+110: <span class="ruby-identifier">request_file</span>
+111: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="shell-method" class="method-detail ">
+ <a name="M000374"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">shell</span><span
+ class="method-args">(command, infile, outfile)</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="shell-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/mcollective/rpc/actionrunner.rb, line 66</span>
+66: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">shell</span>(<span class="ruby-identifier">command</span>, <span class="ruby-identifier">infile</span>, <span class="ruby-identifier">outfile</span>)
+67: <span class="ruby-identifier">env</span> = {<span class="ruby-value str">"MCOLLECTIVE_REQUEST_FILE"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">infile</span>,
+68: <span class="ruby-value str">"MCOLLECTIVE_REPLY_FILE"</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">outfile</span>}
+69:
+70: <span class="ruby-constant">Shell</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"#{command} #{infile} #{outfile}"</span>, <span class="ruby-identifier">:cwd</span> =<span class="ruby-operator">></span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">tmpdir</span>, <span class="ruby-identifier">:stdout</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">stdout</span>, <span class="ruby-identifier">:stderr</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">stderr</span>, <span class="ruby-identifier">:environment</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">env</span>)
+71: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="tempfile-method" class="method-detail ">
+ <a name="M000381"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">tempfile</span><span
+ class="method-args">(prefix)</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="tempfile-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/mcollective/rpc/actionrunner.rb, line 125</span>
+125: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tempfile</span>(<span class="ruby-identifier">prefix</span>)
+126: <span class="ruby-constant">Tempfile</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"mcollective_#{prefix}"</span>, <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">tmpdir</span>)
+127: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <div id="to-s-method" class="method-detail ">
+ <a name="M000380"></a>
+
+ <div class="method-heading">
+
+ <span class="method-name">to_s</span><span
+ class="method-args">()</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="to-s-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/mcollective/rpc/actionrunner.rb, line 121</span>
+121: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+122: <span class="ruby-value str">"%s#%s command: %s"</span> <span class="ruby-operator">%</span> [ <span class="ruby-identifier">agent</span>, <span class="ruby-identifier">action</span>, <span class="ruby-identifier">command</span> ]
+123: <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>
+