summaryrefslogtreecommitdiffstats
path: root/cloud.rb
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2014-09-29 09:33:41 -0700
committerJhon Honce <jhonce@redhat.com>2014-09-29 09:33:41 -0700
commita24bcdcb743e844d9ad738b78cc98dcd9a778659 (patch)
tree148ef743450832e49e5d57362ea7ef7340e14f9f /cloud.rb
parentf08516929901730dc3b003f0942dbbd630663a80 (diff)
downloadopenshift-a24bcdcb743e844d9ad738b78cc98dcd9a778659.tar.gz
openshift-a24bcdcb743e844d9ad738b78cc98dcd9a778659.tar.bz2
openshift-a24bcdcb743e844d9ad738b78cc98dcd9a778659.tar.xz
openshift-a24bcdcb743e844d9ad738b78cc98dcd9a778659.zip
WIP Infra - Update reporting in cloud.rb
Diffstat (limited to 'cloud.rb')
-rwxr-xr-xcloud.rb20
1 files changed, 15 insertions, 5 deletions
diff --git a/cloud.rb b/cloud.rb
index 840742b8c..0a6097ee7 100755
--- a/cloud.rb
+++ b/cloud.rb
@@ -8,6 +8,10 @@ require 'fileutils'
require 'parseconfig'
require 'open3'
+# Don't buffer output to the client
+STDOUT.sync = true
+STDERR.sync = true
+
SCRIPT_DIR = File.expand_path(File.dirname(__FILE__))
module OpenShift
@@ -102,6 +106,10 @@ module OpenShift
@pipelining = true
end
+ def all_eof(files)
+ files.find { |f| !f.eof }.nil?
+ end
+
def run_playbook(playbook)
@inventory = 'inventory/hosts' if @inventory.nil?
@@ -123,13 +131,15 @@ module OpenShift
cmd = cmds.join(' ; ')
- stdout, stderr, status = Open3.capture3(cmd)
- if 0 != status.exitstatus
- raise %Q[Following command failed with exit code: #{status.exitstatus}
+ pid = spawn(cmd, :out => $stdout, :err => $stderr, :close_others => true)
+ _, state = Process.wait2(pid)
+
+ if 0 != state.exitstatus
+ raise %Q[Warning failed with exit code: #{state.exitstatus}
+
#{cmd}
+
extra_vars: #{@extra_vars.to_json}
-stdout: #{stdout}
-stderr: #{stderr}
]
end
ensure