From 55869b7fc88ffd0fb2a791a307cc767826f0bea4 Mon Sep 17 00:00:00 2001 From: Shini31 Date: Tue, 7 Jun 2016 17:20:22 +0200 Subject: [PATCH] port can be exist without name --- centreon-plugins/cloud/openstack/restapi/mode/port.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/centreon-plugins/cloud/openstack/restapi/mode/port.pm b/centreon-plugins/cloud/openstack/restapi/mode/port.pm index fe5265924..a1c90da35 100644 --- a/centreon-plugins/cloud/openstack/restapi/mode/port.pm +++ b/centreon-plugins/cloud/openstack/restapi/mode/port.pm @@ -136,8 +136,11 @@ sub api_request { eval { $webcontent = $json->decode($jsoncontent); }; - - $self->{port_infos}->{name} = $webcontent->{port}->{name}; + if ($self->{port_infos}->{name} eq '') { + $self->{port_infos}->{name} = "unknown"; + else { + $self->{port_infos}->{name} = $webcontent->{port}->{name}; + } $self->{port_infos}->{admin_state} = $webcontent->{port}->{admin_state_up}; $self->{port_infos}->{status} = $webcontent->{port}->{status}; }