From 079665a65135ec2b5f88ee66928baa141a1aaef7 Mon Sep 17 00:00:00 2001 From: jjhua Date: Thu, 21 Mar 2013 05:20:18 +0000 Subject: [PATCH] fixed bug 3437 git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15600 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/Template.pm | 42 +++++++++++++++------------ 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 5396aa31a..6b747a32c 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -1794,7 +1794,7 @@ sub collect_all_attribs_for_tables_in_template if( $tabname =~ /^noderes$/ ) { @attribs = (@attribs, "netboot", "tftpdir"); ## add the attribs which will be needed in other place. } - $ent = $tabh->getNodesAttribs($nodes,@attribs); + $ent = $tabh->getNodesAttribs($nodes,@attribs); if ($ent) { foreach my $node (@$nodes) { if( $ent->{$node}->[0] ) { @@ -1827,27 +1827,31 @@ sub collect_all_attribs_for_tables_in_template } } - } else { - - # for noderes.nfsserver and noderes.tftpserver - if( defined($::GLOBAL_TAB_HASH{noderes}) && defined ($::GLOBAL_TAB_HASH{noderes}{$node} ) - && defined ($::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster} ) ) { - if(!defined ($::GLOBAL_TAB_HASH{noderes}{$node}{nfsserver}) ) { - $::GLOBAL_TAB_HASH{noderes}{$node}{nfsserver} = $::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster}; - } - if(!defined ($::GLOBAL_TAB_HASH{noderes}{$node}{tftpserver}) ) { - $::GLOBAL_TAB_HASH{noderes}{$node}{tftpserver} = $::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster}; - } - } else { - foreach my $attrib (@attribs) { - $::GLOBAL_TAB_HASH{$tabname}{$node}{$attrib} = ''; - } - } - } + # for noderes.nfsserver and noderes.tftpserver + if( ! defined($::GLOBAL_TAB_HASH{noderes}) || !defined ($::GLOBAL_TAB_HASH{noderes}{$node} ) || + !defined ($::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster} ) ) { + $::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster} = $::XCATSITEVALS{master}; + } + + if(!defined ($::GLOBAL_TAB_HASH{noderes}{$node}{nfsserver}) ) { + $::GLOBAL_TAB_HASH{noderes}{$node}{nfsserver} = $::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster}; + } + if(!defined ($::GLOBAL_TAB_HASH{noderes}{$node}{tftpserver}) ) { + $::GLOBAL_TAB_HASH{noderes}{$node}{tftpserver} = $::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster}; + } + #if the values are not got, we will set them to ''; + foreach my $attrib (@attribs) { + if( !defined($::GLOBAL_TAB_HASH{$tabname}) || !defined($::GLOBAL_TAB_HASH{$tabname}{$node}) || !defined($::GLOBAL_TAB_HASH{$tabname}{$node}{$attrib})) { + $::GLOBAL_TAB_HASH{$tabname}{$node}{$attrib} = ''; + } + } + + + } - + } $tabh->close; #}