diff options
author | Jhon Honce <jhonce@redhat.com> | 2014-09-29 09:33:41 -0700 |
---|---|---|
committer | Jhon Honce <jhonce@redhat.com> | 2014-09-29 09:33:41 -0700 |
commit | a24bcdcb743e844d9ad738b78cc98dcd9a778659 (patch) | |
tree | 148ef743450832e49e5d57362ea7ef7340e14f9f | |
parent | f08516929901730dc3b003f0942dbbd630663a80 (diff) | |
download | openshift-a24bcdcb743e844d9ad738b78cc98dcd9a778659.tar.gz openshift-a24bcdcb743e844d9ad738b78cc98dcd9a778659.tar.bz2 openshift-a24bcdcb743e844d9ad738b78cc98dcd9a778659.tar.xz openshift-a24bcdcb743e844d9ad738b78cc98dcd9a778659.zip |
WIP Infra - Update reporting in cloud.rb
-rwxr-xr-x | cloud.rb | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -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 |