diff --git a/network/cisco/prime/restapi/mode/apusage.pm b/network/cisco/prime/restapi/mode/apusage.pm index a22a82216..d2c1cb13e 100644 --- a/network/cisco/prime/restapi/mode/apusage.pm +++ b/network/cisco/prime/restapi/mode/apusage.pm @@ -202,7 +202,9 @@ sub manage_selection { ($self->{ap}, $self->{ctrl}) = ({}, {}); - foreach my $ap_name (keys %{$access_points}) { + foreach my $ap_name (keys %{$access_points}) { + $access_points->{$ap_name}->{controllerName} = 'NotRegistered' + if (!defined($access_points->{$ap_name}->{controllerName})); if (defined($self->{option_results}->{filter_ap}) && $self->{option_results}->{filter_ap} ne '' && $ap_name !~ /$self->{option_results}->{filter_ap}/) { $self->{output}->output_add(long_msg => "skipping '" . $ap_name . "': no matching filter.", debug => 1); @@ -214,8 +216,6 @@ sub manage_selection { next; } - $access_points->{$ap_name}->{controllerName} = 'NotRegistered' - if (!defined($access_points->{$ap_name}->{controllerName})); $self->{ap}->{$ap_name} = { name => $ap_name, controller => $access_points->{$ap_name}->{controllerName}, status => $access_points->{$ap_name}->{status},