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:
parent
f211f3482f
commit
7bdb3d77ba
@ -86,6 +86,9 @@ class LogManager(object):
|
|||||||
from uds.models import getSqlDatetime
|
from uds.models import getSqlDatetime
|
||||||
from uds.models import Log
|
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)
|
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
|
# 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():
|
if qs.count() >= GlobalConfig.MAX_LOGS_PER_ELEMENT.getInt():
|
||||||
|
@ -132,7 +132,7 @@ class DeployedServiceRemover(Job):
|
|||||||
# First check if there is someone in "removable" estate
|
# First check if there is someone in "removable" estate
|
||||||
rems = DeployedService.objects.filter(state=State.REMOVABLE)[:10]
|
rems = DeployedService.objects.filter(state=State.REMOVABLE)[:10]
|
||||||
if len(rems) > 0:
|
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:
|
for ds in rems:
|
||||||
try:
|
try:
|
||||||
# Skips checking deployed services in maintenance mode
|
# Skips checking deployed services in maintenance mode
|
||||||
@ -145,10 +145,9 @@ class DeployedServiceRemover(Job):
|
|||||||
except Exception as e2:
|
except Exception as e2:
|
||||||
logger.error('Could not delete {}'.format(e2))
|
logger.error('Could not delete {}'.format(e2))
|
||||||
|
|
||||||
|
|
||||||
rems = DeployedService.objects.filter(state=State.REMOVING)[:10]
|
rems = DeployedService.objects.filter(state=State.REMOVING)[:10]
|
||||||
if len(rems) > 0:
|
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:
|
for ds in rems:
|
||||||
try:
|
try:
|
||||||
# Skips checking deployed services in maintenance mode
|
# Skips checking deployed services in maintenance mode
|
||||||
|
@ -39,8 +39,7 @@ from uds.models.UUIDModel import UUIDModel
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
__updated__ = '2016-03-09'
|
__updated__ = '2018-06-12'
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -97,7 +96,7 @@ class ManagedObjectModel(UUIDModel):
|
|||||||
Can be overriden
|
Can be overriden
|
||||||
'''
|
'''
|
||||||
if self._cachedInstance is not None and values is None:
|
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
|
return self._cachedInstance
|
||||||
|
|
||||||
klass = self.getType()
|
klass = self.getType()
|
||||||
|
@ -47,9 +47,7 @@ from uds.models.Provider import Provider
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
__updated__ = '2018-06-12'
|
||||||
__updated__ = '2016-03-09'
|
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -104,8 +102,9 @@ class Service(ManagedObjectModel, TaggingMixin):
|
|||||||
Raises:
|
Raises:
|
||||||
'''
|
'''
|
||||||
if self._cachedInstance is not None and values is None:
|
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
|
return self._cachedInstance
|
||||||
|
# logger.debug('No cached instance for {}, getting from DB'.format(self.name))
|
||||||
|
|
||||||
prov = self.provider.getInstance()
|
prov = self.provider.getInstance()
|
||||||
sType = prov.getServiceByType(self.data_type)
|
sType = prov.getServiceByType(self.data_type)
|
||||||
@ -162,5 +161,6 @@ class Service(ManagedObjectModel, TaggingMixin):
|
|||||||
# Clears related permissions
|
# Clears related permissions
|
||||||
clean(toDelete)
|
clean(toDelete)
|
||||||
|
|
||||||
|
|
||||||
# : Connects a pre deletion signal to Service
|
# : Connects a pre deletion signal to Service
|
||||||
signals.pre_delete.connect(Service.beforeDelete, sender=Service)
|
signals.pre_delete.connect(Service.beforeDelete, sender=Service)
|
||||||
|
Loading…
Reference in New Issue
Block a user