From 2cd7ff2983463a49f735f7fdd99894b9367593ab Mon Sep 17 00:00:00 2001 From: bybai Date: Thu, 20 Aug 2015 03:40:37 -0400 Subject: [PATCH] update comments and format for $::NOSYNCFILE related code --- xCAT-server/lib/xcat/plugins/updatenode.pm | 31 +++++++++++----------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index 50d9d4e25..860f83dc9 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -1358,30 +1358,30 @@ sub updatenode # if immediate return of status not requested (PCM), then update the DB here # in one transaction, otherwise it is updated in getdata callback and buildnodestatus if (!(defined($request->{status})) || ($request->{status} ne "yes")) { - # update the node status, this is done when -F -S -P are run - # make sure the nodes only appear in one array good or bad - &cleanstatusarrays; + # update the node status, this is done when -F -S -P are run + # make sure the nodes only appear in one array good or bad + &cleanstatusarrays; if(@::SUCCESSFULLNODES) { - - my $stat="synced"; - xCAT::TableUtils->setUpdateStatus(\@::SUCCESSFULLNODES, $stat); + my $stat="synced"; + xCAT::TableUtils->setUpdateStatus(\@::SUCCESSFULLNODES, $stat); } if(@::FAILEDNODES) { - - my $stat="failed"; - xCAT::TableUtils->setUpdateStatus(\@::FAILEDNODES, $stat); + my $stat="failed"; + xCAT::TableUtils->setUpdateStatus(\@::FAILEDNODES, $stat); } + # -P -S are not run + # -F is run, but there is no syncfiles if(!(@::SUCCESSFULLNODES || @::FAILEDNODES) && $::NOSYNCFILE) { - my $stat="synced"; - xCAT::TableUtils->setUpdateStatus(\@$nodes,$stat); + my $stat="synced"; + xCAT::TableUtils->setUpdateStatus(\@$nodes,$stat); } + } - } # if site.precreatemypostscripts = not 1 or yes or undefined, # remove all the # node files in the noderange in /tftpboot/mypostscripts @@ -1613,6 +1613,9 @@ sub updatenodesyncfiles my $localhostname = hostname(); my %syncfile_node = (); my %syncfile_rootimage = (); + + # $::NOSYNCFILE default value is 0 + # if there is no syncfiles, set $::NOSYNCFILE=1 $::NOSYNCFILE=0; # if running -P or -S do not report or no status requested if ((defined($request->{status})) && ($request->{status} eq "yes")) { # status requested @@ -1729,13 +1732,11 @@ sub updatenodesyncfiles } } else - { # no syncfiles defined + { # no syncfiles defined my $rsp = {}; $rsp->{data}->[0] = "There were no syncfiles defined to process. File synchronization has completed."; $callback->($rsp); - #my $stat="synced"; - #xCAT::TableUtils->setUpdateStatus(\@$nodes, $stat); $::NOSYNCFILE=1; }