From 98d8c6ec99220bfbbfef7dd4c5b8bddcd4344a8e Mon Sep 17 00:00:00 2001 From: ligc Date: Fri, 9 Jan 2015 14:45:22 +0800 Subject: [PATCH] fix for bug 4507: print a warning message if copycds -n specifies a unresonable distribution name --- xCAT-server/lib/xcat/plugins/anaconda.pm | 7 ++++++- xCAT-server/lib/xcat/plugins/debian.pm | 21 +++++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index b38dd3cb0..26c072fc9 100755 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -2201,7 +2201,12 @@ sub copycd { #If they say to call it something unidentifiable, give up? - return; + #at least show a warning + $callback->( + { + warning => ["could not identify the distribution name \"$distname\", may cause problems."], + } + ); } unless (-r $mntpath . "/.discinfo") { diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index dcaae3baf..63ad4ee2c 100755 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -212,6 +212,19 @@ sub copycd #this plugin needs $path... return; } + if ( $distname + and $distname !~ /^debian/i + and $distname !~ /^ubuntu/i) + { + + #If they say to call it something unidentifiable, give up? + #at least show a warning + $callback->( + { + warning => ["could not identify the distribution name \"$distname\", may cause problems."], + } + ); + } if ( $copypath || $noosimage || $nonoverwrite ){ $callback->({info=> ["copycd on debian/ubuntu doesn't support -p, -o, -w options!"]}); @@ -253,7 +266,9 @@ sub copycd # So that we have the netboot images $isnetinst = 1 if ($line2[7] eq "NETINST"); - $distname="debian".$ver; + if (!$distname) { + $distname="debian".$ver; + } $detdistname="debian".$ver; } elsif ($prod eq "Ubuntu" or $prod eq "Ubuntu-Server" ) @@ -261,7 +276,9 @@ sub copycd # to cover for LTS releases $darch = $line2[7] if ($line2[2] eq "LTS"); - $distname="ubuntu".$ver; + if (!$distname) { + $distname="ubuntu".$ver; + } $detdistname="ubuntu".$ver; $discno = `cat $path/README.diskdefines | grep 'DISKNUM ' | awk '{print \$3}'`; }