mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
feature #863: Adds support for ssh_streams to OpenNebulaDriver
This commit is contained in:
parent
e4cae17f92
commit
300f2a6633
@ -92,17 +92,27 @@ class OpenNebulaDriver < ActionManager
|
||||
# @option ops [String] :local if defined will execute the action locally
|
||||
def do_action(parameters, id, host, aname, ops={})
|
||||
options={
|
||||
:stdin => nil,
|
||||
:stdin => nil,
|
||||
:script_name => nil,
|
||||
:respond => true
|
||||
:respond => true,
|
||||
:ssh_stream => nil
|
||||
}.merge(ops)
|
||||
|
||||
params = parameters+" #{id} #{host}"
|
||||
|
||||
command = action_command_line(aname, params, options[:script_name])
|
||||
|
||||
if ops[:local] || action_is_local? aname
|
||||
if options[:local] || action_is_local? aname
|
||||
execution = LocalCommand.run(command, log_method(id))
|
||||
elsif options[:ssh_stream]
|
||||
if options[:stdin]
|
||||
command = "cat << EOT | #{command}"
|
||||
stdin = "#{options[:stdin]\nEOT\n}"
|
||||
else
|
||||
stdin = nil
|
||||
end
|
||||
|
||||
execution = options[:ssh_stream].run(command,stdin)
|
||||
|
||||
else
|
||||
execution = RemotesCommand.run(command,
|
||||
host,
|
||||
@ -114,13 +124,14 @@ class OpenNebulaDriver < ActionManager
|
||||
|
||||
result, info = get_info_from_execution(execution)
|
||||
|
||||
if ops[:respond]
|
||||
if options[:respond]
|
||||
send_message(aname,result,id,info)
|
||||
end
|
||||
|
||||
[result, info]
|
||||
end
|
||||
|
||||
|
||||
# Start the driver. Reads from STDIN and executes methods associated with
|
||||
# the messages
|
||||
def start_driver
|
||||
|
Loading…
x
Reference in New Issue
Block a user