From adc5ba8b5c6cfd579541d60b4e74dd2b14865be6 Mon Sep 17 00:00:00 2001 From: sakolish Date: Fri, 7 Dec 2007 16:10:10 +0000 Subject: [PATCH] Send verbose ouput along with results in 1 callback intead of 2 in invoke_cmd() function - Line #499 git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@147 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT-2.0/xCAT/PPC.pm | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/perl-xCAT-2.0/xCAT/PPC.pm b/perl-xCAT-2.0/xCAT/PPC.pm index c7c7886a9..d7397217b 100644 --- a/perl-xCAT-2.0/xCAT/PPC.pm +++ b/perl-xCAT-2.0/xCAT/PPC.pm @@ -504,8 +504,9 @@ sub invoke_cmd { my $hwtype = $request->{hwtype}; my $verbose = $request->{verbose}; my @exp; + my $verbose_log; my @outhash; - + ######################################## # Direct-attached FSP handler ######################################## @@ -525,15 +526,20 @@ sub invoke_cmd { # Output verbose Perl::LWP #################################### if ( $verbose ) { - my $lwp_log = $exp[3]; - send_msg( $request, $$lwp_log ); + $verbose_log = $exp[3]; + + my %output; + $output{data} = [$$verbose_log]; + unshift @$result, \%output; } my $out = $request->{pipe}; print $out freeze( $result ); print $out "\nENDOFFREEZE6sK4ci\n"; return; } + ######################################## + # HMC and IVM-managed handler # Connect to list of remote servers ######################################## foreach ( split /,/, $host ) { @@ -564,26 +570,34 @@ sub invoke_cmd { xCAT::PPCcli::disconnect( \@exp ); ######################################## - # Output verbose Expect + # Get verbose Expect output ######################################## if ( $verbose ) { - my $expect_log = $exp[6]; - send_msg( $request, $$expect_log ); + $verbose_log = $exp[6]; } ######################################## # Return error ######################################## if ( ref($result) ne 'ARRAY' ) { - send_msg( $request, $result ); + send_msg( $request, $$verbose_log.$result ); return; } ######################################## + # Prepend verbose output + ######################################## + if ( defined( $verbose_log )) { + my %output; + $output{data} = [$$verbose_log]; + push @outhash, \%output; + } + ######################################## # Send result back to parent process ######################################## if ( @$result[0] eq "FORMATDATA6sK4ci" ) { - shift(@$result); my $out = $request->{pipe}; - print $out freeze( [@$result] ); + + push @outhash, @$result[1]; + print $out freeze( [@outhash] ); print $out "\nENDOFFREEZE6sK4ci\n"; return; }