Avoid replacing higher temps in osTicket
This commit is contained in:
parent
9c12dacfb2
commit
e301bff2c2
1 changed files with 12 additions and 1 deletions
|
|
@ -303,7 +303,10 @@ class osTicket(): # pylint: disable=invalid-name
|
|||
self._disconnect()
|
||||
|
||||
def set_cpu_max_temp(self, temp):
|
||||
"""Set CPU max temp in osTicket for ticket_id."""
|
||||
"""Set CPU max temp in osTicket for ticket_id.
|
||||
|
||||
NOTE: This will not replace a higher temp value.
|
||||
"""
|
||||
LOG.info('Setting max CPU temp to %s', temp)
|
||||
self._connect()
|
||||
|
||||
|
|
@ -311,6 +314,13 @@ class osTicket(): # pylint: disable=invalid-name
|
|||
if self.disabled:
|
||||
return
|
||||
|
||||
# Compare to current temp
|
||||
current_temp = self._get_flag(FLAG_MAX_TEMP)
|
||||
if str(current_temp).isnumeric() and int(current_temp) > temp:
|
||||
std.print_warning('Not replacing higher temp in osTicket')
|
||||
self._disconnect()
|
||||
return
|
||||
|
||||
# Update temp
|
||||
self._set_flag(FLAG_MAX_TEMP, temp)
|
||||
|
||||
|
|
@ -350,6 +360,7 @@ class osTicket(): # pylint: disable=invalid-name
|
|||
std.print_warning(
|
||||
f'Not replacing osTicket {flag_name} checkbox FAILED value',
|
||||
)
|
||||
self._disconnect()
|
||||
return
|
||||
|
||||
# Current value != to FAILED, updating checkbox
|
||||
|
|
|
|||
Loading…
Reference in a new issue