فهرست منبع

More 2023 updates.

Joe Clarke 1 سال پیش
والد
کامیت
74950e3ae5
1فایلهای تغییر یافته به همراه3 افزوده شده و 4 حذف شده
  1. 3 4
      automation/network/nat_limit_watch.py

+ 3 - 4
automation/network/nat_limit_watch.py

@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
 #
 # Copyright (c) 2017-2020  Joe Clarke <jclarke@cisco.com>
 # All rights reserved.
@@ -65,9 +65,8 @@ if __name__ == "__main__":
     spark = Sparker(token=CLEUCreds.SPARK_TOKEN)
 
     if os.path.exists(CACHE_FILE):
-        fd = open(CACHE_FILE, "r")
-        prev_state = json.load(fd)
-        fd.close()
+        with open(CACHE_FILE, "r") as fd:
+            prev_state = json.load(fd)
 
     ssh_client = paramiko.SSHClient()
     ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())