From 19853bf2d29d4becb9e91c8cde514779e61a7af1 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Fri, 6 Mar 2015 05:22:40 -0500 Subject: [PATCH] Change the code to generate MACADDRESS var in mypostscript. var MACMAC will show the mac.mac. var MACADDRESS will show the installnic which calculated from mac.mac --- xCAT-server/lib/perl/xCAT/Postage.pm | 9 +++++++++ xCAT-server/share/xcat/mypostscript/mypostscript.tmpl | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Postage.pm b/xCAT-server/lib/perl/xCAT/Postage.pm index d5377e6ec..0755f5bfc 100644 --- a/xCAT-server/lib/perl/xCAT/Postage.pm +++ b/xCAT-server/lib/perl/xCAT/Postage.pm @@ -518,6 +518,13 @@ sub makescript { ## kit and kitcomponent parameter. my $kitcomp_deployparams = getKitcompDeployParams($osimgname,\%image_hash); + # get mac address for the node + my $macaddress; + if( defined( $::GLOBAL_TAB_HASH{mac}) && defined( $::GLOBAL_TAB_HASH{mac}{$node}) ) { + my $macmac = $::GLOBAL_TAB_HASH{mac}{$node}{mac}; + $macaddress = xCAT::Utils->parseMacTabEntry($macmac, $node); + } + #ok, now do everything else.. #$inc =~ s/#XCATVAR:([^#]+)#/envvar($1)/eg; #$inc =~ s/#ENV:([^#]+)#/envvar($1)/eg; @@ -545,6 +552,8 @@ sub makescript { #$inc =~ s/#COMMAND:([^#]+)#/command($1)/eg; $inc =~ s/\$NTYPE/$nodetype/eg; + $inc =~ s/\$MACADDRESS/$macaddress/eg; + # This line only is used to compatible with the old code $inc =~ s/#Subroutine:([^:]+)::([^:]+)::([^:]+):([^#]+)#/runsubroutine($1,$2,$3,$4)/eg; diff --git a/xCAT-server/share/xcat/mypostscript/mypostscript.tmpl b/xCAT-server/share/xcat/mypostscript/mypostscript.tmpl index 74e9367bf..88a5bb8dc 100755 --- a/xCAT-server/share/xcat/mypostscript/mypostscript.tmpl +++ b/xCAT-server/share/xcat/mypostscript/mypostscript.tmpl @@ -77,9 +77,11 @@ export UPDATENODE NTYPE=$NTYPE export NTYPE -MACADDRESS=#TABLE:mac:$NODE:mac# -export MACADDRESS +MACMAC=#TABLE:mac:$NODE:mac# +export MACMAC +MACADDRESS=$MACADDRESS +export MACADDRESS ## vlan related items. vlan may not be configured. #VLAN_VARS_EXPORT#