Skip to content

Commit

Permalink
Add more info to failed device_type creations (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
p-rintz authored Mar 9, 2023
1 parent 542a56a commit e1e2d78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion netbox_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ def create_device_types(self, device_types_to_add):
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)
Expand Down
2 changes: 1 addition & 1 deletion repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def get_devices(self, base_path, vendors: list = None):
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:
Expand Down

0 comments on commit e1e2d78

Please sign in to comment.