fix for bug 2887320: check postscripts whether in xcatdefaults before setting to the database.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4494 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
e15a6563a0
commit
590425a581
@ -1269,6 +1269,43 @@ if (0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Special case for the postscripts table
|
||||
# Does not set the postscripts to the postscripts table
|
||||
# if the postscripts already in xcatdefaults
|
||||
# for code logic, it will be clearer to put the special case into defch,
|
||||
# but putting it into defch will introduce additional table access for postscripts table.
|
||||
# accessing table is time consuming.
|
||||
if ($table eq "postscripts") {
|
||||
my $xcatdefaultsps;
|
||||
my @TableRowArray = xCAT::DBobjUtils->getDBtable('postscripts');
|
||||
if (defined(@TableRowArray))
|
||||
{
|
||||
foreach my $tablerow (@TableRowArray)
|
||||
{
|
||||
if(($tablerow->{node} eq 'xcatdefaults') && !($tablerow->{disable}))
|
||||
{
|
||||
$xcatdefaultsps = $tablerow->{postscripts};
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
my @xcatdefps = split(/,/, $xcatdefaultsps);
|
||||
foreach my $obj(keys %{$allupdates{$table}}) {
|
||||
my @newps;
|
||||
if (defined($allupdates{$table}{$obj}{'postscripts'}{'tabattrs'}{'postscripts'})) {
|
||||
foreach my $tempps (split(/,/, $allupdates{$table}{$obj}{'postscripts'}{'tabattrs'}{'postscripts'})) {
|
||||
if (grep(/^$tempps$/, @xcatdefps)) {
|
||||
my $rsp;
|
||||
$rsp->{data}->[0] = "$obj: postscripts \'$tempps\' is already included in the \'xcatdefaults\'.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::callback);
|
||||
} else {
|
||||
push @newps, $tempps;
|
||||
}
|
||||
}
|
||||
$allupdates{$table}{$obj}{'postscripts'}{'tabattrs'}{'postscripts'} = join(',', @newps);
|
||||
}
|
||||
}
|
||||
}
|
||||
OBJ: foreach my $obj (keys %{$allupdates{$table}}) {
|
||||
ROW: foreach my $row (keys %{$allupdates{$table}{$obj}}) {
|
||||
my %keyhash;
|
||||
|
Loading…
Reference in New Issue
Block a user