From a8816cf4c5531e86e138acaa1fd4e893002824fa Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 20 Oct 2015 16:57:39 -0400 Subject: [PATCH] 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; }