Skip to content

Commit

Permalink
as last commit, for discover
Browse files Browse the repository at this point in the history
  • Loading branch information
ollyg committed Aug 26, 2019
1 parent 61f9c89 commit e0ddbaa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
9 changes: 6 additions & 3 deletions lib/App/Netdisco/Util/Device.pm
Expand Up @@ -192,9 +192,9 @@ sub is_discoverable {

=head2 is_discoverable_now( $ip, $device_type? )
Same as C<is_discoverable>, but also checks the last_discover field if the
device is in storage, and returns false if that host has been too recently
discovered.
Same as C<is_discoverable>, but also compares the C<last_discover> field
of the C<device> to the C<discover_min_age> configuration. Also checks
for pseudo devicea.
Returns false if the host is not permitted to discover the target device.
Expand All @@ -204,6 +204,9 @@ sub is_discoverable_now {
my ($ip, $remote_type) = @_;
my $device = get_device($ip) or return 0;

return _bail_msg("is_discoverable: $device is pseudo-device")
if $device->is_pseudo;

if ($device->in_storage
and $device->since_last_discover and setting('discover_min_age')
and $device->since_last_discover < setting('discover_min_age')) {
Expand Down
3 changes: 0 additions & 3 deletions lib/App/Netdisco/Worker/Plugin/Discover.pm
Expand Up @@ -16,9 +16,6 @@ register_worker({ phase => 'check' }, sub {
return Status->error("discover failed: no device param (need -d ?)")
if $device->ip eq '0.0.0.0';

return Status->info("discover skipped: $device is pseudo-device")
if $device->is_pseudo;

# runner has already called get_device to promote $job->device
return $job->cancel("fresh discover cancelled: $device already known")
if $device->in_storage
Expand Down

0 comments on commit e0ddbaa

Please sign in to comment.