From 4c3fe1d66fb91effc942ab822e21d3396d564e4d Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Wed, 13 Mar 2019 22:26:42 -0600 Subject: [PATCH] Avoid crash if connection to osTicket fails --- .bin/Scripts/functions/hw_diags.py | 6 +++++- .bin/Scripts/hw-diags-menu | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.bin/Scripts/functions/hw_diags.py b/.bin/Scripts/functions/hw_diags.py index 9cfe13d7..cd7c4303 100644 --- a/.bin/Scripts/functions/hw_diags.py +++ b/.bin/Scripts/functions/hw_diags.py @@ -1002,7 +1002,11 @@ def run_hw_tests(state): # Get ticket ID and name if not state.ost.disabled: - state.ticket_id, state.ticket_name = state.ost.get_ticket_details() + try: + state.ticket_id, state.ticket_name = state.ost.get_ticket_details() + except TypeError: + # Happens if connection fails and retry is not attempted + pass # Run disk safety checks (if necessary) _disk_tests_enabled = False diff --git a/.bin/Scripts/hw-diags-menu b/.bin/Scripts/hw-diags-menu index fa7f0cd8..58bf5280 100755 --- a/.bin/Scripts/hw-diags-menu +++ b/.bin/Scripts/hw-diags-menu @@ -50,7 +50,7 @@ if __name__ == '__main__': global_vars=global_vars) # Done - sleep(10) + sleep(1) pause('Press Enter to exit...') exit_script(1)