Skip to content
Snippets Groups Projects
Commit 8c8e4ce4 authored by Neda Moeini's avatar Neda Moeini
Browse files

Rolled back exception handling.

parent f5cb3dda
Branches
Tags
No related merge requests found
Pipeline #84160 passed
......@@ -3,7 +3,6 @@ from uuid import UUID
import pydantic
import pynetbox
from pynetbox import RequestError
from pynetbox.models.dcim import Devices, DeviceTypes, Interfaces
from gso.products import Router
......@@ -51,14 +50,8 @@ class NetBoxClient:
def __init__(self) -> None:
self.netbox_params = load_oss_params().NETBOX
self.netbox = self._connect()
def _connect(self):
try:
return pynetbox.api(self.netbox_params.api, self.netbox_params.token)
except RequestError as e:
raise Exception('NetBox API Error', e)
self.netbox = pynetbox.api(self.netbox_params.api, self.netbox_params.token)
def get_all_devices(self) -> list[Devices]:
return list(self.netbox.dcim.devices.all())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment