From cd8389984fb72cfcfe3e3cac9d385db8d48b43a5 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 26 Feb 2014 08:37:26 -0500 Subject: [PATCH] fix ENABLESSHBETWEENNODES setting in mypostscript file when zones --- xCAT-server/lib/perl/xCAT/Postage.pm | 69 ++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Postage.pm b/xCAT-server/lib/perl/xCAT/Postage.pm index 14ff1a23c..f75792e24 100644 --- a/xCAT-server/lib/perl/xCAT/Postage.pm +++ b/xCAT-server/lib/perl/xCAT/Postage.pm @@ -16,6 +16,7 @@ use xCAT::Utils; use xCAT::TableUtils; use xCAT::Template; use xCAT::SvrUtils; +use xCAT::Zone; #use Data::Dumper; use File::Basename; use Socket; @@ -186,8 +187,8 @@ sub makescript { if($entries[0]) { $installroot = $entries[0]; } + my $tmpl="$installroot/postscripts/mypostscript.tmpl"; #the customized mypostscript template - unless ( -r $tmpl) { $tmpl="$::XCATROOT/share/xcat/mypostscript/mypostscript.tmpl"; #the default xcat mypostscript template } @@ -367,6 +368,16 @@ sub makescript { } $cloudinfo_hash = getcloudinfo($cloud_module_name, $cloud_exists); } + + # see if we are using zones. If we are then sshbetweennodes comes from the zone table not + # from the site table + my $usingzones; + if (xCAT::Zone->usingzones) { + $usingzones=1; + } else { + $usingzones=0; + } + foreach my $n (@$nodes ) { $node = $n; @@ -477,9 +488,15 @@ sub makescript { # for #INCLUDE_POSTBOOTSCRIPTS_LIST# my $postbootscripts; $postbootscripts = getPostbootScripts($node, $osimgname, $script_hash); - - my $enablesshbetweennodes = enableSSHbetweennodes($node, \%::GLOBAL_SN_HASH, $groups_hash); - + + # if using zones then must go to the zone.sshbetweennodes + # else go to site.sshbetweennodes + my $enablesshbetweennodes; + if ($usingzones) { + $enablesshbetweennodes = enableSSHbetweennodeszones($node,$callback); + } else { + $enablesshbetweennodes = enableSSHbetweennodes($node, \%::GLOBAL_SN_HASH, $groups_hash); + } my @clients; my $cfgres; my $cloudres; @@ -792,7 +809,7 @@ sub getsshbetweennodes Error: none Example: - my $enable = xCAT::TableUtils->enableSSH($node); + my $enable = xCAT::TableUtils->enableSSHbetweennodes($node,$sn_hash, $groups_hash); Comments: =cut @@ -818,6 +835,48 @@ sub enableSSHbetweennodes } +#------------------------------------------------------------------------------- + +=head3 enableSSHbetweennodeszones + Description: return how to fill in the ENABLESSHBETWEENNODES export in the mypostscript file + based on the setting in the zone table sshbetweennodes attribute + Arguments: + $node + $callback + Returns: + 1 = enable ssh + 0 = do not enable ssh + Globals: + none + Error: + none + Example: + my $enable = xCAT::TableUtils->enableSSHbetweennodeszones($node); + Comments: + +=cut + +#----------------------------------------------------------------------------- + +sub enableSSHbetweennodeszones +{ + + my $node = shift; + my $callback = shift; + my $result; + + my $enablessh=xCAT::Zone->enableSSHbetweennodes($node,$callback); + if ($enablessh == 1) { + $result = "'YES'"; + } else { + $result = "'NO'"; + } + + return $result; +} + + +