make def commands support the default postscripts for postbootscripts attribute
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4828 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
0c7d1050fc
commit
62b94e5eb7
@ -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}}) {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user