From 6acc369377feac2750b9c5b4bbc28124117533e1 Mon Sep 17 00:00:00 2001 From: Eike Frost Date: Sun, 28 Feb 2016 20:12:01 +0000 Subject: [PATCH] Check whether interface-list exits before querying its length --- monitoring/zabbix_host.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/monitoring/zabbix_host.py b/monitoring/zabbix_host.py index 5b6748a3e94..267457c4dd6 100644 --- a/monitoring/zabbix_host.py +++ b/monitoring/zabbix_host.py @@ -289,9 +289,11 @@ class Host(object): # check the exist_interfaces whether it equals the interfaces or not def check_interface_properties(self, exist_interface_list, interfaces): interfaces_port_list = [] - if len(interfaces) >= 1: - for interface in interfaces: - interfaces_port_list.append(int(interface['port'])) + + if interfaces is not None: + if len(interfaces) >= 1: + for interface in interfaces: + interfaces_port_list.append(int(interface['port'])) exist_interface_ports = [] if len(exist_interface_list) >= 1: