From 9792aea585bd6811c1671f59bf18501af7ddf848 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Fri, 18 Jul 2008 19:37:43 +0000 Subject: [PATCH] -Change tabutils plugin to be compliant with strict git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1899 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/tabutils.pm | 29 ++++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/tabutils.pm b/xCAT-server/lib/xcat/plugins/tabutils.pm index a3fcfa592..ad7436a82 100644 --- a/xCAT-server/lib/xcat/plugins/tabutils.pm +++ b/xCAT-server/lib/xcat/plugins/tabutils.pm @@ -6,6 +6,7 @@ # ##################################################### package xCAT_plugin::tabutils; +use strict; use xCAT::Table; use xCAT::Schema; use Data::Dumper; @@ -227,8 +228,8 @@ sub noderm if ($VERSION) { my %rsp; my $version = xCAT::Utils->Version(); - $rsp->{data}->[0] = "$version"; - $cb->($rsp); + $rsp{data}->[0] = "$version"; + $cb->(\%rsp); return; } @@ -489,7 +490,6 @@ sub tabdump } } $line =~ s/,$//; # remove the extra comma at the end - $line = $line . $lineappend; push @{$rsp{data}}, $line; } $cb->(\%rsp); @@ -541,8 +541,8 @@ sub nodech if ($VERSION) { my %rsp; my $version = xCAT::Utils->Version(); - $rsp->{data}->[0] = "$version"; - $callback->($rsp); + $rsp{data}->[0] = "$version"; + $callback->(\%rsp); return; } @@ -598,6 +598,7 @@ sub nodech chop($temp); } + my $table; if ($shortnames{$temp}) { ($table, $column) = @{$shortnames{$temp}}; @@ -736,6 +737,9 @@ sub nodels my $args = shift; my $callback = shift; my $noderange = shift; + unless ($nodes) { + $nodes=[]; + } my $VERSION; my $HELP; @@ -763,7 +767,11 @@ sub nodels $callback->(\%rsp); } - @ARGV = @{$args}; + if ($args) { + @ARGV = @{$args}; + } else { + @ARGV=(); + } my $NOTERSE; if (!GetOptions('h|?|help' => \$HELP, 'H|with-fieldname' => \$NOTERSE, 'v|version' => \$VERSION,) ) { nodels_usage(1); return; } @@ -775,8 +783,8 @@ sub nodels { my %rsp; my $version = xCAT::Utils->Version(); - $rsp->{data}->[0] = "$version"; - $callback->($rsp); + $rsp{data}->[0] = "$version"; + $callback->(\%rsp); return; } @@ -797,7 +805,7 @@ sub nodels { #Make sure that there are zero nodes *and* that a noderange wasn't requested # TODO - gather data for each node # for now just return the flattened list of nodes) - my %rsp; #build up fewer requests, be less chatty + my $rsp; #build up fewer requests, be less chatty if ($argc) { my %tables; @@ -848,6 +856,7 @@ sub nodels #print Dumper($tables{$tab}); my $node; my %labels; + my @cols=(); foreach (@{$tables{$tab}}) { push @cols, $_->[0]; @@ -910,7 +919,7 @@ sub nodels my @ents = $nodelisttab->getAllAttribs(@attribs); foreach (@ents) { - my %rsp; + my $rsp; if ($_->{node}) { $rsp->{node}->[0]->{name}->[0] = ($_->{node});