fix for bug 3219819: do not add hosts into /etc/hosts if the ip field is not an ip

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9626 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
ligc 2011-05-18 06:19:48 +00:00
parent dceba492cb
commit 0105f20655
2 changed files with 35 additions and 4 deletions

View File

@ -8,7 +8,7 @@ B<lsdef> [B<-h>|B<--help>] [B<-t> I<object-types>]
B<lsdef> [B<-V>|B<--verbose>] [B<-l>|B<--long>] [B<-s>|B<--short>] [B<-a>|B<--all>] [B<-S>]
[B<-t> I<object-types>] [B<-o> I<object-names>] [B<-z>|B<--stanza>] [B<-i> I<attr-list>]
[[B<-w> I<attr>==I<val>] [B<-w> I<attr>=~I<val>] ...] [I<noderange>]
[B<-c>|B<--compress>] [[B<-w> I<attr>==I<val>] [B<-w> I<attr>=~I<val>] ...] [I<noderange>]
=head1 DESCRIPTION
@ -25,6 +25,12 @@ in the xCAT database.
Display all definitions.
=item B<-c|--compress>
Display information in compressed mode, each output line has format "<object name>: <data>".
The output can be passed to command xcoll or xdshbak for formatted output.
The -c flag must be used with -i flag.
=item B<-h|--help>
Display usage message.
@ -185,8 +191,14 @@ The hidden nodes are FSP/BPAs.
lsdef -S
=back
=item 15.
To list the nodes status and use xcoll to format the output.
lsdef -t node -i status -c | xcoll
=back
=head1 FILES

View File

@ -242,6 +242,7 @@ sub processArgs
if (
!GetOptions(
'all|a' => \$::opt_a,
'compress|c'=> \$::opt_c,
'dynamic|d' => \$::opt_d,
'f|force' => \$::opt_f,
'i=s' => \$::opt_i,
@ -303,6 +304,13 @@ sub processArgs
return 2;
}
# -c must be used together with -i
if ($::opt_c && !$::opt_i) {
my $rsp;
$rsp->{data}->[0] = "The flags \'-c'\ and \'-i'\ must be used together.";
xCAT::MsgUtils->message("E", $rsp, $::callback);
return 2;
}
# can get object names in many ways - easier to keep track
$::objectsfrom_args = 0;
$::objectsfrom_opto = 0;
@ -2867,7 +2875,10 @@ sub defls
}
else
{
push (@{$rsp_info->{data}}, "Object name: $obj");
if (!$::opt_c)
{
push (@{$rsp_info->{data}}, "Object name: $obj");
}
}
}
@ -2903,7 +2914,15 @@ sub defls
# since they asked for this attr
# show it even if not set
push (@{$rsp_info->{data}}, " $showattr=$attrval");
if (!$::opt_c)
{
push (@{$rsp_info->{data}}, " $showattr=$attrval");
}
else
{
push (@{$rsp_info->{data}}, "$obj: $showattr=$attrval");
}
}
}
}