diff --git a/manager/tasks.py b/manager/tasks.py index a644a8e..1e40d2a 100644 --- a/manager/tasks.py +++ b/manager/tasks.py @@ -12,6 +12,7 @@ import crypt import subprocess import datetime + @shared_task def mkfirmware(device, path): BEFORE = os.getcwd() @@ -77,13 +78,17 @@ def mkfirmware(device, path): os.chdir(BEFORE) - os.rename(glob.glob(SRCDIR + "/bin/targets/ar71xx/generic/*squashfs-sysupgrade.bin")[0], "%s/%s.bin" % (path, device.id)) + genfile = glob.glob( + SRCDIR + "/bin/targets/ar71xx/generic/*squashfs-sysupgrade.bin" + )[0] + + os.rename(genfile, "%s/%s.bin" % (path, device.id)) try: os.remove(SRCDIR + "/.kumilock") - except: + except FileNotFoundError: pass - + os.system("rm -rf " + SRCDIR + "/files/") os.system("rm " + SRCDIR + "/bin/targets/ar71xx/generic/*") return True @@ -92,4 +97,3 @@ def mkfirmware(device, path): os.remove(SRCDIR + "/.kumilock") os.chdir(BEFORE) return False -