From 2ec64a2ea25848e1c4770a65c99920da599553d3 Mon Sep 17 00:00:00 2001 From: rizlas Date: Tue, 14 Dec 2021 10:17:00 +0100 Subject: [PATCH 1/2] Get_Environment from napalm should not need any decoding --- netbox/dcim/api/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/dcim/api/views.py b/netbox/dcim/api/views.py index f359f0f24..74f06c64f 100644 --- a/netbox/dcim/api/views.py +++ b/netbox/dcim/api/views.py @@ -501,7 +501,7 @@ class DeviceViewSet(ConfigContextQuerySetMixin, CustomFieldModelViewSet): response[method] = {'error': 'Only get_* NAPALM methods are supported'} continue try: - response[method] = decode_dict(getattr(d, method)()) + response[method] = decode_dict(getattr(d, method)(), decode_keys=False) except NotImplementedError: response[method] = {'error': 'Method {} not implemented for NAPALM driver {}'.format(method, driver)} except Exception as e: From 39a0b15df4b93d6c3b6b19cc02752bc19cc173fa Mon Sep 17 00:00:00 2001 From: rizlas Date: Tue, 21 Dec 2021 17:15:54 +0100 Subject: [PATCH 2/2] Update netbox/dcim/api/views.py Test without decode_dict function Co-authored-by: Jeremy Stretch --- netbox/dcim/api/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/dcim/api/views.py b/netbox/dcim/api/views.py index 74f06c64f..03e7e51cc 100644 --- a/netbox/dcim/api/views.py +++ b/netbox/dcim/api/views.py @@ -501,7 +501,7 @@ class DeviceViewSet(ConfigContextQuerySetMixin, CustomFieldModelViewSet): response[method] = {'error': 'Only get_* NAPALM methods are supported'} continue try: - response[method] = decode_dict(getattr(d, method)(), decode_keys=False) + response[method] = getattr(d, method)() except NotImplementedError: response[method] = {'error': 'Method {} not implemented for NAPALM driver {}'.format(method, driver)} except Exception as e: