1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Add exception wrapper

This commit is contained in:
Jeremy Stretch
2016-03-22 15:14:03 -04:00
parent 8d99502916
commit 69726ac443

View File

@ -65,12 +65,15 @@ class FreeRADIUSClientsRenderer(renderers.BaseRenderer):
def render(self, data, media_type=None, renderer_context=None):
clients = []
for secret in data:
if secret['device']['primary_ip'] and secret['plaintext']:
client = self.CLIENT_TEMPLATE.format(
name=secret['device']['name'],
ip=secret['device']['primary_ip']['address'].split('/')[0],
secret=secret['plaintext']
)
clients.append(client)
try:
for secret in data:
if secret['device']['primary_ip'] and secret['plaintext']:
client = self.CLIENT_TEMPLATE.format(
name=secret['device']['name'],
ip=secret['device']['primary_ip']['address'].split('/')[0],
secret=secret['plaintext']
)
clients.append(client)
except:
pass
return '\n'.join(clients)