From f9c5ee43cce5f0007575e893abfb67339e6c550c Mon Sep 17 00:00:00 2001 From: jjhua Date: Wed, 23 May 2012 06:18:22 +0000 Subject: [PATCH] For the places that open site table to read attributes, change to call xCAT::Utils->get_site_attribute instead git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12896 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/vsmppxe.pm | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/vsmppxe.pm b/xCAT-server/lib/xcat/plugins/vsmppxe.pm index 479e37ac7..f98b92fea 100644 --- a/xCAT-server/lib/xcat/plugins/vsmppxe.pm +++ b/xCAT-server/lib/xcat/plugins/vsmppxe.pm @@ -198,7 +198,7 @@ sub preprocess_request { #Assume shared tftp directory for boring people, but for cool people, help sync up tftpdirectory contents when #they specify no sharedtftp in site table - my $stab = xCAT::Table->new('site'); + #my $stab = xCAT::Table->new('site'); my $req = shift; if ( (defined($req->{_xcatpreprocessed})) && ($req->{_xcatpreprocessed}->[0] == 1)) @@ -253,8 +253,10 @@ sub preprocess_request { return; } - my $sent = $stab->getAttribs({key=>'sharedtftp'},'value'); - if ($sent and ($sent->{value} == 0 or $sent->{value} =~ /no/i)) { + #my $sent = $stab->getAttribs({key=>'sharedtftp'},'value'); + my @entries = xCAT::Utils->get_site_attribute("sharedtftp"); + my $t_entry = $entries[0]; + if ( defined($t_entry) and ($t_entry == 0 or $t_entry =~ /no/i)) { $req->{'_disparatetftp'}=[1]; if ($req->{inittime}->[0]) { return [$req]; @@ -409,13 +411,15 @@ sub process_request { #dhcp stuff -- inittime is set when xcatd on sn is started unless (($args[0] eq 'stat') || ($inittime)) { my $do_dhcpsetup=1; - my $sitetab = xCAT::Table->new('site'); - if ($sitetab) { - (my $ref) = $sitetab->getAttribs({key => 'dhcpsetup'}, 'value'); - if ($ref) { - if ($ref->{value} =~ /0|n|N/) { $do_dhcpsetup=0; } + #my $sitetab = xCAT::Table->new('site'); + #if ($sitetab) { + #(my $ref) = $sitetab->getAttribs({key => 'dhcpsetup'}, 'value'); + my @entries = xCAT::Utils->get_site_attribute("dhcpsetup"); + my $t_entry = $entries[0]; + if (defined($t_entry)) { + if ($t_entry =~ /0|n|N/) { $do_dhcpsetup=0; } } - } + #} if ($do_dhcpsetup) { if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command