Explorar el Código

Add error handling.

Joe Clarke hace 1 año
padre
commit
f4fb27de1a
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  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"] != "":