Skip to content

Commit

Permalink
Removing Netbox v3 client
Browse files Browse the repository at this point in the history
  • Loading branch information
johannwagner committed Nov 19, 2024
1 parent c9845c1 commit 2bbb558
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 170 deletions.
3 changes: 1 addition & 2 deletions cosmo/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
import argparse

from cosmo.clients.netbox import NetboxClient
from cosmo.log import info
from cosmo.serializer import RouterSerializer, SwitchSerializer, AbstractRecoverableError, RouterSerializerConfig


def info(string: str) -> None:
print("[INFO] " + string)


def main() -> int:
Expand Down
11 changes: 4 additions & 7 deletions cosmo/clients/netbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import requests

from cosmo.clients.netbox_v3 import NetboxV3Strategy
from cosmo import log
from cosmo.clients.netbox_v4 import NetboxV4Strategy


Expand All @@ -13,11 +13,8 @@ def __init__(self, url, token):

self.version = self.query_version()

if self.version.startswith("wc_3."):
print("[INFO] Using version 3.x strategy...")
self.child_client = NetboxV3Strategy(url, token)
elif self.version.startswith("4."):
print("[INFO] Using version 4.x strategy...")
if self.version.startswith("4."):
log.info("Using version 4.x strategy...")
self.child_client = NetboxV4Strategy(url, token)
else:
raise Exception("Unknown Version")
Expand All @@ -42,7 +39,7 @@ def get_data(self, device_config):
data = self.child_client.get_data(device_config)
end_time = time.perf_counter()
diff_time = end_time - start_time
print(f"[INFO] Data fetching took {round(diff_time, 2)} s...")
log.info(f"Data fetching took {round(diff_time, 2)} s...")

return data

Expand Down
161 changes: 0 additions & 161 deletions cosmo/clients/netbox_v3.py

This file was deleted.

2 changes: 2 additions & 0 deletions cosmo/log.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def info(string: str) -> None:
print("[INFO] " + string)

0 comments on commit 2bbb558

Please sign in to comment.