pass action host list filtering to Util

This commit is contained in:
Oliver Gorwits
2019-06-09 22:15:10 +01:00
parent 0f1c264e41
commit 02569b0e92
2 changed files with 24 additions and 7 deletions

View File

@@ -11,6 +11,7 @@ our @EXPORT_OK = qw/
delete_device
renumber_device
match_to_setting
device_ips_matching device_ips_not_matching
is_discoverable is_discoverable_now
is_arpnipable is_arpnipable_now
is_macsuckable is_macsuckable_now
@@ -144,6 +145,23 @@ sub match_to_setting {
@{setting($setting_name) || []});
}
=head2 device_ips_matching( $setting_name | $acl_entry | \@acl, @IPs? )
Returns a list of Device IPs that match the given ACL. If the ACL is
missing then no device IPs will be returned. If the C< @IPs > list is
provided then it will be used otherwise the current devices in Netdisco's
database will be used as the source list.
=cut
sub device_ips_matching {
my ($acl, @ips) = @_;
return () unless $acl;
my $config = (exists config->{"$acl"} ? setting($acl) : $acl);
my @startlist = (scalar @ips ? @ips :
schema('netdisco')->resultset('Device')->get_column('ip')->all);
}
sub _bail_msg { debug $_[0]; return 0; }
=head2 is_discoverable( $ip, [$device_type, \@device_capabilities]? )