mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-29 17:23:08 +00:00
Merge pull request #1388 from daniceexi/export
issue 1361: check the export sentence in the mypostscript to make sur…
This commit is contained in:
commit
aaf0c95cf8
@ -570,6 +570,7 @@ sub makescript {
|
||||
# This line only is used to compatible with the old code
|
||||
$inc =~ s/#Subroutine:([^:]+)::([^:]+)::([^:]+):([^#]+)#/runsubroutine($1,$2,$3,$4)/eg;
|
||||
|
||||
|
||||
# we will create a file in /tftboot/mypostscript/mypostscript_<nodename>
|
||||
if ((!defined($nofiles)) || ($nofiles == 0)) { #
|
||||
my $script;
|
||||
@ -596,7 +597,25 @@ sub makescript {
|
||||
close($script_fp{$node});
|
||||
# TODO remove the blank lines
|
||||
}
|
||||
|
||||
|
||||
# Check the validity of new generated mypostscirpt
|
||||
# export does not support - in the environment variable name
|
||||
my @invalid_var_name;
|
||||
foreach my $line (split(/\n/, $inc)) {
|
||||
if ($line =~ /export +(.*)/) {
|
||||
my $varname = $1;
|
||||
if ($varname =~ /-/) {
|
||||
push @invalid_var_name, $varname;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (@invalid_var_name) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "In your configuration, the invalid charactor '-' is used in the following names: " . join(',', @invalid_var_name);
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
push @::exclude_nodes, $node;
|
||||
}
|
||||
|
||||
} #end foreach node
|
||||
|
||||
undef(%::GLOBAL_TAB_HASH);
|
||||
|
@ -1242,7 +1242,7 @@ sub updatenode
|
||||
if (@exclude_nodes > 0) {
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"Following nodes will be ignored bacause they are missing some attribute definitions: @exclude_nodes";
|
||||
"Following nodes will be ignored bacause they are missing some attributes or have incorrect configuration: @exclude_nodes";
|
||||
$rsp->{errorcode}->[0] =1;
|
||||
$callback->($rsp);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user