Added safety checks
This commit is contained in:
parent
e9e19053f4
commit
dcd1525c4f
1 changed files with 16 additions and 0 deletions
|
|
@ -236,7 +236,15 @@ class osTicket(): # pylint: disable=invalid-name
|
||||||
"""Set CPU max temp in osTicket for ticket_id."""
|
"""Set CPU max temp in osTicket for ticket_id."""
|
||||||
LOG.info(f'Setting max CPU temp to {temp}')
|
LOG.info(f'Setting max CPU temp to {temp}')
|
||||||
self._connect()
|
self._connect()
|
||||||
|
|
||||||
|
# Bail if disabled
|
||||||
|
if self.disabled:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Update temp
|
||||||
self._set_flag(FLAG_MAX_TEMP, temp)
|
self._set_flag(FLAG_MAX_TEMP, temp)
|
||||||
|
|
||||||
|
# Done
|
||||||
self._disconnect()
|
self._disconnect()
|
||||||
|
|
||||||
def set_flag_failed(self, flag_name):
|
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
|
real_flag_name = FLAG_CPU if flag_name == 'CPU' else FLAG_DISK
|
||||||
self._connect()
|
self._connect()
|
||||||
|
|
||||||
|
# Bail if disabled
|
||||||
|
if self.disabled:
|
||||||
|
return
|
||||||
|
|
||||||
# Set flag
|
# Set flag
|
||||||
self._set_flag(real_flag_name, FLAG_CODES['Fail'])
|
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
|
real_flag_name = FLAG_CPU if flag_name == 'CPU' else FLAG_DISK
|
||||||
self._connect()
|
self._connect()
|
||||||
|
|
||||||
|
# Bail if disabled
|
||||||
|
if self.disabled:
|
||||||
|
return
|
||||||
|
|
||||||
# Bail if flag checkbox set as FAILED
|
# Bail if flag checkbox set as FAILED
|
||||||
if self._get_flag(real_flag_name) == str(FLAG_CODES['Fail']):
|
if self._get_flag(real_flag_name) == str(FLAG_CODES['Fail']):
|
||||||
print_warning(
|
print_warning(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue