From a5419ecc5c141c52125ebbd00b2e04b59cbcd31d Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 21 Mar 2017 17:24:16 -0400 Subject: [PATCH] RPC API fixes --- netbox/extras/rpc.py | 7 +++++-- netbox/templates/dcim/device_lldp_neighbors.html | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/netbox/extras/rpc.py b/netbox/extras/rpc.py index ae651b162..208ec20dd 100644 --- a/netbox/extras/rpc.py +++ b/netbox/extras/rpc.py @@ -130,8 +130,11 @@ class JunosNC(RPCClient): for neighbor_raw in lldp_neighbors_raw: neighbor = dict() neighbor['local-interface'] = neighbor_raw.get('lldp-local-port-id') - neighbor['name'] = neighbor_raw.get('lldp-remote-system-name') - neighbor['name'] = neighbor['name'].split('.')[0] # Split hostname from domain if one is present + name = neighbor_raw.get('lldp-remote-system-name') + if name: + neighbor['name'] = name.split('.')[0] # Split hostname from domain if one is present + else: + neighbor['name'] = '' try: neighbor['remote-interface'] = neighbor_raw['lldp-remote-port-description'] except KeyError: diff --git a/netbox/templates/dcim/device_lldp_neighbors.html b/netbox/templates/dcim/device_lldp_neighbors.html index 6a5446c3b..2b95b0035 100644 --- a/netbox/templates/dcim/device_lldp_neighbors.html +++ b/netbox/templates/dcim/device_lldp_neighbors.html @@ -47,7 +47,7 @@