mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 03:07:56 +00:00
Changed failure output to be consistent throughout script
This commit is contained in:
@@ -40,7 +40,7 @@ for file in searchResults:
|
|||||||
if ver == file[1]:
|
if ver == file[1]:
|
||||||
webFiles.append({'filename':file[0], 'timestamp': datetime.datetime.strptime(file[2], "%Y-%m-%d %H:%M")})
|
webFiles.append({'filename':file[0], 'timestamp': datetime.datetime.strptime(file[2], "%Y-%m-%d %H:%M")})
|
||||||
if len(webFiles) == 0:
|
if len(webFiles) == 0:
|
||||||
print(f"Unable to find webfile with version number {ver}")
|
print(f"Failed to find webfile with version number {ver}")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ for file in dir:
|
|||||||
dirFiles.append({'filename':file[25:], 'timestamp':fileTime})
|
dirFiles.append({'filename':file[25:], 'timestamp':fileTime})
|
||||||
|
|
||||||
if len(dirFiles) == 0:
|
if len(dirFiles) == 0:
|
||||||
print(f"Unable to find file in {filePath} with version {ver}")
|
print(f"Failed to find file in {filePath} with version {ver}")
|
||||||
#sys.exit(1)
|
#sys.exit(1)
|
||||||
|
|
||||||
#============FIND NEWEST FILES============
|
#============FIND NEWEST FILES============
|
||||||
@@ -95,7 +95,7 @@ if newestWebFile['timestamp'] > newestDirFile['timestamp']:
|
|||||||
print("Attempting to extract files")
|
print("Attempting to extract files")
|
||||||
subprocess.call(["tar", "-xf", f"{filePath}{newestWebFile['filename']}", "-C", "/home/lanforge/"])
|
subprocess.call(["tar", "-xf", f"{filePath}{newestWebFile['filename']}", "-C", "/home/lanforge/"])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"{e}\nExtraction Failed. Please try again")
|
print(f"{e}\nExtraction failed. Please try again")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
#time.sleep(90)
|
#time.sleep(90)
|
||||||
@@ -104,8 +104,8 @@ if newestWebFile['timestamp'] > newestDirFile['timestamp']:
|
|||||||
print("Copying LANforge-auto.desktop to /home/lanforge/.config/autostart/")
|
print("Copying LANforge-auto.desktop to /home/lanforge/.config/autostart/")
|
||||||
subprocess.call(["cp", f"/home/lanforge/{newestWebFile['filename'][:len(newestWebFile)-18]}/LANforge-auto.desktop", "/home/lanforge/.config/autostart/"])
|
subprocess.call(["cp", f"/home/lanforge/{newestWebFile['filename'][:len(newestWebFile)-18]}/LANforge-auto.desktop", "/home/lanforge/.config/autostart/"])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(f"{e}\nCopy failed. Please try again")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print(f"Attempting to install {newestWebFile['filename']} at /home/lanforge")
|
print(f"Attempting to install {newestWebFile['filename']} at /home/lanforge")
|
||||||
@@ -118,8 +118,8 @@ if newestWebFile['timestamp'] > newestDirFile['timestamp']:
|
|||||||
print("Killing current GUI process")
|
print("Killing current GUI process")
|
||||||
os.system("pgrep java | xargs kill")
|
os.system("pgrep java | xargs kill")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(f"{e}\nProcess kill failed. Please try again")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("Current GUI version up to date")
|
print("Current GUI version up to date")
|
||||||
|
|||||||
Reference in New Issue
Block a user