2008-04-29 18:41:24 +00:00
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
#-------------------------------------------------------
|
|
|
|
|
|
|
|
=head1
|
|
|
|
xCAT plugin package to handle getpostscript command
|
|
|
|
|
|
|
|
=cut
|
|
|
|
|
|
|
|
#-------------------------------------------------------
|
|
|
|
package xCAT_plugin::getpostscript;
|
|
|
|
use xCAT::Utils;
|
2008-08-20 16:51:06 +00:00
|
|
|
use xCAT::MsgUtils;
|
2008-04-29 18:41:24 +00:00
|
|
|
use xCAT::NodeRange;
|
|
|
|
|
|
|
|
1;
|
|
|
|
|
|
|
|
#-------------------------------------------------------
|
|
|
|
|
|
|
|
=head3 handled_commands
|
|
|
|
|
|
|
|
Return list of commands handled by this plugin
|
|
|
|
|
|
|
|
=cut
|
|
|
|
|
|
|
|
#-------------------------------------------------------
|
|
|
|
|
|
|
|
sub handled_commands
|
|
|
|
{
|
|
|
|
return {'getpostscript' => "getpostscript"};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------------
|
|
|
|
|
|
|
|
=head3 process_request
|
|
|
|
|
|
|
|
Process the command
|
|
|
|
|
|
|
|
=cut
|
|
|
|
|
|
|
|
#-------------------------------------------------------
|
|
|
|
sub process_request
|
|
|
|
{
|
|
|
|
my $request = shift;
|
|
|
|
my $callback = shift;
|
|
|
|
my $nodes = $request->{node};
|
|
|
|
my $command = $request->{command}->[0];
|
|
|
|
my $args = $request->{arg};
|
|
|
|
my $envs = $request->{env};
|
|
|
|
my $rsp;
|
|
|
|
my $i = 1;
|
|
|
|
my @nodes=@$nodes;
|
|
|
|
# do your processing here
|
|
|
|
# return info
|
|
|
|
my $client;
|
|
|
|
if ($request->{'_xcat_clienthost'}) {
|
|
|
|
$client = $request->{'_xcat_clienthost'}->[0];
|
|
|
|
}
|
2008-05-14 19:14:32 +00:00
|
|
|
|
2008-04-29 18:41:24 +00:00
|
|
|
if ($client) { ($client) = noderange($client) };
|
|
|
|
unless ($client) { #Not able to do identify the host in question
|
2008-08-20 16:51:06 +00:00
|
|
|
xCAT::MsgUtils->message("S","Received getpostscript from $client, which couldn't be correlated to a node (domain mismatch?)");
|
2008-04-29 18:41:24 +00:00
|
|
|
return;
|
|
|
|
}
|
2008-05-14 19:14:32 +00:00
|
|
|
my $state;
|
|
|
|
if ($request->{scripttype}) { $state = $request->{scripttype}->[0];}
|
2008-04-29 18:41:24 +00:00
|
|
|
|
2009-03-14 16:14:29 +00:00
|
|
|
require xCAT::Postage;
|
2008-04-29 18:41:24 +00:00
|
|
|
my @scriptcontents = xCAT::Postage::makescript($client,$state,$callback);
|
|
|
|
if (scalar(@scriptcontents)) {
|
|
|
|
$rsp->{data} = \@scriptcontents;
|
|
|
|
}
|
|
|
|
$callback->($rsp);
|
|
|
|
}
|
|
|
|
|