mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-06-03 03:50:08 +00:00
fixed infinit loop in prescript.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3934 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
b05b5a679d
commit
2856ad6f56
@ -173,17 +173,16 @@ sub runbeginpre
|
||||
foreach my $s (@script_array) {
|
||||
my $ret=`NODES=$runnodes_s ACTION=$action $installdir/prescripts/$s 2>&1`;
|
||||
my $err_code=$?;
|
||||
if ($err_code != 0) {
|
||||
if ($ret) {
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0]="$localhostname: $s: $ret";
|
||||
$callback->($rsp);
|
||||
my $err_code=$?;
|
||||
if ($err_code != 0) {
|
||||
$rsp = {};
|
||||
$rsp->{data}->[0]="$localhostname: $s: error code=$err_code.";
|
||||
$callback->($rsp);
|
||||
last;
|
||||
}
|
||||
}
|
||||
if ($err_code != 0) {
|
||||
$rsp = {};
|
||||
$rsp->{error}->[0]="$localhostname: $s: return code=$err_code.";
|
||||
$callback->($rsp);
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -226,13 +225,15 @@ sub runendpre
|
||||
my @script_array=split(',', $scripts);
|
||||
foreach my $s (@script_array) {
|
||||
my $ret=`NODES=$runnodes_s ACTION=$action $installdir/prescripts/$s 2>&1`;
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0]="$localhostname: $s: $ret";
|
||||
$callback->($rsp);
|
||||
my $err_code=$?;
|
||||
if ($ret) {
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0]="$localhostname: $s: $ret";
|
||||
$callback->($rsp);
|
||||
}
|
||||
if ($err_code != 0) {
|
||||
$rsp = {};
|
||||
$rsp->{data}->[0]="$localhostname: $s: error code=$err_code.";
|
||||
$rsp->{error}->[0]="$localhostname: $s: return code=$err_code.";
|
||||
$callback->($rsp);
|
||||
last;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ use Getopt::Long;
|
||||
|
||||
my $request;
|
||||
my $callback;
|
||||
my $callback1;
|
||||
my $dhcpconf = "/etc/dhcpd.conf";
|
||||
my $tftpdir = "/tftpboot";
|
||||
#my $dhcpver = 3;
|
||||
@ -221,13 +222,26 @@ sub pass_along {
|
||||
}
|
||||
}
|
||||
|
||||
sub pass_along1 {
|
||||
my $resp = shift;
|
||||
$callback1->($resp);
|
||||
if ($resp and ($resp->{errorcode} and $resp->{errorcode}->[0]) or ($resp->{error} and $resp->{error}->[0])) {
|
||||
$errored=1;
|
||||
}
|
||||
foreach (@{$resp->{node}}) {
|
||||
if ($_->{error} or $_->{errorcode}) {
|
||||
$errored=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub preprocess_request {
|
||||
my $req = shift;
|
||||
if ($req->{_xcatpreprocessed}->[0] == 1) { return [$req]; }
|
||||
|
||||
$callback = shift;
|
||||
$callback1 = shift;
|
||||
my $command = $req->{command}->[0];
|
||||
my $sub_req = shift;
|
||||
my @args=();
|
||||
@ -245,7 +259,7 @@ sub preprocess_request {
|
||||
if($usage{$command}) {
|
||||
my %rsp;
|
||||
$rsp{data}->[0]=$usage{$command};
|
||||
$callback->(\%rsp);
|
||||
$callback1->(\%rsp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -254,7 +268,7 @@ sub preprocess_request {
|
||||
if($usage{$command}) {
|
||||
my %rsp;
|
||||
$rsp{data}->[0]=$usage{$command};
|
||||
$callback->(\%rsp);
|
||||
$callback1->(\%rsp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -263,7 +277,7 @@ sub preprocess_request {
|
||||
my $ver = xCAT::Utils->Version();
|
||||
my %rsp;
|
||||
$rsp{data}->[0]="$ver";
|
||||
$callback->(\%rsp);
|
||||
$callback1->(\%rsp);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -271,25 +285,25 @@ sub preprocess_request {
|
||||
if($usage{$command}) {
|
||||
my %rsp;
|
||||
$rsp{data}->[0]=$usage{$command};
|
||||
$callback->(\%rsp);
|
||||
$callback1->(\%rsp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#now run the begin part of the prescripts
|
||||
#my @nodes=();
|
||||
#if (ref($req->{node})) {
|
||||
# @nodes = @{$req->{node}};
|
||||
# } else {
|
||||
# if ($req->{node}) { @nodes = ($req->{node}); }
|
||||
# }
|
||||
# $errored=0;
|
||||
# unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
|
||||
# $sub_req->({command=>['runbeginpre'],
|
||||
# node=>\@nodes,
|
||||
# arg=>[$args[0]]},\&pass_along);
|
||||
# }
|
||||
# if ($errored) { return; }
|
||||
my @nodes=();
|
||||
if (ref($req->{node})) {
|
||||
@nodes = @{$req->{node}};
|
||||
} else {
|
||||
if ($req->{node}) { @nodes = ($req->{node}); }
|
||||
}
|
||||
$errored=0;
|
||||
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
|
||||
$sub_req->({command=>['runbeginpre'],
|
||||
node=>\@nodes,
|
||||
arg=>[$args[0]]},\&pass_along1);
|
||||
}
|
||||
if ($errored) { return; }
|
||||
|
||||
#Assume shared tftp directory for boring people, but for cool people, help sync up tftpdirectory contents when
|
||||
#they specify no sharedtftp in site table
|
||||
|
@ -11,6 +11,7 @@ my $request;
|
||||
my %breaknetbootnodes;
|
||||
my %normalnodes;
|
||||
my $callback;
|
||||
my $callback1;
|
||||
my $sub_req;
|
||||
my $dhcpconf = "/etc/dhcpd.conf";
|
||||
my $tftpdir = "/tftpboot";
|
||||
@ -188,8 +189,11 @@ sub setstate {
|
||||
|
||||
my $errored = 0;
|
||||
sub pass_along {
|
||||
#print "pass_along\n";
|
||||
print "pass_along\n";
|
||||
my $resp = shift;
|
||||
|
||||
# print Dumper($resp);
|
||||
|
||||
$callback->($resp);
|
||||
if ($resp and ($resp->{errorcode} and $resp->{errorcode}->[0]) or ($resp->{error} and $resp->{error}->[0])) {
|
||||
$errored=1;
|
||||
@ -201,13 +205,28 @@ sub pass_along {
|
||||
}
|
||||
}
|
||||
|
||||
sub pass_along1 {
|
||||
print "pass_along1\n";
|
||||
my $resp = shift;
|
||||
|
||||
# print Dumper($resp);
|
||||
|
||||
$callback1->($resp);
|
||||
if ($resp and ($resp->{errorcode} and $resp->{errorcode}->[0]) or ($resp->{error} and $resp->{error}->[0])) {
|
||||
$errored=1;
|
||||
}
|
||||
foreach (@{$resp->{node}}) {
|
||||
if ($_->{error} or $_->{errorcode}) {
|
||||
$errored=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub preprocess_request {
|
||||
my $req = shift;
|
||||
if ($req->{_xcatpreprocessed}->[0] == 1) { return [$req]; }
|
||||
|
||||
$callback = shift;
|
||||
$callback1 = shift;
|
||||
my $command = $req->{command}->[0];
|
||||
my $sub_req = shift;
|
||||
my @args=();
|
||||
@ -225,7 +244,7 @@ sub preprocess_request {
|
||||
if($usage{$command}) {
|
||||
my %rsp;
|
||||
$rsp{data}->[0]=$usage{$command};
|
||||
$callback->(\%rsp);
|
||||
$callback1->(\%rsp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -234,7 +253,7 @@ sub preprocess_request {
|
||||
if($usage{$command}) {
|
||||
my %rsp;
|
||||
$rsp{data}->[0]=$usage{$command};
|
||||
$callback->(\%rsp);
|
||||
$callback1->(\%rsp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -243,7 +262,7 @@ sub preprocess_request {
|
||||
my $ver = xCAT::Utils->Version();
|
||||
my %rsp;
|
||||
$rsp{data}->[0]="$ver";
|
||||
$callback->(\%rsp);
|
||||
$callback1->(\%rsp);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -251,25 +270,25 @@ sub preprocess_request {
|
||||
if($usage{$command}) {
|
||||
my %rsp;
|
||||
$rsp{data}->[0]=$usage{$command};
|
||||
$callback->(\%rsp);
|
||||
$callback1->(\%rsp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#now run the begin part of the prescripts
|
||||
#my @nodes=();
|
||||
#if (ref($req->{node})) {
|
||||
# @nodes = @{$req->{node}};
|
||||
# } else {
|
||||
# if ($req->{node}) { @nodes = ($req->{node}); }
|
||||
# }
|
||||
# $errored=0;
|
||||
# unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
|
||||
# $sub_req->({command=>['runbeginpre'],
|
||||
# node=>\@nodes,
|
||||
# arg=>[$args[0]]},\&pass_along);
|
||||
# }
|
||||
# if ($errored) { return; }
|
||||
my @nodes=();
|
||||
if (ref($req->{node})) {
|
||||
@nodes = @{$req->{node}};
|
||||
} else {
|
||||
if ($req->{node}) { @nodes = ($req->{node}); }
|
||||
}
|
||||
$errored=0;
|
||||
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
|
||||
$sub_req->({command=>['runbeginpre'],
|
||||
node=>\@nodes,
|
||||
arg=>[$args[0]]},\&pass_along1);
|
||||
}
|
||||
if ($errored) { return; }
|
||||
|
||||
#Assume shared tftp directory for boring people, but for cool people, help sync up tftpdirectory contents when
|
||||
#they specify no sharedtftp in site table
|
||||
|
Loading…
x
Reference in New Issue
Block a user