From fa24a5e4f4d9c813f3e6ede7b0c2dbb5d342825c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Thu, 3 Oct 2024 17:49:25 +0200 Subject: [PATCH] Refactor variable names in user_service_status function and ProxmoxClient --- server/src/uds/REST/methods/client.py | 10 +++++----- server/src/uds/core/util/properties.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/server/src/uds/REST/methods/client.py b/server/src/uds/REST/methods/client.py index 9de5b0d97..6764324de 100644 --- a/server/src/uds/REST/methods/client.py +++ b/server/src/uds/REST/methods/client.py @@ -145,7 +145,7 @@ class Client(Handler): 'Res: %s', info ) - password = CryptoManager().symmetric_decrypt(data['password'], scrambler) + password = CryptoManager.manager().symmetric_decrypt(data['password'], scrambler) # userService.setConnectionSource(srcIp, hostname) # Store where we are accessing from so we can notify Service if not info.ip: @@ -193,10 +193,10 @@ class Client(Handler): """ logger.debug('Client args for GET: %s', self._args) - def error() -> None: + def _error() -> None: raise exceptions.rest.RequestError('Invalid request') - def noargs() -> dict[str, typing.Any]: + def _noargs() -> dict[str, typing.Any]: return Client.result( { 'availableVersion': CLIENT_VERSION, # Compat with old clients, TB removed soon... @@ -210,8 +210,8 @@ class Client(Handler): return match( self._args, - error, # In case of error, raises RequestError - ((), noargs), # No args, return version + _error, # In case of error, raises RequestError + ((), _noargs), # No args, return version (('test',), self.test), # Test request, returns "Correct" ( ( diff --git a/server/src/uds/core/util/properties.py b/server/src/uds/core/util/properties.py index a20bce90e..7ba884f22 100644 --- a/server/src/uds/core/util/properties.py +++ b/server/src/uds/core/util/properties.py @@ -70,7 +70,7 @@ class PropertyAccessor: try: p = self._filter().get(key=key) p.value = value - p.save() + p.save(update_fields=['value']) except Properties.DoesNotExist: Properties.objects.create(owner_id=self.owner_id, owner_type=self.owner_type, key=key, value=value)