From 1c3ea69d9e74fad99c3b009a614b5359e949dbcc Mon Sep 17 00:00:00 2001 From: Thomas Davis Date: Tue, 27 Aug 2019 10:30:04 -0700 Subject: [PATCH] Several minor fixes raid_arry check should return an empty array, not NoneType not all systems will have IPv6 defined, so try to get the information.. if not just continue on. Vendor Supermicro was incomplete. --- netbox_agent/inventory.py | 2 +- netbox_agent/network.py | 6 +++++- netbox_agent/vendors/supermicro.py | 8 +++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/netbox_agent/inventory.py b/netbox_agent/inventory.py index 06aee92..035a84b 100644 --- a/netbox_agent/inventory.py +++ b/netbox_agent/inventory.py @@ -102,7 +102,7 @@ class Inventory(): self.raid = HPRaid() if not self.raid: - return + return [] controllers = self.raid.get_controllers() if len(self.raid.get_controllers()): diff --git a/netbox_agent/network.py b/netbox_agent/network.py index 78f7090..786c642 100644 --- a/netbox_agent/network.py +++ b/netbox_agent/network.py @@ -60,7 +60,11 @@ class Network(): continue ip_addr = netifaces.ifaddresses(interface).get(netifaces.AF_INET) - ip_addr += netifaces.ifaddresses(interface).get(netifaces.AF_INET6) + try: + ip_addr += netifaces.ifaddresses(interface).get(netifaces.AF_INET6) + except: + logging.debug('No IPv6 addresses defined.') + if NETWORK_IGNORE_IPS and ip_addr: for i, ip in enumerate(ip_addr): if re.match(NETWORK_IGNORE_IPS, ip['addr']): diff --git a/netbox_agent/vendors/supermicro.py b/netbox_agent/vendors/supermicro.py index 115ab4a..5fcc9bf 100644 --- a/netbox_agent/vendors/supermicro.py +++ b/netbox_agent/vendors/supermicro.py @@ -2,8 +2,14 @@ from netbox_agent.server import ServerBase class SupermicroHost(ServerBase): + def __init__(self, *args, **kwargs): + super(SupermicroHost, self).__init__(*args, **kwargs) + self.manufacturer = 'Supermicro' + def is_blade(self): - return self.get_product_name().startswith('SBI') + blade = self.get_product_name().startswith('SBI') + blade |= self.get_product_name().startswith('SYS') + return blade def get_blade_slot(self): # No supermicro on hands