as last commit, for discover

This commit is contained in:
Oliver Gorwits
2019-08-26 11:35:13 +01:00
parent 61f9c89040
commit e0ddbaab08
2 changed files with 6 additions and 6 deletions

View File

@@ -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.
@@ -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')) {

View File

@@ -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