Ver Fonte

Add error handling.

Joe Clarke há 1 ano atrás
pai
commit
f4fb27de1a
1 ficheiros alterados com 5 adições e 1 exclusões
  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"] != "":