From e1e2d780bc65edadaea54b6f304609e1a339c596 Mon Sep 17 00:00:00 2001 From: Philipp Rintz <13933258+p-rintz@users.noreply.github.com> Date: Thu, 9 Mar 2023 16:01:42 +0100 Subject: [PATCH] Add more info to failed device_type creations (#81) --- netbox_api.py | 4 +++- repo.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/netbox_api.py b/netbox_api.py index 505d3ce..09d048c 100644 --- a/netbox_api.py +++ b/netbox_api.py @@ -89,7 +89,9 @@ class NetBox: self.handle.verbose_log(f'Device Type Created: {dt.manufacturer.name} - ' + f'{dt.model} - {dt.id}') except pynetbox.RequestError as e: - self.handle.log(e.error) + self.handle.log(f'Error {e.error} creating device type:' + f' {device_type["manufacturer"]["name"]} {device_type["model"]}') + continue if "interfaces" in device_type: self.device_types.create_interfaces(device_type["interfaces"], dt.id) diff --git a/repo.py b/repo.py index d2faab7..65cda96 100644 --- a/repo.py +++ b/repo.py @@ -75,7 +75,7 @@ class DTLRepo: vendor_dirs = os.listdir(base_path) for folder in [vendor for vendor in vendor_dirs if not vendors or vendor.casefold() in vendors]: - if folder.casefold() is not "testing": + if folder.casefold() != "testing": discovered_vendors.append({'name': folder, 'slug': self.slug_format(folder)}) for extension in self.yaml_extensions: