From cdaffded891f659ca72102eb536c1700ef02dde6 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Wed, 4 Dec 2019 15:41:50 +0100 Subject: [PATCH] enhance cisco apic error handle --- network/cisco/aci/apic/restapi/custom/api.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network/cisco/aci/apic/restapi/custom/api.pm b/network/cisco/aci/apic/restapi/custom/api.pm index 71ec20ba6..56681bbdd 100644 --- a/network/cisco/aci/apic/restapi/custom/api.pm +++ b/network/cisco/aci/apic/restapi/custom/api.pm @@ -214,7 +214,7 @@ sub request_api { $self->{output}->add_option_msg(short_msg => "Cannot decode json response: $@"); $self->{output}->option_exit(); } - if (defined($decoded->{imdata}->[0]->{error}->{attributes})) { + if (defined($decoded->{imdata}->[0]) && defined($decoded->{imdata}->[0]->{error}->{attributes})) { $self->{output}->add_option_msg(short_msg => "Error '" . uc($decoded->{imdata}->[0]->{error}->{attributes}->{code}) . " " . $decoded->{imdata}->[0]->{error}->{attributes}->{text} . "'"); $self->{output}->option_exit(); }