From ccea3838b2de25990f642e711a2b6241afd4515a Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 18 Mar 2010 21:09:56 +0000 Subject: [PATCH] -refresh toolscenter plugin to be strict compliant and functional in conjunction with toolscenter unattended mode git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5522 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/toolscenter.pm | 27 +++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/toolscenter.pm b/xCAT-server/lib/xcat/plugins/toolscenter.pm index 05deda131..c79e95f13 100644 --- a/xCAT-server/lib/xcat/plugins/toolscenter.pm +++ b/xCAT-server/lib/xcat/plugins/toolscenter.pm @@ -40,6 +40,7 @@ Getopt::Long::Configure("pass_through"); use File::Path; use File::Copy; use File::Temp qw/mkdtemp/; +use strict; my @cpiopid; @@ -130,7 +131,9 @@ sub mknetboot my $req = shift; my $callback = shift; my $doreq = shift; - my $nodes = @{$request->{node}}; + unless ($req->{arg}) { + $req->{arg} = []; + } my @args = @{$req->{arg}}; my @nodes = @{$req->{node}}; my $ostab = xCAT::Table->new('nodetype'); @@ -143,7 +146,7 @@ sub mknetboot if ($sitetab) { - (my $ref) = $sitetab->getAttribs({key => xcatiport}, value); + (my $ref) = $sitetab->getAttribs({key => 'xcatiport'}, 'value'); if ($ref and $ref->{value}) { $xcatiport = $ref->{value}; @@ -160,7 +163,7 @@ sub mknetboot ['serialport', 'serialspeed', 'serialflow']); #my $addkcmdhash = # $bptab->getNodesAttribs(\@nodes, ['addkcmdline']); - foreach $node (@nodes) + foreach my $node (@nodes) { my $ent = $oents{$node}->[0]; #ostab->getNodeAttribs($node, ['os', 'arch', 'profile']); unless ($ent->{os} and $ent->{arch} and $ent->{profile}) @@ -238,9 +241,23 @@ BEGIN { exit 0 } ENDOFAWK + close($menush); + open($menush,"<","menu/unattended_menu.sh"); + my @oldunattendmenu = <$menush>; #store old menu; + close($menush); + open($menush,">","menu/unattended_menu.sh"); + foreach (@oldunattendmenu) { + if (/^exit 0/) { #the exit line, hijack this + print $menush 'DIR=`dirname $0`'."\n"; + print $menush '$DIR/calltoxcat.awk ${xcat_server} '."$xcatiport\n"; + print $menush "reboot\n"; + } else { + print $menush $_; + } + } close($menush); system("zip /$installroot/netboot/$osver/$arch/$profile/tc.xcat.zip -r ."); - chdir .. + chdir ".."; system("rm -rf $dpath"); } @@ -271,7 +288,7 @@ ENDOFAWK ); next; } - my $ent = $reshash->{$node}->[0];#$restab->getNodeAttribs($node, ['primarynic']); + $ent = $reshash->{$node}->[0];#$restab->getNodeAttribs($node, ['primarynic']); my $sent = $hmhash->{$node}->[0]; # $hmtab->getNodeAttribs($node, # ['serialport', 'serialspeed', 'serialflow']);