From 8ec5423abe98d22ec917048253488cfa59f09d93 Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 9 Nov 2009 19:08:40 +0000 Subject: [PATCH] fix defect 2880329 and change so that nodes output is returned on per node finish basis and not after all nodes are finished. That is nolonger uses the api interface git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4521 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/DSHCLI.pm | 56 ++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index 94006a30b..a62cc9d3b 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -533,14 +533,31 @@ sub _execute_dsh . join("", @{$error_buffers{$user_target}}); if ($$options{'display_output'}) { - print STDOUT @{$output_buffers{$user_target}}; - print STDERR @{$error_buffers{$user_target}}; + # print STDOUT @{$output_buffers{$user_target}}; + # print STDERR @{$error_buffers{$user_target}}; + chomp (@{$output_buffers{$user_target}}); + chomp (@{$error_buffers{$user_target}}); + my $rsp = {}; + push @{$rsp->{data}},@{$output_buffers{$user_target}}; + xCAT::MsgUtils->message("D", $rsp,$::CALLBACK); + $rsp = {}; + push @{$rsp->{data}},@{$error_buffers{$user_target}}; + xCAT::MsgUtils->message("D", $rsp,$::CALLBACK); } } else { - print STDOUT @{$output_buffers{$user_target}}; - print STDERR @{$error_buffers{$user_target}}; + #print STDOUT @{$output_buffers{$user_target}}; + #print STDERR @{$error_buffers{$user_target}}; + chomp (@{$output_buffers{$user_target}}); + chomp (@{$error_buffers{$user_target}}); + my $rsp = {}; + push @{$rsp->{data}},@{$output_buffers{$user_target}}; + xCAT::MsgUtils->message("D", $rsp,$::CALLBACK); + $rsp = {}; + push @{$rsp->{data}},@{$error_buffers{$user_target}}; + xCAT::MsgUtils->message("D", $rsp,$::CALLBACK); + } } @@ -554,9 +571,9 @@ sub _execute_dsh if ($exit_code != 0) { - $rsp->{data}->[0] = - " $user_target remote Command return code = $exit_code."; - xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); + #$rsp->{data}->[0] = + # " $user_target remote Command return code = $exit_code."; + #xCAT::MsgUtils->message("I", $rsp, $::CALLBACK, 1); $rsp->{data}->[0] = "dsh> Remote_command_failed $user_target"; $$options{'monitor'} @@ -575,10 +592,7 @@ sub _execute_dsh { if ($target_rc != 0) { - - $rsp->{data}->[0] = - " $user_target remote Command return code = $$target_properties{'target-rc'}."; - xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); + $rsp->{data}->[0] = "dsh> Remote_command_failed $user_target"; @@ -3784,13 +3798,21 @@ sub parse_and_run_dsh # # Execute the dsh api - @results = xCAT::DSHCLI->runDsh_api(\%options, 0); - if ($::RUNCMD_RC) - { # error from dsh - $rsp->{data}->[0] = "Error from xdsh. Return Code = $::RUNCMD_RC"; - xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); + #@results = xCAT::DSHCLI->runDsh_api(\%options, 0); + #if ($::RUNCMD_RC) + #{ # error from dsh + # $rsp->{data}->[0] = "Error from xdsh. Return Code = $::RUNCMD_RC"; + # xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); - } + #} + # Execute the dsh command + xCAT::DSHCLI->execute_dsh(\%options); + #if ($::RUNCMD_RC) + #{ # error from dsh + # $rsp->{data}->[0] = "Error from xdsh. Return Code = $::RUNCMD_RC"; + # xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); + + #} } return (@results); }