From e363c5d2e69288d1a9a5661b0805b26fa3543885 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Fri, 27 Nov 2020 11:58:15 +0100 Subject: [PATCH] fix tasks docker --- centreon-plugins/cloud/docker/restapi/custom/api.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/centreon-plugins/cloud/docker/restapi/custom/api.pm b/centreon-plugins/cloud/docker/restapi/custom/api.pm index ba5fbb4c0..9e9fd9631 100644 --- a/centreon-plugins/cloud/docker/restapi/custom/api.pm +++ b/centreon-plugins/cloud/docker/restapi/custom/api.pm @@ -360,8 +360,11 @@ sub api_list_services { my ($self, %options) = @_; my $services = {}; - foreach my $node_name (@{$self->{node_names}}) { + foreach my $node_name (@{$self->{node_names}}) { + # 406 or 503 - node is not part of a swarm my $list_tasks = $self->internal_api_list_tasks(node_name => $node_name); + next if ($self->{http}->get_code() == 406 || $self->{http}->get_code() == 503); + my $list_services = $self->internal_api_list_services(node_name => $node_name); foreach my $task (@$list_tasks) { $services->{ $task->{ServiceID} } = {} if (!defined($services->{ $task->{ServiceID} }));