From dba68501f1b81cc0889cad0602ec02c44f769b8b Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 20 Oct 2015 13:11:36 -0400 Subject: [PATCH 1/3] There is no display_output option in xCAT. Remove the unused code --- perl-xCAT/xCAT/DSHCLI.pm | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index b2465fdc9..963d2e4ea 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -211,11 +211,6 @@ sub execute_dcp $::DCP_API_MESSAGE .= join("", @{$output_buffers{$user_target}}) . join("", @{$error_buffers{$user_target}}); - if ($$options{'display_output'}) - { - print STDOUT @{$output_buffers{$user_target}}; - print STDERR @{$error_buffers{$user_target}}; - } } else { @@ -580,21 +575,6 @@ sub _execute_dsh $::DSH_API_MESSAGE . join("", @{$output_buffers{$user_target}}) . join("", @{$error_buffers{$user_target}}); - if ($$options{'display_output'}) - { - - # 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->{error}}, @{$error_buffers{$user_target}}; - $rsp->{NoErrorPrefix} = 1; - xCAT::MsgUtils->message("E", $rsp, $::CALLBACK,0); - } } else { From a8816cf4c5531e86e138acaa1fd4e893002824fa Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 20 Oct 2015 16:57:39 -0400 Subject: [PATCH 2/3] Fix formatting of the code in the function: run_rsync_postscripts --- perl-xCAT/xCAT/DSHCLI.pm | 87 ++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 44 deletions(-) diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index 963d2e4ea..ac6eb1603 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -5674,39 +5674,39 @@ sub run_rsync_postscripts my $dshparms; my $firstpass=1; foreach my $postsfile (@::postscripts) { - my $tmppostfile = $postsfile ; - - # if service node need to add the SNsyncfiledir to the path - if (xCAT::Utils->isServiceNode()) { - my $tmpp=$syncdir . $tmppostfile; - $tmppostfile = $tmpp; - } - # remove first character for the compare, we have to do this because the - # return from rsync is tmp/file1 not /tmp/file1 - substr($tmppostfile,0,1)=""; + my $tmppostfile = $postsfile ; - # now remove .post from the postscript file for the compare - # with the returned file name - my($tp,$post) = split(/\.post/,$tmppostfile); - $tmppostfile = $tp; - foreach my $line (@rsync_output) { - my($hostname,$ps) = split(/: /, $line); - chomp $ps; - chomp $hostname; - if ($ps eq "rsync") { # this is a line that is not an update - # save output , if firstpass through output - if ($firstpass == 1) { - push @newoutput, $line; - $firstpass = 0; - } - next; - } - if ($tmppostfile eq $ps) { - # build xdsh queue - # build host and all scripts to execute - push (@{$dshparms->{'postscripts'} {$postsfile}}, $hostname); - } - } + # if service node need to add the SNsyncfiledir to the path + if (xCAT::Utils->isServiceNode()) { + my $tmpp=$syncdir . $tmppostfile; + $tmppostfile = $tmpp; + } + # remove first character for the compare, we have to do this because the + # return from rsync is tmp/file1 not /tmp/file1 + substr($tmppostfile,0,1)=""; + + # now remove .post from the postscript file for the compare + # with the returned file name + my($tp,$post) = split(/\.post/,$tmppostfile); + $tmppostfile = $tp; + foreach my $line (@rsync_output) { + my($hostname,$ps) = split(/: /, $line); + chomp $ps; + chomp $hostname; + if ($ps eq "rsync") { # this is a line that is not an update + # save output , if firstpass through output + if ($firstpass == 1) { + push @newoutput, $line; + $firstpass = 0; + } + next; + } + if ($tmppostfile eq $ps) { + # build xdsh queue + # build host and all scripts to execute + push (@{$dshparms->{'postscripts'} {$postsfile}}, $hostname); + } + } } # now if we have postscripts to run, run xdsh my $out; @@ -5718,25 +5718,24 @@ sub run_rsync_postscripts push (@nodes, @{$$dshparms{'postscripts'}{$ps}}); my @args=(); if ($$options{'nodestatus'}) { - push @args,"--nodestatus" ; + push @args,"--nodestatus" ; } push @args,"-e"; - # if on the service node need to add the $syncdir directory - # to the path + # + # if on the service node need to add the $syncdir directory to the path + # if (xCAT::Utils->isServiceNode()) { - my $tmpp=$syncdir . $ps; - $ps=$tmpp; + my $tmpp=$syncdir . $ps; + $ps=$tmpp; } push @args,$ps; $out=xCAT::Utils->runxcmd( { command => ['xdsh'], - node => \@nodes, - arg => \@args, - }, $::SUBREQ, 0,1); - foreach my $r (@$out){ - push(@newoutput, $r); - + node => \@nodes, + arg => \@args, + }, $::SUBREQ, 0,1); + foreach my $r (@$out) { + push(@newoutput, $r); } - # $ranaps=1; } return @newoutput; } From 5476763673c6d61b1576c210a1749283cb3057fe Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 20 Oct 2015 17:07:57 -0400 Subject: [PATCH 3/3] Removed the code that strips the .post off the end of the files. The file list being returned from xdcp contains .post. For EXECUTE files, we never match the postscript and so it never gets executed --- perl-xCAT/xCAT/DSHCLI.pm | 4 ---- 1 file changed, 4 deletions(-) diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index ac6eb1603..4bbe3633e 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -5685,10 +5685,6 @@ sub run_rsync_postscripts # return from rsync is tmp/file1 not /tmp/file1 substr($tmppostfile,0,1)=""; - # now remove .post from the postscript file for the compare - # with the returned file name - my($tp,$post) = split(/\.post/,$tmppostfile); - $tmppostfile = $tp; foreach my $line (@rsync_output) { my($hostname,$ps) = split(/: /, $line); chomp $ps;