From e61792e1807001e13ef2cbbb6a9aa81ec4b391af Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 11 Apr 2013 14:28:35 +0000 Subject: [PATCH] Have wcons not call nodels as a subprocess git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15951 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/bin/wcons | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/xCAT-client/bin/wcons b/xCAT-client/bin/wcons index 9dfbc50f5..5648fdcf5 100755 --- a/xCAT-client/bin/wcons +++ b/xCAT-client/bin/wcons @@ -22,27 +22,31 @@ GetOptions( #'font|f=s' => \$font ); my $noderange = $ARGV[$#ARGV]; -my %noderangeref = (command => 'noderange', noderange => $noderange); my %conserverref = (command => 'nodels', noderange => $noderange, arg => ['nodehm.conserver']); +my @nodes; +my %conservers; +sub getconserver { + my $rsp = shift; + use Data::Dumper; + print Dumper($rsp); + foreach (@{$rsp->{node}}) { + my $node = $_->{name}; + if (ref $node) { $node = $node->[0]; } + push @nodes,$node; + if ($_->{data}->[0]->{contents}) { + $conservers{$node}=$_->{data}->[0]->{contents}; + if (ref $conservers{$node}) { $conservers{$node} = $conservers{$node}->[0] }; + } + } +} +xCAT::Client::submit_request(\%conserverref,\&getconserver); unless ($ARGV[$#ARGV]) { print "Usage: wcons \n"; exit 1; } -my $nodes=`nodels $ARGV[$#ARGV]`; -unless ($nodes) { - exit 1; -} -my $conservers=`nodels $ARGV[$#ARGV] nodehm.conserver`; pop @ARGV; -my @conservers=split /\n/,$conservers; -my %conservers; -foreach (@conservers) { - (my $nd,my $col,my $val) = split /:/,$_,3; - $conservers{$nd}=$val; -} -my @nodes = split /\n/,$nodes; foreach (@nodes) { if ($conservers{$_}) { next;