1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-27 14:03:40 +03:00

feature #1739: IM driver returns information encoded in base64

This commit is contained in:
Ruben S. Montero 2013-02-09 13:33:41 +01:00
parent eb82280d92
commit e8a3f17ef0
2 changed files with 13 additions and 8 deletions

View File

@ -71,8 +71,9 @@ class InformationManagerDriver < OpenNebulaDriver
end
end
end
do_action("#{@hypervisor}", number, host, :MONITOR,
:script_name => 'run_probes')
:script_name => 'run_probes', :base64 => true)
end
end

View File

@ -18,6 +18,7 @@ require "ActionManager"
require "CommandManager"
require "DriverExecHelper"
require 'base64'
# This class provides basic messaging and logging functionality
# to implement OpenNebula Drivers. A driver is a program that
@ -78,13 +79,15 @@ class OpenNebulaDriver < ActionManager
# @option ops [String] :stdin text to be writen to stdin
# @option ops [String] :script_name default script name for the action,
# action name is used by defaults
# @option ops [String] :respond if defined will send result to ONE core
# @option ops [Bool] :respond if defined will send result to ONE core
# @option ops [Bool] :base64 encode the information sent to ONE core
def do_action(parameters, id, host, aname, ops={})
options={
:stdin => nil,
:script_name => nil,
:respond => true,
:ssh_stream => nil
:ssh_stream => nil,
:base64 => false
}.merge(ops)
params = parameters + " #{id} #{host}"
@ -115,6 +118,7 @@ class OpenNebulaDriver < ActionManager
result, info = get_info_from_execution(execution)
if options[:respond]
info = Base64::encode64(info).strip.delete("\n") if options[:base64]
send_message(aname, result, id, info)
end