diff --git a/perl-xCAT/xCAT/BootUtils.pm b/perl-xCAT/xCAT/BootUtils.pm index 111d825d4c..98e3654ed3 100644 --- a/perl-xCAT/xCAT/BootUtils.pm +++ b/perl-xCAT/xCAT/BootUtils.pm @@ -62,6 +62,7 @@ sub expand_node_template { $text =~ s/#TABLE:([^:#]+):([^:#]+):([^:#]+)#/$value/; } else { $on_error->("Table key of $key not yet supported by boottarget mini-template"); + return; } } return $text; diff --git a/xCAT-server/lib/xcat/plugins/boottarget.pm b/xCAT-server/lib/xcat/plugins/boottarget.pm index dda931bf9c..fce25bce03 100644 --- a/xCAT-server/lib/xcat/plugins/boottarget.pm +++ b/xCAT-server/lib/xcat/plugins/boottarget.pm @@ -159,10 +159,15 @@ sub mknetboot $kcmdline = $tent->{kcmdline}; #TODO: big todo, cheap and rapid, but should be more like esx.pm implementation, i.e. more scalable + my $template_error; $kcmdline = xCAT::BootUtils::expand_node_template( $node, $kcmdline, - sub { $callback->({error => [$_[0]], errorcode => [1]}); } + sub { $template_error = shift; } ); + if (defined($template_error)) { + xCAT::MsgUtils->report_node_error($callback, $node, $template_error); + next; + } if ($initrd eq '') { $bptab->setNodeAttribs( diff --git a/xCAT-server/lib/xcat/plugins/pxe.pm b/xCAT-server/lib/xcat/plugins/pxe.pm index 2bf97250cd..b4ab8c2149 100644 --- a/xCAT-server/lib/xcat/plugins/pxe.pm +++ b/xCAT-server/lib/xcat/plugins/pxe.pm @@ -118,10 +118,12 @@ sub setstate { $kcmdlinehack = xCAT::BootUtils::volatile_addkcmdline($kcmdlinehack); + my $template_error; $kcmdlinehack = xCAT::BootUtils::expand_node_template( $node, $kcmdlinehack, - sub { $::PXE_callback->({error => [$_[0]], errorcode => [1]}); } + sub { $template_error = shift; } ); + return (1, $template_error) if defined($template_error); #$kern->{kcmdline} .= " ".$kern->{addkcmdline}; @@ -514,7 +516,7 @@ sub process_request { ($rc, $errstr) = setstate($_, \%bphash, \%chainhash, \%machash, \%nthash, $tftpdir, $linuximghash); if ($rc) { $response{node}->[0]->{errorcode}->[0] = $rc; - $response{node}->[0]->{errorc}->[0] = $errstr; + $response{node}->[0]->{error}->[0] = $errstr; $::PXE_callback->(\%response); } } diff --git a/xCAT-server/lib/xcat/plugins/xnba.pm b/xCAT-server/lib/xcat/plugins/xnba.pm index 08bde0d1ba..4dd715bdeb 100644 --- a/xCAT-server/lib/xcat/plugins/xnba.pm +++ b/xCAT-server/lib/xcat/plugins/xnba.pm @@ -203,10 +203,12 @@ sub setstate { $kcmdlinehack = xCAT::BootUtils::volatile_addkcmdline($kcmdlinehack); + my $template_error; $kcmdlinehack = xCAT::BootUtils::expand_node_template( $node, $kcmdlinehack, - sub { $::XNBA_callback->({error => [$_[0]], errorcode => [1]}); } + sub { $template_error = shift; } ); + return (1, $template_error) if defined($template_error); #$kern->{kcmdline} .= " ".$kern->{addkcmdline}; $kern->{kcmdline} .= " " . $kcmdlinehack;