- improved gettab man page

- added usage support to tabgrep
- fixed 2 uninitialized var msgs in xcatd

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4045 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
bp-sawyers 2009-08-26 19:41:30 +00:00
parent 3db62d378a
commit c9151502b9
3 changed files with 31 additions and 18 deletions

View File

@ -1,6 +1,6 @@
=head1 NAME
B<gettab> - search through tables using keys and return attributes.
B<gettab> - select table rows, based on attribute criteria, and display specific attributes.
=head1 SYNOPSIS
@ -10,8 +10,10 @@ B<gettab> [B<-?> | B<-h> | B<--help>]
=head1 DESCRIPTION
The gettab command uses the specified key values to search the specified tables. For each matched
row, the specified attributes are displayed.
The B<gettab> command uses the specified key values to select a row in each of the tables requested.
For each selected row, the specified attributes are displayed. The B<gettab> command can be used instead
of B<nodels> for tables that are not keyed by nodename (e.g. the B<site> table), or to select rows based
on an attribute value other than nodename.
=head1 OPTIONS
@ -19,7 +21,8 @@ row, the specified attributes are displayed.
=item B<-H|--with-fieldname>
Always display table.column description next to result
Always display table.attribute name next to result. By default, this is done only if more than
one table.attribute is requested.
=item B<-?|-h|--help>
@ -47,23 +50,23 @@ An error has occurred.
=item *
To display node names that have B<mgt> set to B<blade> in the nodehm table:
To display setting for B<master> (management node) in the site table:
B<gettab -H> I<key=master site.value>
The output would be similar to:
site.value: mgmtnode.cluster.com
=item *
To display the first node or group name that has B<mgt> set to B<blade> in the nodehm table:
B<gettab> I<mgt=blade nodehm.node>
The output would be similar to:
nodehm.node: blades
=item *
To display setting for B<master> (management node) in the site table:
B<gettab> I<key=master site.value>
The output would be similar to:
site.value: mgmtnode.cluster.com
blades
=back

View File

@ -148,6 +148,7 @@ sub gettab
};
# Process arguments
if (!defined($req->{arg})) { $gettab_usage->(1); return; }
@ARGV = @{$req->{arg}};
if (!GetOptions('h|?|help' => \$HELP,'H|with-fieldname' => \$NOTERSE)) { $gettab_usage->(1); return; }
@ -841,6 +842,15 @@ sub tabgrep
my @tablist;
my $callback = shift;
if (!defined($node) || !scalar(@$node)) {
my %rsp;
push @{$rsp{data}}, "Usage: tabgrep nodename";
push @{$rsp{data}}, " tabgrep [-?|-h|--help]";
$rsp{errorcode} = 1;
$callback->(\%rsp);
return;
}
foreach (keys %{xCAT::Schema::tabspec})
{
if (grep /^node$/, @{$xCAT::Schema::tabspec{$_}->{cols}})

View File

@ -1289,7 +1289,7 @@ sub service_connection {
$req->{'_xcat_clientfqdn'} = [$peerfqdn];
$req->{'_xcat_clientport'}= [$peerport];
$$progname="xCATd SSL: ".$req->{command}->[0];
if ($req->{noderange}) {
if ($req->{noderange} && defined($req->{noderange}->[0])) {
$$progname .= " to ".$req->{noderange}->[0];
}
$$progname .= " for ".($peername ? $peername ."@".$peerhost : $peerhost);
@ -1541,7 +1541,7 @@ sub validate {
if ($rule->{rule}) {
if ($rule->{rule} =~ /allow/i or $rule->{rule} =~ /accept/i) {
my $logst = "xCAT: Allowing ".$request->{command}->[0];
if ($request->{noderange}) { $logst .= " to ".$request->{noderange}->[0]; }
if ($request->{noderange} && defined($request->{noderange}->[0])) { $logst .= " to ".$request->{noderange}->[0]; }
if ($peername) { $logst .= " for " . $peername };
if ($peerhost) { $logst .= " from " . $peerhost };
xCAT::MsgUtils->message("S",$logst);