src: use logging.warning()

logging.warn() is deprecated since 3.3.

And use .error() instead when command is unsupported or client is busy, that
should not ever happen.
master
OpenGnSys Support Team 2024-08-27 12:40:02 +02:00
parent 4b62b80be7
commit 3d47b5069a
3 changed files with 8 additions and 11 deletions

View File

@ -235,7 +235,7 @@ class OgLiveOperations:
if os.access(f'/opt/opengnsys/images', os.R_OK) == False:
raise OgError('Cannot access /opt/opengnsys/images in read mode, check permissions')
logging.warn(f'Checksum validation is *NOT* available with UNICAST-DIRECT!')
logging.warning(f'Checksum validation is *NOT* available with UNICAST-DIRECT!')
image_path = f'/opt/opengnsys/images/{name}.img'
self._restore_image(image_path, devpath)
@ -348,7 +348,7 @@ class OgLiveOperations:
raise OgError(f'Error when running "shell run" subprocess: {e}') from e
if ogRest.proc.returncode != 0:
logging.warn('Non zero exit code when running: %s', ' '.join(cmds))
logging.warning('Non zero exit code when running: %s', ' '.join(cmds))
else:
logging.info('Shell run command OK')

View File

@ -62,7 +62,7 @@ class restResponse():
if response in {ogResponses.OK, ogResponses.IN_PROGRESS}:
logging.debug(self.msg[:ogRest.LOG_LENGTH])
else:
logging.warn(self.msg[:ogRest.LOG_LENGTH])
logging.warning(self.msg[:ogRest.LOG_LENGTH])
self.msg += '\r\n'
@ -312,8 +312,7 @@ class ogRest():
not "poweroff" in URI and
not "probe" in URI):
if self.state == ThreadState.BUSY:
logging.warn('Request has been received '
'while ogClient is busy')
logging.error('Request has been received while ogClient is busy')
response = restResponse(ogResponses.SERVICE_UNAVAILABLE, seq=client.seq)
client.send(response.get())
return
@ -330,8 +329,7 @@ class ogRest():
elif "refresh" in URI:
self.process_refresh(client)
else:
logging.warn('Unsupported request: %s',
{URI[:ogRest.LOG_LENGTH]})
logging.error('Unsupported request: %s', {URI[:ogRest.LOG_LENGTH]})
response = restResponse(ogResponses.BAD_REQUEST, seq=client.seq)
client.send(response.get())
self.state = ThreadState.IDLE
@ -359,8 +357,7 @@ class ogRest():
elif ("cache/fetch" in URI):
self.process_cache_fetch(client, request)
else:
logging.warn('Unsupported request: %s',
URI[:ogRest.LOG_LENGTH])
logging.error('Unsupported request: %s', URI[:ogRest.LOG_LENGTH])
response = restResponse(ogResponses.BAD_REQUEST, seq=client.seq)
client.send(response.get())
self.state = ThreadState.IDLE

View File

@ -94,8 +94,8 @@ def tip_check_csum(tip_addr, image_name):
logging.info(f'Checksum is OK for {image_name}.img')
else:
ret = False
logging.warn(f'Checksum mismatch for {image_name}.img')
logging.warn(f'Server reports checksum {remote_csum} but local checksum is {cache_csum}')
logging.warning(f'Checksum mismatch for {image_name}.img')
logging.warning(f'Server reports checksum {remote_csum} but local checksum is {cache_csum}')
return ret