From 9ac43247940a22b6a53ddd989aa81bc3435389f1 Mon Sep 17 00:00:00 2001 From: jjhua Date: Fri, 18 May 2012 07:33:24 +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@12789 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/SvrUtils.pm | 40 +++++++++++++++++---------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/SvrUtils.pm b/xCAT-server/lib/perl/xCAT/SvrUtils.pm index 19ee06624..a9310cfcd 100644 --- a/xCAT-server/lib/perl/xCAT/SvrUtils.pm +++ b/xCAT-server/lib/perl/xCAT/SvrUtils.pm @@ -594,12 +594,17 @@ sub update_tables_with_templates #print "osver=$osver, arch=$arch, osname=$osname, genos=$genos\n"; my $installroot = xCAT::Utils->getInstallDir(); - my $sitetab = xCAT::Table->new('site'); - if ($sitetab) { - (my $ref) = $sitetab->getAttribs({key => "installdir"}, "value"); - if ($ref and $ref->{value}) { - $installroot = $ref->{value}; - } + #my $sitetab = xCAT::Table->new('site'); + #if ($sitetab) { + # (my $ref) = $sitetab->getAttribs({key => "installdir"}, "value"); + # if ($ref and $ref->{value}) { + # $installroot = $ref->{value}; + # } + #} + my @installdirs = xCAT::Utils->get_site_attribute("installdir"); + my $tmp = $installdirs[0]; + if ( defined($tmp)) { + $installroot = $tmp; } my $cuspath="$installroot/custom/install/$osname"; my $defpath="$::XCATROOT/share/xcat/install/$osname"; @@ -756,12 +761,17 @@ sub update_tables_with_diskless_image #print "osver=$osver, arch=$arch, osname=$osname, genos=$genos, profile=$profile\n"; my $installroot = xCAT::Utils->getInstallDir(); - my $sitetab = xCAT::Table->new('site'); - if ($sitetab) { - (my $ref) = $sitetab->getAttribs({key => "installdir"}, "value"); - if ($ref and $ref->{value}) { - $installroot = $ref->{value}; - } + #my $sitetab = xCAT::Table->new('site'); + #if ($sitetab) { + # (my $ref) = $sitetab->getAttribs({key => "installdir"}, "value"); + # if ($ref and $ref->{value}) { + # $installroot = $ref->{value}; + # } + #} + my @installdirs = xCAT::Utils->get_site_attribute("installdir"); + my $tmp = $installdirs[0]; + if ( defined($tmp)) { + $installroot = $tmp; } my $cuspath="$installroot/custom/netboot/$osname"; my $defpath="$::XCATROOT/share/xcat/netboot/$osname"; @@ -1064,8 +1074,10 @@ sub subVars { my $ent; my $val; if($table eq 'site'){ - $val = $tab->getAttribs( { key => "$col" }, 'value' ); - $val = $val->{'value'}; + #$val = $tab->getAttribs( { key => "$col" }, 'value' ); + #$val = $val->{'value'}; + my @vals = xCAT::Utils->get_site_attribute($col); + $val = $vals[0]; }else{ $ent = $tab->getNodeAttribs($node,[$col]); $val = $ent->{$col};