diff --git a/perl-xCAT/xCAT/DBobjUtils.pm b/perl-xCAT/xCAT/DBobjUtils.pm index 8cae4a385..fd3fd3904 100644 --- a/perl-xCAT/xCAT/DBobjUtils.pm +++ b/perl-xCAT/xCAT/DBobjUtils.pm @@ -1277,6 +1277,7 @@ if (0) { # accessing table is time consuming. if ($table eq "postscripts") { my $xcatdefaultsps; + my $xcatdefaultspbs; my @TableRowArray = xCAT::DBobjUtils->getDBtable('postscripts'); if (defined(@TableRowArray)) { @@ -1285,18 +1286,21 @@ if (0) { if(($tablerow->{node} eq 'xcatdefaults') && !($tablerow->{disable})) { $xcatdefaultsps = $tablerow->{postscripts}; + $xcatdefaultspbs = $tablerow->{postbootscripts}; last; } } } my @xcatdefps = split(/,/, $xcatdefaultsps); + my @xcatdefpbs = split(/,/, $xcatdefaultspbs); foreach my $obj(keys %{$allupdates{$table}}) { if ($obj eq 'xcatdefaults') { #xcatdefaults can be treated as a node? next; } my @newps; - if (defined($allupdates{$table}{$obj}{'postscripts'}{'tabattrs'}{'postscripts'})) { + if (defined($allupdates{$table}{$obj}{'postscripts'}) + && defined($allupdates{$table}{$obj}{'postscripts'}{'tabattrs'}{'postscripts'})) { foreach my $tempps (split(/,/, $allupdates{$table}{$obj}{'postscripts'}{'tabattrs'}{'postscripts'})) { if (grep(/^$tempps$/, @xcatdefps)) { my $rsp; @@ -1308,6 +1312,20 @@ if (0) { } $allupdates{$table}{$obj}{'postscripts'}{'tabattrs'}{'postscripts'} = join(',', @newps); } + my @newpbs; + if (defined($allupdates{$table}{$obj}{'postbootscripts'}) + && defined($allupdates{$table}{$obj}{'postbootscripts'}{'tabattrs'}{'postbootscripts'})) { + foreach my $temppbs (split(/,/, $allupdates{$table}{$obj}{'postbootscripts'}{'tabattrs'}{'postbootscripts'})) { + if (grep(/^$temppbs$/, @xcatdefpbs)) { + my $rsp; + $rsp->{data}->[0] = "$obj: postbootscripts \'$temppbs\' is already included in the \'xcatdefaults\'."; + xCAT::MsgUtils->message("E", $rsp, $::callback); + } else { + push @newpbs, $temppbs; + } + } + $allupdates{$table}{$obj}{'postbootscripts'}{'tabattrs'}{'postbootscripts'} = join(',', @newpbs); + } } } OBJ: foreach my $obj (keys %{$allupdates{$table}}) { diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index 1b3d400a1..094bd6870 100644 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -2383,7 +2383,7 @@ sub defls # need a special case for the node postscripts attribute, - # The 'xcatdefaults' postscript should be added to the postscript attribute + # The 'xcatdefaults' postscript should be added to the postscripts and postbootscripts attribute my $getnodes = 0; if (!$::opt_z) { #if -z flag is specified, do not add the xcatdefaults foreach my $objtype (@::clobjtypes) @@ -2398,6 +2398,7 @@ sub defls if ($getnodes) { my $xcatdefaultsps; + my $xcatdefaultspbs; my @TableRowArray = xCAT::DBobjUtils->getDBtable('postscripts'); if (defined(@TableRowArray)) { @@ -2406,6 +2407,7 @@ sub defls if(($tablerow->{node} eq 'xcatdefaults') && !($tablerow->{disable})) { $xcatdefaultsps = $tablerow->{postscripts}; + $xcatdefaultspbs = $tablerow->{postbootscripts}; last; } } @@ -2425,6 +2427,17 @@ sub defls $myhash{$obj}{postscripts} = $xcatdefaultsps; } } + if($xcatdefaultspbs) + { + if ($myhash{$obj}{postbootscripts}) + { + $myhash{$obj}{postbootscripts} = $xcatdefaultspbs . ',' . $myhash{$obj}{postbootscripts}; + } + else + { + $myhash{$obj}{postbootscripts} = $xcatdefaultspbs; + } + } } } }