Skip to content

Commit

Permalink
#565 fix netdisco-do when no device param needed
Browse files Browse the repository at this point in the history
  • Loading branch information
ollyg committed Apr 24, 2019
1 parent 0f2ce6b commit af428dd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bin/netdisco-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ print color 'reset';

my $term = Term::ReadLine->new('netdisco');
my $bool = $term->ask_yn(
prompt => 'So, is all off the above in place?', default => 'n',
prompt => 'So, is all of the above in place?', default => 'n',
);

exit(0) unless $bool;
Expand Down
12 changes: 8 additions & 4 deletions bin/netdisco-do
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ if (scalar @hostlist > 512) {
exit 1;
}

# some actions do not take a device parameter
@hostlist = (undef) if 0 == scalar @hostlist;

foreach my $host (@hostlist) {
my $dev = $host ? get_device($host->addr) : undef;
if ($dev and not (blessed $dev and $dev->in_storage) and $action !~ m/^discover/) {
Expand Down Expand Up @@ -205,11 +208,12 @@ pass C<action::stage> as the first argument to C<netdisco-do>, for example
C<discover::neighbors>.
Any action taking a C<device> parameter can be passed either a hostname or IP
address of any interface of a known or unknown device, or an IP prefix (subnet)
which will cause C<netdisco-do> to run the action on all addresses in that range.
address of any interface of a known or unknown device, or an IP prefix
(subnet) which will cause C<netdisco-do> to run the action on all addresses in
that range.
The C<device> parameter may be passed multiple times. In this case, the devices
will be handled one by one.
The C<device> parameter may be passed multiple times. In this case, all
addresses (after expanding IP Prefixes) will be handled one by one.
=head2 discover
Expand Down

0 comments on commit af428dd

Please sign in to comment.