From d9c27df5933ef78ddd593c33c6c307022d3d40d7 Mon Sep 17 00:00:00 2001 From: jjhua Date: Fri, 25 Jan 2013 07:38:59 +0000 Subject: [PATCH] fixed bug 3322 git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14991 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/Template.pm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 21028f7e8..1cfd1afb4 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -909,6 +909,9 @@ sub subvars_for_mypostscript { # get the net', 'mask', 'gateway' from networks table my $nets = getNetworks(); + # For AIX, get the password and cryptmethod for system root + my $aixrootpasswdvars = getAIXPasswdVars(); + #%image_hash is used to store the attributes in linuximage and osimage tabs my %image_hash; getLinuximage(\%image_hash); @@ -1075,6 +1078,7 @@ sub subvars_for_mypostscript { $inc =~ s/#TABLE:([^:]+):([^:]+):([^#]+)#/tabdb($1,$2,$3)/eg; $inc =~ s/#ROUTES_VARS_EXPORT#/$route_vars/eg; $inc =~ s/#VLAN_VARS_EXPORT#/$vlan_vars/eg; + $inc =~ s/#AIX_ROOT_PW_VARS_EXPORT#/$aixrootpasswdvars/eg; $inc =~ s/#MONITORING_VARS_EXPORT#/$mon_vars/eg; $inc =~ s/#OSIMAGE_VARS_EXPORT#/$osimage_vars/eg; $inc =~ s/#NETWORK_FOR_DISKLESS_EXPORT#/$diskless_net_vars/eg; @@ -1310,7 +1314,26 @@ sub getVlanItems_t return $result; } +sub getAIXPasswdVars +{ + my $result; + if ($^O =~ /^aix/i) { + require xCAT::PPCdb; + my $et = xCAT::PPCdb::get_usr_passwd('system', 'root'); + if ($et and defined($et->{'password'})) + { + $result .= "ROOTPW=" . $et->{'password'} . "\n"; + $result .= "export ROOTPW\n"; + } + if ($et and defined($et->{'cryptmethod'})) + { + $result .= "CRYPTMETHOD=" . $et->{'cryptmethod'} . "\n"; + $result .= "export CRYPTMETHOD\n"; + } + } + return $result; +} sub getVlanItems