1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-03 01:17:56 +03:00

Fixed LogManager so now "cuts" correctly before writing log text

Removed debug that was "anoying
This commit is contained in:
Adolfo Gómez García 2018-06-12 13:25:54 +02:00
parent f211f3482f
commit 7bdb3d77ba
4 changed files with 11 additions and 10 deletions

View File

@ -86,6 +86,9 @@ class LogManager(object):
from uds.models import getSqlDatetime
from uds.models import Log
# Ensure message fits on space
message = message[:255]
qs = Log.objects.filter(owner_id=owner_id, owner_type=owner_type)
# First, ensure we do not have more than requested logs, and we can put one more log item
if qs.count() >= GlobalConfig.MAX_LOGS_PER_ELEMENT.getInt():

View File

@ -132,7 +132,7 @@ class DeployedServiceRemover(Job):
# First check if there is someone in "removable" estate
rems = DeployedService.objects.filter(state=State.REMOVABLE)[:10]
if len(rems) > 0:
logger.debug('Found a deployed service marked for removal. Starting removal of {0}'.format(rems))
# logger.debug('Found a deployed service marked for removal. Starting removal of {0}'.format(rems))
for ds in rems:
try:
# Skips checking deployed services in maintenance mode
@ -145,10 +145,9 @@ class DeployedServiceRemover(Job):
except Exception as e2:
logger.error('Could not delete {}'.format(e2))
rems = DeployedService.objects.filter(state=State.REMOVING)[:10]
if len(rems) > 0:
logger.debug('Found a deployed service in removing state, continuing removal of {0}'.format(rems))
# logger.debug('Found a deployed service in removing state, continuing removal of {0}'.format(rems))
for ds in rems:
try:
# Skips checking deployed services in maintenance mode

View File

@ -39,8 +39,7 @@ from uds.models.UUIDModel import UUIDModel
import logging
__updated__ = '2016-03-09'
__updated__ = '2018-06-12'
logger = logging.getLogger(__name__)
@ -97,7 +96,7 @@ class ManagedObjectModel(UUIDModel):
Can be overriden
'''
if self._cachedInstance is not None and values is None:
logger.debug('Got cached instance instead of deserializing a new one for {}'.format(self.name))
# logger.debug('Got cached instance instead of deserializing a new one for {}'.format(self.name))
return self._cachedInstance
klass = self.getType()

View File

@ -47,9 +47,7 @@ from uds.models.Provider import Provider
import logging
__updated__ = '2016-03-09'
__updated__ = '2018-06-12'
logger = logging.getLogger(__name__)
@ -104,8 +102,9 @@ class Service(ManagedObjectModel, TaggingMixin):
Raises:
'''
if self._cachedInstance is not None and values is None:
logger.debug('Got cached instance instead of deserializing a new one for {}'.format(self.name))
# logger.debug('Got cached instance instead of deserializing a new one for {}'.format(self.name))
return self._cachedInstance
# logger.debug('No cached instance for {}, getting from DB'.format(self.name))
prov = self.provider.getInstance()
sType = prov.getServiceByType(self.data_type)
@ -162,5 +161,6 @@ class Service(ManagedObjectModel, TaggingMixin):
# Clears related permissions
clean(toDelete)
# : Connects a pre deletion signal to Service
signals.pre_delete.connect(Service.beforeDelete, sender=Service)