Populate %::XCATSITEVALS with XCATBYPASS=1 in the submit_request(), and use $::XCATSITEVALS{} instead of getting from site table again.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12761 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jjhua 2012-05-17 09:43:17 +00:00
parent 89aea637cb
commit 8cbcd958d5

View File

@ -147,14 +147,16 @@ if (ref($request) eq 'HASH') { # the request is an array, not pure XML
}
} else {
# figure out default plugins dir
my $sitetab=xCAT::Table->new('site');
unless ($sitetab) {
print ("ERROR: Unable to open basic site table for configuration\n");
}
#my $sitetab=xCAT::Table->new('site');
#unless ($sitetab) {
# print ("ERROR: Unable to open basic site table for configuration\n");
#}
$plugins_dir=$::XCATROOT.'/lib/perl/xCAT_plugin';
scan_plugins();
}
populate_site_hash();
# don't do XML transformation -- assume request is well-formed
# my $xmlreq=XMLout($request,RootName=>xcatrequest,NoAttr=>1,KeyAttr=>[]);
# $request = XMLin($xmlreq,SuppressEmpty=>undef,ForceArray=>1) ;
@ -419,9 +421,10 @@ sub plugin_command {
if ($hdlspec =~ /^site:/) { #A site entry specifies a plugin
my $sitekey = $hdlspec;
$sitekey =~ s/^site://;
$sitetab = xCAT::Table->new('site');
my $sent = $sitetab->getAttribs({key=>$sitekey},['value']);
if ($sent and $sent->{value}) { #A site style plugin specification is just like
#$sitetab = xCAT::Table->new('site');
#my $sent = $sitetab->getAttribs({key=>$sitekey},['value']);
#if ($sent and $sent->{value}) { #A site style plugin specification is just like
if ($::XCATSITEVALS{$sitekey}) { #A site style plugin specification is just like
#a static global, it grabs all nodes rather than some
$useglobals = -1; #If they tried to specify anything, don't use the default global handlers at all
unless (@nodes) {
@ -886,6 +889,23 @@ sub build_response {
} # end of submit_request()
####################################
# populates all the site attributes into %::XCATSITEVALS
# This is used with XCATBYPASS=1
###################################
sub populate_site_hash {
%::XCATSITEVALS=();
my $sitetab = xCAT::Table->new('site',-create=>0);
unless ($sitetab) {
print ("ERROR: Unable to open basic site table for configuration\n");
return;
}
my @records = $sitetab->getAllAttribs(qw/key value/);
foreach (@records) {
$::XCATSITEVALS{$_->{key}}=$_->{value};
}
}
##########################################