diff --git a/scripts/wk/osticket.py b/scripts/wk/osticket.py index 1b9eca34..31cac7bb 100644 --- a/scripts/wk/osticket.py +++ b/scripts/wk/osticket.py @@ -52,26 +52,19 @@ class osTicket(): # pylint: disable=invalid-name return # Connect to database - for i in range(3): - i += 1 - try: - self.db_connection = mariadb.connect( - host=SQL['Host'], - port=SQL['Port'], - database=SQL['DB'], - user=SQL['User'], - password=SQL['Pass'], - ) - self.db_cursor = self.db_connection.cursor() - except mariadb.errors.InterfaceError: - # Network issue? try again - std.sleep(2) - except mariadb.errors.Error: - # Bad creds or other SQL error, bail - break - else: - # Connection established - break + try: + self.db_connection = mariadb.connect( + host=SQL['Host'], + port=SQL['Port'], + database=SQL['DB'], + user=SQL['User'], + password=SQL['Pass'], + connection_timeout=5, + ) + self.db_cursor = self.db_connection.cursor() + except mariadb.errors.Error: + # Assuming network issue or bad creds + pass # Raise exception if necessary if self.db_cursor is None: