fix(velocloud): list modes errors (#2930)

This commit is contained in:
qgarnier 2021-07-02 11:07:57 +02:00 committed by GitHub
parent fba08ac127
commit cbbdd179cb
2 changed files with 17 additions and 6 deletions

View File

@ -51,10 +51,19 @@ sub run {
$self->manage_selection(%options); $self->manage_selection(%options);
foreach my $edge (@{$self->{edges}}) { foreach my $edge (@{$self->{edges}}) {
$self->{output}->output_add(long_msg => sprintf("[id = %s][name = %s][description = %s][edge_state = %s]" . $self->{output}->output_add(
"[service_state = %s][ha_state = %s][activation_state = %s]", long_msg => sprintf(
$edge->{id}, $edge->{name}, $edge->{description}, $edge->{edgeState}, $edge->{serviceState}, "[id = %s][name = %s][description = %s][edge_state = %s]" .
$edge->{haState}, $edge->{activationState})); "[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( $self->{output}->output_add(
@ -84,7 +93,7 @@ sub disco_show {
$self->{output}->add_disco_entry( $self->{output}->add_disco_entry(
id => $edge->{id}, id => $edge->{id},
name => $edge->{name}, name => $edge->{name},
description => $edge->{description}, description => defined($edge->{description}) ? $edge->{description} : '',
edge_state => $edge->{edgeState}, edge_state => $edge->{edgeState},
service_state => $edge->{serviceState}, service_state => $edge->{serviceState},
ha_state => $edge->{haState}, ha_state => $edge->{haState},

View File

@ -40,6 +40,8 @@ sub new {
sub check_options { sub check_options {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->SUPER::init(%options); $self->SUPER::init(%options);
$self->{timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
} }
sub manage_selection { sub manage_selection {
@ -52,7 +54,7 @@ sub manage_selection {
$self->{output}->output_add(long_msg => "skipping '" . $edge->{name} . "'.", debug => 1); $self->{output}->output_add(long_msg => "skipping '" . $edge->{name} . "'.", debug => 1);
next; 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}) { foreach my $link (@{$links}) {
push @{$self->{links}}, { %{$link}, edgeName => $edge->{name} }; push @{$self->{links}}, { %{$link}, edgeName => $edge->{name} };
} }