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
This commit is contained in:
sakolish 2007-12-07 16:10:10 +00:00
parent 74524b8299
commit adc5ba8b5c

View File

@ -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;
}