For the places that open site table to read attributes, change to call xCAT::Utils->get_siteibute instead

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12861 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jjhua 2012-05-22 07:02:11 +00:00
parent 8c13b3f50a
commit d16f2babcd

View File

@ -710,15 +710,17 @@ sub preprocess_request
my $snonly=0;
my $sitetab = xCAT::Table->new('site');
if ($sitetab)
{
my $href;
($href) = $sitetab->getAttribs({key => 'disjointdhcps'}, 'value');
if ($href and $href->{value}) {
$snonly=$href->{value};
#my $sitetab = xCAT::Table->new('site');
#if ($sitetab)
#{
#my $href;
#($href) = $sitetab->getAttribs({key => 'disjointdhcps'}, 'value');
my @entries = xCAT::Utils->get_site_attribute("disjointdhcps");
my $t_entry = $entries[0];
if (defined($t_entry)) {
$snonly=$t_entry;
}
}
#}
my @requests=();
my $hasHierarchy=0;
@ -880,22 +882,26 @@ sub process_request
return;
}
my $sitetab = xCAT::Table->new('site');
#my $sitetab = xCAT::Table->new('site');
my %activenics;
my $querynics = 1;
if ($sitetab)
{
my $href;
($href) = $sitetab->getAttribs({key => 'dhcpinterfaces'}, 'value');
unless ($href and $href->{value})
#if ($sitetab)
#{
#my $href;
#($href) = $sitetab->getAttribs({key => 'dhcpinterfaces'}, 'value');
my @entries = xCAT::Utils->get_site_attribute("dhcpinterfaces");
my $t_entry = $entries[0];
unless ( defined($t_entry) )
{ #LEGACY: singular keyname for old style site value
($href) = $sitetab->getAttribs({key => 'dhcpinterface'}, 'value');
@entries = xCAT::Utils->get_site_attribute("dhcpinterface");
$t_entry = $entries[0];
#($href) = $sitetab->getAttribs({key => 'dhcpinterface'}, 'value');
}
if ($href and $href->{value})
if ( defined($t_entry) )
#syntax should be like host|ifname1,ifname2;host2|ifname3,ifname2 etc or simply ifname,ifname2
#depending on complexity of network wished to be described
{
my $dhcpinterfaces = $href->{value};
my $dhcpinterfaces = $t_entry;
my $dhcpif;
INTF: foreach $dhcpif (split /;/,$dhcpinterfaces) {
my $host;
@ -929,29 +935,37 @@ sub process_request
}
}
}
($href) = $sitetab->getAttribs({key => 'nameservers'}, 'value');
if ($href and $href->{value}) {
$sitenameservers = $href->{value};
#($href) = $sitetab->getAttribs({key => 'nameservers'}, 'value');
@entries = xCAT::Utils->get_site_attribute("nameservers");
$t_entry = $entries[0];
if ( defined($t_entry) ) {
$sitenameservers = $t_entry;
}
($href) = $sitetab->getAttribs({key => 'ntpservers'}, 'value');
if ($href and $href->{value}) {
$sitentpservers = $href->{value};
#($href) = $sitetab->getAttribs({key => 'ntpservers'}, 'value');
@entries = xCAT::Utils->get_site_attribute("ntpservers");
$t_entry = $entries[0];
if ( defined($t_entry) ) {
$sitentpservers = $t_entry;
}
($href) = $sitetab->getAttribs({key => 'logservers'}, 'value');
if ($href and $href->{value}) {
$sitelogservers = $href->{value};
#($href) = $sitetab->getAttribs({key => 'logservers'}, 'value');
@entries = xCAT::Utils->get_site_attribute("logservers");
$t_entry = $entries[0];
if ( defined($t_entry) ) {
$sitelogservers = $t_entry;
}
#($href) = $sitetab->getAttribs({key => 'domain'}, 'value');
($href) = $sitetab->getAttribs({key => 'domain'}, 'value');
unless ($href and $href->{value})
#($href) = $sitetab->getAttribs({key => 'domain'}, 'value');
@entries = xCAT::Utils->get_site_attribute("domain");
$t_entry = $entries[0];
unless ( defined($t_entry) )
{
$callback->(
{error => ["No domain defined in site tabe"], errorcode => [1]}
);
return;
}
$domain = $href->{value};
}
$domain = $t_entry;
#}
@dhcpconf = ();
@dhcp6conf = ();