From 3879ed7787ba20abffb697b088396d62c647767d Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Fri, 16 May 2008 21:14:09 +0000 Subject: [PATCH] -Modify output of nodels and gettab in the spirit of grep to address feature 1965017 git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1436 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server-2.0/lib/xcat/plugins/tabutils.pm | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/xCAT-server-2.0/lib/xcat/plugins/tabutils.pm b/xCAT-server-2.0/lib/xcat/plugins/tabutils.pm index 8ec739967..476b9c8d2 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/tabutils.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/tabutils.pm @@ -162,8 +162,10 @@ sub gettab # Group the columns asked for by table (so we can do 1 query per table) my %tabhash; + my $terse = 2; foreach my $tabvalue (@ARGV) { + $terse--; (my $table, my $column) = split /\./, $tabvalue; $tabhash{$table}->{$column} = 1; } @@ -184,7 +186,11 @@ sub gettab (my $ent) = $tab->getAttribs(\%keyhash, keys %{$tabhash{$tabn}}); foreach my $coln (keys %{$tabhash{$tabn}}) { - $callback->({data => ["$tabn.$coln: " . $ent->{$coln}]}); + if ($terse) { + $callback->({data => ["" . $ent->{$coln}]}); + } else { + $callback->({data => ["$tabn.$coln: " . $ent->{$coln}]}); + } } $tab->close; } @@ -774,6 +780,7 @@ sub nodels # } # } my $argc = @ARGV; + my $terse = 2; if (@$nodes > 0 or $noderange) { #Make sure that there are zero nodes *and* that a noderange wasn't requested @@ -791,9 +798,12 @@ sub nodels if ($shortnames{$temp}) { ($table, $column) = @{$shortnames{$temp}}; + $terse--; } elsif ($temp =~ /\./) { ($table, $column) = split('\.', $temp, 2); + $terse--; } elsif ($xCAT::Schema::tabspec{$temp}) { + $terse=0; $table = $temp; foreach my $column (@{$xCAT::Schema::tabspec{$table}->{cols}}) { unless (grep /^$column$/, @{$tables{$table}}) { @@ -839,7 +849,9 @@ sub nodels foreach (keys %$rec) { my %datseg; - $datseg{data}->[0]->{desc} = [$labels{$_}]; + unless ($terse) { + $datseg{data}->[0]->{desc} = [$labels{$_}]; + } $datseg{data}->[0]->{contents} = [$rec->{$_}]; $datseg{name} = [$node]; #{}->{contents} = [$rec->{$_}]; push @{$noderecs{$node}}, \%datseg;