From 195127b0b624bb3da1c63faa631d4859d10f3116 Mon Sep 17 00:00:00 2001 From: Logan Lipke Date: Tue, 2 Jun 2020 12:25:43 -0700 Subject: [PATCH] Changed failure output to be consistent throughout script --- auto-install-gui.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/auto-install-gui.py b/auto-install-gui.py index 77a4a1a1..f81f6941 100755 --- a/auto-install-gui.py +++ b/auto-install-gui.py @@ -40,7 +40,7 @@ for file in searchResults: if ver == file[1]: webFiles.append({'filename':file[0], 'timestamp': datetime.datetime.strptime(file[2], "%Y-%m-%d %H:%M")}) 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) @@ -55,7 +55,7 @@ for file in dir: dirFiles.append({'filename':file[25:], 'timestamp':fileTime}) 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) #============FIND NEWEST FILES============ @@ -95,7 +95,7 @@ if newestWebFile['timestamp'] > newestDirFile['timestamp']: print("Attempting to extract files") subprocess.call(["tar", "-xf", f"{filePath}{newestWebFile['filename']}", "-C", "/home/lanforge/"]) except Exception as e: - print(f"{e}\nExtraction Failed. Please try again") + print(f"{e}\nExtraction failed. Please try again") sys.exit(1) #time.sleep(90) @@ -104,8 +104,8 @@ if newestWebFile['timestamp'] > newestDirFile['timestamp']: 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/"]) except Exception as e: - print(e) - + print(f"{e}\nCopy failed. Please try again") + sys.exit(1) try: print(f"Attempting to install {newestWebFile['filename']} at /home/lanforge") @@ -118,8 +118,8 @@ if newestWebFile['timestamp'] > newestDirFile['timestamp']: print("Killing current GUI process") os.system("pgrep java | xargs kill") except Exception as e: - print(e) - + print(f"{e}\nProcess kill failed. Please try again") + sys.exit(1) else: print("Current GUI version up to date")