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:
@ -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)
|
||||
|
Reference in New Issue
Block a user