rename match_devicetype() to match_to_setting()
This commit is contained in:
		| @@ -10,7 +10,7 @@ our @EXPORT_OK = qw/ | ||||
|   get_device | ||||
|   delete_device | ||||
|   renumber_device | ||||
|   match_devicetype | ||||
|   match_to_setting | ||||
|   is_discoverable is_discoverable_now | ||||
|   is_arpnipable   is_arpnipable_now | ||||
|   is_macsuckable  is_macsuckable_now | ||||
| @@ -129,7 +129,7 @@ sub renumber_device { | ||||
|   return $happy; | ||||
| } | ||||
|  | ||||
| =head2 match_devicetype( $type, $setting_name ) | ||||
| =head2 match_to_setting( $type, $setting_name ) | ||||
|  | ||||
| Given a C<$type> (which may be any text value), returns true if any of the | ||||
| list of regular expressions in C<$setting_name> is matched, otherwise returns | ||||
| @@ -137,7 +137,7 @@ false. | ||||
|  | ||||
| =cut | ||||
|  | ||||
| sub match_devicetype { | ||||
| sub match_to_setting { | ||||
|     my ($type, $setting_name) = @_; | ||||
|     return 0 unless $type and $setting_name; | ||||
|     return (scalar grep {$type =~ m/$_/} | ||||
| @@ -165,7 +165,7 @@ sub is_discoverable { | ||||
|   my ($ip, $remote_type) = @_; | ||||
|   my $device = get_device($ip) or return 0; | ||||
|  | ||||
|   if (match_devicetype($remote_type, 'discover_no_type')) { | ||||
|   if (match_to_setting($remote_type, 'discover_no_type')) { | ||||
|       return _bail_msg("is_discoverable: $device matched discover_no_type"); | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -7,7 +7,7 @@ use Dancer::Plugin::Auth::Extensible; | ||||
|  | ||||
| use URI (); | ||||
| use URL::Encode 'url_params_mixed'; | ||||
| use App::Netdisco::Util::Device 'match_devicetype'; | ||||
| use App::Netdisco::Util::Device 'match_to_setting'; | ||||
|  | ||||
| # build view settings for port connected nodes and devices | ||||
| set('connected_properties' => [ | ||||
| @@ -20,7 +20,7 @@ hook 'before_template' => sub { | ||||
|   my $tokens = shift; | ||||
|  | ||||
|   # allow checking of discoverability of remote connected device | ||||
|   $tokens->{has_snmp} = sub { not match_devicetype(shift, 'discover_no_type') }; | ||||
|   $tokens->{has_snmp} = sub { not match_to_setting(shift, 'discover_no_type') }; | ||||
|  | ||||
|   my $defaults = var('sidebar_defaults')->{'device_ports'} | ||||
|     or return; | ||||
|   | ||||
| @@ -8,7 +8,7 @@ use App::Netdisco::Transport::SNMP (); | ||||
| use Dancer::Plugin::DBIC 'schema'; | ||||
|  | ||||
| use Encode; | ||||
| use App::Netdisco::Util::Device 'match_devicetype'; | ||||
| use App::Netdisco::Util::Device 'match_to_setting'; | ||||
|  | ||||
| register_worker({ phase => 'main', driver => 'snmp' }, sub { | ||||
|   my ($job, $workerconf) = @_; | ||||
| @@ -86,12 +86,12 @@ register_worker({ phase => 'main', driver => 'snmp' }, sub { | ||||
|     my $remote_type = Encode::decode('UTF-8', $c_platform->{$idx} || ''); | ||||
|  | ||||
|     $properties{ $port }->{remote_is_wap} = 'true' | ||||
|       if scalar grep {match_devicetype($_, 'wap_capabilities')} @$remote_cap | ||||
|          or match_devicetype($remote_type, 'wap_platforms'); | ||||
|       if scalar grep {match_to_setting($_, 'wap_capabilities')} @$remote_cap | ||||
|          or match_to_setting($remote_type, 'wap_platforms'); | ||||
|  | ||||
|     $properties{ $port }->{remote_is_phone} = 'true' | ||||
|       if scalar grep {match_devicetype($_, 'phone_capabilities')} @$remote_cap | ||||
|          or match_devicetype($remote_type, 'phone_platforms'); | ||||
|       if scalar grep {match_to_setting($_, 'phone_capabilities')} @$remote_cap | ||||
|          or match_to_setting($remote_type, 'phone_platforms'); | ||||
|  | ||||
|     next unless scalar grep {defined && m/^inventory$/} @{ $rem_media_cap->{$idx} }; | ||||
|  | ||||
|   | ||||
| @@ -7,7 +7,7 @@ use aliased 'App::Netdisco::Worker::Status'; | ||||
| use App::Netdisco::Transport::SNMP (); | ||||
| use App::Netdisco::Util::Permission 'check_acl_no'; | ||||
| use App::Netdisco::Util::PortMAC 'get_port_macs'; | ||||
| use App::Netdisco::Util::Device 'match_devicetype'; | ||||
| use App::Netdisco::Util::Device 'match_to_setting'; | ||||
| use App::Netdisco::Util::Node 'check_mac'; | ||||
| use App::Netdisco::Util::SNMP 'snmp_comm_reindex'; | ||||
| use Dancer::Plugin::DBIC 'schema'; | ||||
| @@ -342,7 +342,7 @@ sub walk_fwtable { | ||||
|       # neighbors otherwise it would kill the DB with device lookups. | ||||
|       my $neigh_cannot_macsuck = eval { # can fail | ||||
|         check_acl_no(($device_port->neighbor || "0 but true"), 'macsuck_unsupported') || | ||||
|         match_devicetype($device_port->remote_type, 'macsuck_unsupported_type') }; | ||||
|         match_to_setting($device_port->remote_type, 'macsuck_unsupported_type') }; | ||||
|  | ||||
|       if ($device_port->is_uplink) { | ||||
|           if ($neigh_cannot_macsuck) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user