From 92e37006129b632941c92d64f841cde593950c2a Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 28 Jul 2011 17:03:16 +0000 Subject: [PATCH] add streaming to genimage defeict 3374073 git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10183 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/genimage.pm | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/genimage.pm b/xCAT-server/lib/xcat/plugins/genimage.pm index d18cb466e..65da1995f 100644 --- a/xCAT-server/lib/xcat/plugins/genimage.pm +++ b/xCAT-server/lib/xcat/plugins/genimage.pm @@ -8,7 +8,7 @@ use xCAT::Utils; use xCAT::SvrUtils; use xCAT::Table; use Data::Dumper; - +use File::Path; use Getopt::Long; Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); @@ -289,12 +289,21 @@ sub process_request { $cmd.= " $imagename"; } - + # now run the specific genimage command $callback->({info=>["$cmd"]}); - - my $output = xCAT::Utils->runcmd("$cmd", 0, 1); + $::CALLBACK=$callback; + #my $output = xCAT::Utils->runcmd("$cmd", 0, 1); + my $output = xCAT::Utils->runcmd_S("$cmd", 0, 1); # stream output + open(FILE, ">/tmp/genimageoutput"); + foreach my $entry (@$output) { + print FILE $entry; + print FILE "\n"; + } + close FILE; #save the new settings to the osimage and linuximage tables + $cmd="cat /tmp/genimageoutput"; + $output = xCAT::Utils->runcmd("$cmd", 0, 1); if ($output && (@$output > 0)) { my $i=0; while ($i < @$output) { @@ -337,9 +346,11 @@ sub process_request { $i++; } } - + # remove tmp file + #`rm /tmp/genimageoutput`; #remove the database upgrade section - $callback->({info=>$output}); + # runcmd_S displays the output + #$callback->({info=>$output}); } }