From dcd1525c4f92195554114378dd52f47064d9cce1 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Fri, 10 Jan 2020 17:04:13 -0700 Subject: [PATCH] Added safety checks --- scripts/wk/osticket.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/wk/osticket.py b/scripts/wk/osticket.py index a969937d..7b700dd9 100644 --- a/scripts/wk/osticket.py +++ b/scripts/wk/osticket.py @@ -236,7 +236,15 @@ class osTicket(): # pylint: disable=invalid-name """Set CPU max temp in osTicket for ticket_id.""" LOG.info(f'Setting max CPU temp to {temp}') self._connect() + + # Bail if disabled + if self.disabled: + return + + # Update temp self._set_flag(FLAG_MAX_TEMP, temp) + + # Done self._disconnect() def set_flag_failed(self, flag_name): @@ -245,6 +253,10 @@ class osTicket(): # pylint: disable=invalid-name real_flag_name = FLAG_CPU if flag_name == 'CPU' else FLAG_DISK self._connect() + # Bail if disabled + if self.disabled: + return + # Set flag self._set_flag(real_flag_name, FLAG_CODES['Fail']) @@ -259,6 +271,10 @@ class osTicket(): # pylint: disable=invalid-name real_flag_name = FLAG_CPU if flag_name == 'CPU' else FLAG_DISK self._connect() + # Bail if disabled + if self.disabled: + return + # Bail if flag checkbox set as FAILED if self._get_flag(real_flag_name) == str(FLAG_CODES['Fail']): print_warning(