From c94b02d789260837428fa325c09a5565d1d9d2ef Mon Sep 17 00:00:00 2001 From: daniceexi Date: Thu, 5 Mar 2015 21:58:56 -0500 Subject: [PATCH] defect 4589: fix the issue in genimage.pm that when checking the existence of file in pkglist,otherpkglist,postinstall attributes, the value of the attributes could be multiple files which separated with , --- xCAT-server/lib/xcat/plugins/genimage.pm | 30 +++++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/genimage.pm b/xCAT-server/lib/xcat/plugins/genimage.pm index f2558f16c..dcbe433bb 100644 --- a/xCAT-server/lib/xcat/plugins/genimage.pm +++ b/xCAT-server/lib/xcat/plugins/genimage.pm @@ -168,23 +168,35 @@ sub process_request { return 1; } $pkglist = $ref_linuximage_tab->{'pkglist'}; - if ($pkglist ne "" and ! -e $pkglist) { - $callback->({error=>["The pkglist specified \'$pkglist\' does not exist!"],errorcode=>[1]}); - return 1; + if ($pkglist ne "") { + foreach my $file (split ',', $pkglist) { + if (! -r $file) { + $callback->({error=>["The pkglist specified \'$file\' does not exist!"],errorcode=>[1]}); + return 1; + } + } } $srcdir = $ref_linuximage_tab->{'pkgdir'}; $srcdir_otherpkgs = $ref_linuximage_tab->{'otherpkgdir'}; $otherpkglist = $ref_linuximage_tab->{'otherpkglist'}; - if ($otherpkglist ne "" and ! -e $otherpkglist) { - $callback->({error=>["The otherpkglist specified \'$otherpkglist\' does not exist!"],errorcode=>[1]}); - return 1; + if ($otherpkglist ne "") { + foreach my $file (split ',', $otherpkglist) { + if (! -r $file) { + $callback->({error=>["The otherpkglist specified \'$file\' does not exist!"],errorcode=>[1]}); + return 1; + } + } } $postinstall_filename = $ref_linuximage_tab->{'postinstall'}; - if ($postinstall_filename ne "" and ! -e $postinstall_filename) { - $callback->({error=>["The postinstall_filename specified \'$postinstall_filename\' does not exist!"],errorcode=>[1]}); - return 1; + if ($postinstall_filename ne "") { + foreach my $file (split ',', $postinstall_filename) { + if (! -r $file) { + $callback->({error=>["The postinstall_filename specified \'$file\' does not exist!"],errorcode=>[1]}); + return 1; + } + } } $destdir = $ref_linuximage_tab->{'rootimgdir'}; $rootimg_dir = $ref_linuximage_tab->{'rootimgdir'};