(plugin) network:🇦🇼:orchestrator::restapi - fix filter-hostname option (#3928)
This commit is contained in:
parent
f47b2b0415
commit
605c8e91e5
|
@ -120,11 +120,16 @@ sub manage_selection {
|
||||||
|
|
||||||
foreach my $appliance (@$appliances) {
|
foreach my $appliance (@$appliances) {
|
||||||
next if (defined($self->{option_results}->{filter_hostname}) && $self->{option_results}->{filter_hostname} ne '' &&
|
next if (defined($self->{option_results}->{filter_hostname}) && $self->{option_results}->{filter_hostname} ne '' &&
|
||||||
$appliance->{hostname} !~ /$self->{option_results}->{filter_hostname}/);
|
$appliance->{hostName} !~ /$self->{option_results}->{filter_hostname}/);
|
||||||
|
|
||||||
push @{$post->{ids}}, $appliance->{id};
|
push @{$post->{ids}}, $appliance->{id};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (scalar(@{$post->{ids}}) <= 0) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => 'no appliances selected');
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
|
|
||||||
my $results = $options{custom}->request_api(
|
my $results = $options{custom}->request_api(
|
||||||
method => 'POST',
|
method => 'POST',
|
||||||
endpoint => '/alarm/appliance',
|
endpoint => '/alarm/appliance',
|
||||||
|
|
|
@ -128,7 +128,7 @@ sub manage_selection {
|
||||||
$self->{appliances} = {};
|
$self->{appliances} = {};
|
||||||
foreach my $appliance (@$appliances) {
|
foreach my $appliance (@$appliances) {
|
||||||
next if (defined($self->{option_results}->{filter_hostname}) && $self->{option_results}->{filter_hostname} ne '' &&
|
next if (defined($self->{option_results}->{filter_hostname}) && $self->{option_results}->{filter_hostname} ne '' &&
|
||||||
$appliance->{hostname} !~ /$self->{option_results}->{filter_hostname}/);
|
$appliance->{hostName} !~ /$self->{option_results}->{filter_hostname}/);
|
||||||
|
|
||||||
my $group = $self->get_group(groups => $groups, groupId => $appliance->{groupId});
|
my $group = $self->get_group(groups => $groups, groupId => $appliance->{groupId});
|
||||||
next if (defined($self->{option_results}->{filter_group}) && $self->{option_results}->{filter_group} ne '' &&
|
next if (defined($self->{option_results}->{filter_group}) && $self->{option_results}->{filter_group} ne '' &&
|
||||||
|
|
Loading…
Reference in New Issue