Fixed log recovery for user services

Fixed taskManager stop & start identify
This commit is contained in:
Adolfo Gómez García 2019-10-14 09:07:02 +02:00
parent a393e0b5a3
commit 3f88884a82
2 changed files with 7 additions and 5 deletions

View File

@ -84,7 +84,7 @@ class LogManager:
from uds.models import Log
# Ensure message fits on space
message = message[:255]
message = str(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
@ -148,7 +148,7 @@ class LogManager:
owner_type = transDict.get(type(wichObject), None)
logger.debug('Getting log: %s -> %s', wichObject, owner_type)
if owner_type:
if owner_type is not None: # 0 is valid owner type
return self.__getLogs(owner_type, wichObject.id, limit)
logger.debug('Requested getLogs for a type of object not covered: %s', wichObject)

View File

@ -103,13 +103,15 @@ class Command(BaseCommand):
help='Stop any running daemon'
)
def handle(self, *args, **options):
def handle(self, *args, **options) -> None:
logger.info("Running task manager command")
GlobalConfig.initialize()
start = 'start' in options
stop = 'stop' in options
start = options.get('start', False)
stop = options.get('stop', False)
logger.debug('Start: %s, Stop: %s', start, stop)
pid: int = 0
try: