xcat-core/xCAT-client/bin/wvid
lissav 3189afe3bd comment out use Dumper
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9274 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
2011-04-11 16:17:08 +00:00

54 lines
1.5 KiB
Perl
Executable File

#!/usr/bin/env perl
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; }
use lib "$::XCATROOT/lib/perl";
use Cwd;
#use IO::Socket::SSL;
#use IO::Socket::INET;
my %rvidhash;
my $xcatroot = $ENV{'XCATROOT'};
unless ($xcatroot) {
$xcatroot = "/opt/xcat"
}
use File::Basename;
use xCAT::Client;
#use Data::Dumper;
sub process_response {
my $resp = shift;
foreach my $rst (\@{$resp->{node}}) {
foreach my $rsp (@$rst) {
if ($rsp->{errorcode} and (not ref $rsp->{errorcode} or $rsp->{errorcode}->[0])) {
print $rsp->{name}->[0].": Error: ".$rsp->{error}->[0]."\n";
} else {
$rvidhash{$rsp->{name}->[0]}->{$rsp->{data}->[0]->{desc}->[0]} = $rsp->{data}->[0]->{contents}->[0];
}
}
}
}
my $cmdref;
$cmdref->{command}->[0] = 'getrvidparms';
# Consider the 1st non-hyphen arg to be the noderange. All others (before and after) go on the arg list.
my $arg=shift(@ARGV);
while ($arg =~ /^-/) {
push (@{$cmdref->{arg}}, $arg);
$arg=shift(@ARGV);
}
if ($arg ne "NO_NODE_RANGE") {
$cmdref->{noderange}->[0]=$arg;
}
push (@{$cmdref->{arg}}, @ARGV);
xCAT::Client::submit_request($cmdref,\&process_response);
my %CLEANENV=%ENV;
foreach my $node (keys %rvidhash) {
%ENV=%CLEANENV;
foreach my $var (keys %{$rvidhash{$node}}) {
$ENV{"rvid_$var"}=$rvidhash{$node}->{$var};
}
system("$xcatroot/share/xcat/rvid/rvid.".$ENV{"rvid_method"}." &");
}
exit $xCAT::Client::EXITCODE;