Browse Source

Add error handling.

Joe Clarke 1 year ago
parent
commit
f4fb27de1a
1 changed files with 5 additions and 1 deletions
  1. 5 1
      automation/netbox/add-vlans.py

+ 5 - 1
automation/netbox/add-vlans.py

@@ -59,7 +59,11 @@ def main():
 
     enb = ElementalNetbox(None, None, ignore_tls=True)
 
-    vlans = get_vlan_list(args.file)
+    try:
+        vlans = get_vlan_list(args.file)
+    except Exception as e:
+        print(f"Failed to load VLAN list: {e}.")
+        exit(1)
 
     for vlan in vlans:
         if vlan["site"] != "":