From 30f6a668141c2e90b8a328ce14f1010f4f25ecd5 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 2 Mar 2015 12:36:17 -0500 Subject: [PATCH] Bug #4518 - extra slash in the symlink when -p option is presented For sles.pm, clean up the $path variable to remove multiple slash and trailing slash. In debian.pm , move the check for -p and -w further down so it does not appear unless we have decided that debian is the image we are copying. The message is misleading when copycds is run for non ubuntu/debian OSes --- xCAT-server/lib/xcat/plugins/debian.pm | 12 +++++++----- xCAT-server/lib/xcat/plugins/sles.pm | 11 +++++++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index c0bfa3fcd..efeced646 100755 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -221,16 +221,18 @@ sub copycd return; } - if ( $copypath || $nonoverwrite ){ - $callback->({info=> ["copycd on debian/ubuntu doesn't support -p, -w options!"]}); - return; - } - unless (-r $path . "/.disk/info") { #xCAT::MsgUtils->message("S","The CD doesn't look like a Debian CD, exiting..."); return; } + + if ( $copypath || $nonoverwrite ) + { + $callback->({info=> ["copycds on Ubuntu/Debian does not support -p or -w option."]}); + return; + } + my $dinfo; open($dinfo, $path . "/.disk/info"); my $line = <$dinfo>; diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 5ebf2ca38..836c72c53 100755 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -1621,10 +1621,17 @@ sub copycd ); unless ($mntpath) { - - #this plugin needs $mntpath... + # $mntpath needs to be specified for this plugin return; } + + if ($path) { + # if path if specified, clean up removing trailing slash... + $path =~ s/\/$//; + # and multiple slashes + $path =~ s,//*,/,g; + } + if ($distname and $distname !~ /^sles|^suse/) {