From 0a1a6180ef0db2373ecbaf98c95ae7266613dd33 Mon Sep 17 00:00:00 2001 From: Sheng Feng Xing Date: Sun, 22 Sep 2013 14:40:43 +0800 Subject: [PATCH] Merge #3784 and #3793 patches into 2.8.2-pcm branch --- perl-xCAT/xCAT/CFMUtils.pm | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/perl-xCAT/xCAT/CFMUtils.pm b/perl-xCAT/xCAT/CFMUtils.pm index 3bbdeba38..987cb0d65 100644 --- a/perl-xCAT/xCAT/CFMUtils.pm +++ b/perl-xCAT/xCAT/CFMUtils.pm @@ -235,24 +235,13 @@ sub setCFMSynclistFile { # get the cfmdir and synclists attributes my $osimage_t = xCAT::Table->new('osimage'); my $records = $osimage_t->getAttribs({imagename=>$img}, 'cfmdir', 'synclists'); - if ($records) + if (defined ($records->{'cfmdir'})) { - if ($records->{'cfmdir'}) {$cfmdir = $records->{'cfmdir'}} - if ($records->{'synclists'}) {$synclists = $records->{'synclists'}} + $cfmdir = $records->{'cfmdir'}; + if (defined ($records->{'synclists'})) {$synclists = $records->{'synclists'}} } else { - if ($::VERBOSE) - { - my $rsp = {}; - $rsp->{data}->[0] = "There are no records for cfmdir and synclists attribute in the osimage:$img. There is nothing to process."; - xCAT::MsgUtils->message("I", $rsp, $::CALLBACK); - } - return; - } - - # no cfmdir defined, return directly - if (!$cfmdir) - { - return; + # no cfmdir defined, return directly + return 0; } my $found = 0; @@ -374,7 +363,8 @@ sub updateCFMSynclistFile { # recursively list the files under cfm directory my @files = (); - find ( sub { push @files, $File::Find::name if (! -d) }, $cfmdir); + + find ( { wanted => sub { push @files, $File::Find::name if -f }, follow => 1 }, $cfmdir); if (!@files) # not files under cfm directory, skip to next loop { next;