From cbbdd179cb3981defcf95f2918e842f3255f0943 Mon Sep 17 00:00:00 2001 From: qgarnier Date: Fri, 2 Jul 2021 11:07:57 +0200 Subject: [PATCH] fix(velocloud): list modes errors (#2930) --- .../velocloud/restapi/mode/listedges.pm | 19 ++++++++++++++----- .../velocloud/restapi/mode/listlinks.pm | 4 +++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/centreon-plugins/cloud/vmware/velocloud/restapi/mode/listedges.pm b/centreon-plugins/cloud/vmware/velocloud/restapi/mode/listedges.pm index c0db68e1c..2104ca92b 100644 --- a/centreon-plugins/cloud/vmware/velocloud/restapi/mode/listedges.pm +++ b/centreon-plugins/cloud/vmware/velocloud/restapi/mode/listedges.pm @@ -51,10 +51,19 @@ sub run { $self->manage_selection(%options); foreach my $edge (@{$self->{edges}}) { - $self->{output}->output_add(long_msg => sprintf("[id = %s][name = %s][description = %s][edge_state = %s]" . - "[service_state = %s][ha_state = %s][activation_state = %s]", - $edge->{id}, $edge->{name}, $edge->{description}, $edge->{edgeState}, $edge->{serviceState}, - $edge->{haState}, $edge->{activationState})); + $self->{output}->output_add( + long_msg => sprintf( + "[id = %s][name = %s][description = %s][edge_state = %s]" . + "[service_state = %s][ha_state = %s][activation_state = %s]", + $edge->{id}, + $edge->{name}, + defined($edge->{description}) ? $edge->{description} : '', + $edge->{edgeState}, + $edge->{serviceState}, + $edge->{haState}, + $edge->{activationState} + ) + ); } $self->{output}->output_add( @@ -84,7 +93,7 @@ sub disco_show { $self->{output}->add_disco_entry( id => $edge->{id}, name => $edge->{name}, - description => $edge->{description}, + description => defined($edge->{description}) ? $edge->{description} : '', edge_state => $edge->{edgeState}, service_state => $edge->{serviceState}, ha_state => $edge->{haState}, diff --git a/centreon-plugins/cloud/vmware/velocloud/restapi/mode/listlinks.pm b/centreon-plugins/cloud/vmware/velocloud/restapi/mode/listlinks.pm index e91099ed9..71a33137b 100644 --- a/centreon-plugins/cloud/vmware/velocloud/restapi/mode/listlinks.pm +++ b/centreon-plugins/cloud/vmware/velocloud/restapi/mode/listlinks.pm @@ -40,6 +40,8 @@ sub new { sub check_options { my ($self, %options) = @_; $self->SUPER::init(%options); + + $self->{timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900; } sub manage_selection { @@ -52,7 +54,7 @@ sub manage_selection { $self->{output}->output_add(long_msg => "skipping '" . $edge->{name} . "'.", debug => 1); next; } - my $links = $options{custom}->list_links(edge_id => $edge->{id}); + my $links = $options{custom}->list_links(edge_id => $edge->{id}, timeframe => $self->{timeframe}); foreach my $link (@{$links}) { push @{$self->{links}}, { %{$link}, edgeName => $edge->{name} }; }