From 08eed9957ec84095e275049e632400ac161fd334 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Wed, 24 Feb 2010 09:25:29 +0000 Subject: [PATCH] defect 2947784: use getTftpDir to get the tftp dir git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5285 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/share/xcat/tools/rmblade | 19 +++++++++++++++---- xCAT-server/share/xcat/tools/rmnodecfg | 13 +++++++++++-- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/xCAT-server/share/xcat/tools/rmblade b/xCAT-server/share/xcat/tools/rmblade index 4c3f6ba99..a06e9105c 100755 --- a/xCAT-server/share/xcat/tools/rmblade +++ b/xCAT-server/share/xcat/tools/rmblade @@ -7,12 +7,23 @@ ## 4. so if blade is placed in new slot or back in then xCAT goes ## through rediscover process again. +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} + +use lib "$::XCATROOT/lib/perl"; +use xCAT::Utils; use strict; use Socket; # for name resolution + my $ip=''; my $mm=''; my $slot=''; my $log = "/var/log/xcatsnmp"; +my $tftpdir = xCAT::Utils->getTftpDir(); + + open(FILE,">>$log") or die "Can't open log!!!"; my $date = `date`; @@ -27,11 +38,11 @@ sub rmblade { `chtab -d node=$blade mac`; print FILE "Running: makedhcp -d $blade\n"; `makedhcp -d $blade`; - print FILE "Running: rm /tftpboot/pxelinux.cfg/$blade\n"; - `rm /tftpboot/pxelinux.cfg/$blade`; + print FILE "Running: rm $tftpdir/pxelinux.cfg/$blade\n"; + `rm $tftpdir/pxelinux.cfg/$blade`; if($hex){ - print FILE "Running: rm /tftpboot/pxelinux.cfg/$hex\n"; - `rm /tftpboot/pxelinux.cfg/$hex`; + print FILE "Running: rm $tftpdir/pxelinux.cfg/$hex\n"; + `rm $tftpdir/pxelinux.cfg/$hex`; } } diff --git a/xCAT-server/share/xcat/tools/rmnodecfg b/xCAT-server/share/xcat/tools/rmnodecfg index e8728999f..990374392 100755 --- a/xCAT-server/share/xcat/tools/rmnodecfg +++ b/xCAT-server/share/xcat/tools/rmnodecfg @@ -4,6 +4,13 @@ # usage: rmnodecfg # this does not remove it completely from xCAT. You may want to do this # command before running noderm to completely purge the system of the node +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} + +use lib "$::XCATROOT/lib/perl"; +use xCAT::Utils; use strict; use Socket; @@ -13,6 +20,8 @@ if(! $blades) { exit; } +my $tftpdir = xCAT::Utils->getTftpDir(); + foreach my $blade (`/opt/xcat/bin/nodels $blades`){ chomp($blade); my $hex = ip2hex($blade); @@ -26,11 +35,11 @@ foreach my $blade (`/opt/xcat/bin/nodels $blades`){ $cmd = "makedhcp -d $blade"; print "$cmd\n"; `$cmd`; - $cmd = "rm /tftpboot/pxelinux.cfg/$blade"; + $cmd = "rm $tftpdir/pxelinux.cfg/$blade"; print "$cmd\n"; `$cmd`; if($hex){ - $cmd = "rm /tftpboot/pxelinux.cfg/$hex"; + $cmd = "rm $tftpdir/pxelinux.cfg/$hex"; print "$cmd\n"; `$cmd`; }