From c647909000f654d15dd314fb76fab5da54d5ab14 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Thu, 1 Dec 2011 01:08:03 +0000 Subject: [PATCH] add more comments and handle the return code of enable_TFTPhpa git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11094 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/AAsn.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/AAsn.pm b/xCAT-server/lib/xcat/plugins/AAsn.pm index 990e8ec3b..ffb02a09e 100644 --- a/xCAT-server/lib/xcat/plugins/AAsn.pm +++ b/xCAT-server/lib/xcat/plugins/AAsn.pm @@ -277,7 +277,7 @@ sub init_plugin $rc = &setup_FTP(); # setup FTP } #enable the tftp-hpa for MN - enable_TFTPhpa(); + $rc = enable_TFTPhpa(); } } return $rc; @@ -1265,7 +1265,7 @@ sub setup_TFTP } # enable the tftp-hpa - enable_TFTPhpa(); + $rc = enable_TFTPhpa(); if ($rc == 0) { @@ -1352,20 +1352,25 @@ sub enable_TFTPhpa my @newcfgfile; # Check whether need to reconfigure the /etc/xinetd.d/tftp while () { + # check the configuration of 'server_args = -s /xx -m xx' entry if (/^\s*server_args\s*=(.*)$/) { my $cfg_args = $1; + # handle the -s option for the location of tftp root dir if ($cfg_args =~ /-s\s+([^\s]*)/) { my $cfgdir = $1; $cfgdir =~ s/\$//; $tftpdir =~ s/\$//; + # make sure the tftp dir should comes from the site.tftpdir if ($cfgdir ne $tftpdir) { $recfg = 1; } } + # handle the -m option for the mapfile if ($cfg_args !~ /-m\s+([^\s]*)/) { $recfg = 1; } if ($recfg) { + # regenerate the entry for server_args my $newcfg = $_; $newcfg =~ s/=.*$/= -s $tftpdir -m $mapfile/; push @newcfgfile, $newcfg; @@ -1373,6 +1378,7 @@ sub enable_TFTPhpa push @newcfgfile, $_; } } elsif (/^\s*disable\s*=/ && !/^\s*disable\s*=\s*no/) { + # enable the tftp by handling the entry 'disable = xx' my $newcfg = $_; $newcfg =~ s/=.*$/= no/; push @newcfgfile, $newcfg;