mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-20 20:02:38 +09:00
* B #1964: Disable bash verbosity on tm_mad/ssh/mvds * B #1964: SSH or LocalCommand hangs on large stderr
This commit is contained in:
1 parent
e1ab5cf3b0
commit
0c9c2e4880
2 files changed
+8
-21
No files matched your search
@@ -83,22 +83,9 @@ class GenericCommand
|
||||
def run
|
||||
std = nil
|
||||
process = Proc.new do
|
||||
std = execute
|
||||
@stdout, @stderr, _status = execute
|
||||
|
||||
# Close standard IO descriptors
|
||||
if @stdin
|
||||
std[0] << @stdin
|
||||
std[0].flush
|
||||
end
|
||||
std[0].close if !std[0].closed?
|
||||
|
||||
@stdout=std[1].read
|
||||
std[1].close if !std[1].closed?
|
||||
|
||||
@stderr=std[2].read
|
||||
std[2].close if !std[2].closed?
|
||||
|
||||
@code=get_exit_code(@stderr)
|
||||
@code = get_exit_code(@stderr)
|
||||
|
||||
if @code!=0
|
||||
log("Command execution fail: #{command}")
|
||||
@@ -161,8 +148,8 @@ class LocalCommand < GenericCommand
|
||||
private
|
||||
|
||||
def execute
|
||||
Open3.popen3("#{command} ; echo ExitCode: $? 1>&2",
|
||||
:pgroup => true)
|
||||
Open3.capture3("#{command} ; echo ExitCode: $? 1>&2",
|
||||
:pgroup => true, :stdin_data => @stdin)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -189,10 +176,10 @@ private
|
||||
|
||||
def execute
|
||||
if @stdin
|
||||
Open3.popen3("ssh #{@host} #{@command} ; echo ExitCode: $? 1>&2",
|
||||
:pgroup => true)
|
||||
Open3.capture3("ssh #{@host} #{@command} ; echo ExitCode: $? 1>&2",
|
||||
:pgroup => true, :stdin_data => @stdin)
|
||||
else
|
||||
Open3.popen3("ssh -n #{@host} #{@command} ; echo ExitCode: $? 1>&2",
|
||||
Open3.capture3("ssh -n #{@host} #{@command} ; echo ExitCode: $? 1>&2",
|
||||
:pgroup => true)
|
||||
end
|
||||
end
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash -x
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #
|
||||
|
||||
Reference in new issue
Block a user