added image based postscripts

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8243 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
vallard 2010-11-23 18:06:21 +00:00
parent a8c3e62c11
commit 21cf066bd4

View File

@ -124,6 +124,7 @@ sub makescript
my $typetab = xCAT::Table->new('nodetype');
my $posttab = xCAT::Table->new('postscripts');
my $sitetab = xCAT::Table->new('site');
my $ostab = xCAT::Table->new('ostab');
my %rsp;
my $rsp;
@ -136,6 +137,12 @@ sub makescript
return undef;
}
unless ($ostab){
push @{$rsp->{data}},
"Unable to open os table (ostab)";
xCAT::MsgUtils->message("E", $rsp, $callback);
return undef;
}
# read all attributes for the site table and write an export
# for them in the post install file
@ -551,7 +558,8 @@ sub makescript
push @scriptd, "# postscripts-start-here\n";
my %post_hash = (); #used to reduce duplicates
# get the xcatdefaults entry in the postscripts table
# get the xcatdefaults entry in the postscripts table
my $et =
$posttab->getAttribs({node => "xcatdefaults"},
'postscripts', 'postbootscripts');
@ -568,8 +576,29 @@ sub makescript
}
}
}
# get postscripts for images
my $osimgname = $provmethod;
# get postscripts
if($osimgname =~ /install|netboot|statelite/){
$osimgname = "$os-$arch-$provmethod-$profile";
}
my $et2 =
$ostab->getAttribs({'image' => "$osimgname"}, ['postscripts', 'postbootscripts']);
$ps = $et2->{'postscripts'};
if ($ps)
{
foreach my $n (split(/,/, $ps))
{
if (!exists($post_hash{$n}))
{
$post_hash{$n} = 1;
push @scriptd, $n . "\n";
}
}
}
# get postscripts for node specific
my $et1 =
$posttab->getNodeAttribs($node, ['postscripts', 'postbootscripts']);
$ps = $et1->{'postscripts'};