From 789084d3ed80c09116c9d3c04175a41008142fc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Thu, 18 Jan 2018 10:46:05 +0100 Subject: [PATCH] py3 --- server/src/uds/core/ui/UserInterface.py | 2 +- server/src/uds/models/UserService.py | 7 ++++--- server/src/uds/services/Xen/XenPublication.py | 6 ++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/server/src/uds/core/ui/UserInterface.py b/server/src/uds/core/ui/UserInterface.py index 9ac5be1b..9158ab4f 100644 --- a/server/src/uds/core/ui/UserInterface.py +++ b/server/src/uds/core/ui/UserInterface.py @@ -958,7 +958,7 @@ class UserInterface(object): self._gui[k].value = val # logger.debug('Value for {0}:{1}'.format(k, val)) except Exception: - logger.exception('Exception on unserialization') + logger.exception('Exception on unserialization on {}'.format(self.__class__)) # Values can contain invalid characters, so we log every single char # logger.info('Invalid serialization data on {0} {1}'.format(self, values.encode('hex'))) diff --git a/server/src/uds/models/UserService.py b/server/src/uds/models/UserService.py index 5b2b09e1..9414b64f 100644 --- a/server/src/uds/models/UserService.py +++ b/server/src/uds/models/UserService.py @@ -55,7 +55,7 @@ from uds.models.Util import getSqlDatetime import logging -__updated__ = '2017-11-29' +__updated__ = '2018-01-18' logger = logging.getLogger(__name__) @@ -170,7 +170,8 @@ class UserService(UUIDModel): except Exception as e: # The publication to witch this item points to, does not exists self.publication = None - logger.error("Got exception at getInstance of an userService {0} : {1}".format(e.__class__, e)) + logger.exception("Got exception at getInstance of an userService {}".format(self)) + logger.error() if serviceInstance.deployedType is None: raise Exception('Class {0} needs deployedType but it is not defined!!!'.format(serviceInstance.__class__.__name__)) us = serviceInstance.deployedType(self.getEnvironment(), service=serviceInstance, publication=publicationInstance, osmanager=osmanagerInstance, dbservice=self) @@ -386,7 +387,6 @@ class UserService(UUIDModel): self.deployed_service.account.stopUsageAccounting(self) - def isUsable(self): ''' Returns if this service is usable @@ -534,5 +534,6 @@ class UserService(UUIDModel): logger.debug('Deleted user service {0}'.format(toDelete)) + # Connects a pre deletion signal to Authenticator signals.pre_delete.connect(UserService.beforeDelete, sender=UserService) diff --git a/server/src/uds/services/Xen/XenPublication.py b/server/src/uds/services/Xen/XenPublication.py index d87abdb0..7015fdca 100644 --- a/server/src/uds/services/Xen/XenPublication.py +++ b/server/src/uds/services/Xen/XenPublication.py @@ -51,7 +51,6 @@ class XenPublication(Publication): _state = '' _task = '' - suggestedTime = 20 # : Suggested recheck time if publication is unfinished in seconds def initialize(self): @@ -75,14 +74,14 @@ class XenPublication(Publication): """ returns data from an instance of Sample Publication serialized """ - return '\t'.join(['v1', self._name, self._reason, self._destroyAfter, self._templateId, self._state, self._task]) + return '\t'.join(['v1', self._name, self._reason, self._destroyAfter, self._templateId, self._state, self._task]).encode('utf8') def unmarshal(self, data): """ deserializes the data and loads it inside instance. """ logger.debug('Data: {0}'.format(data)) - vals = data.split('\t') + vals = data.decode('utf8').split('\t') if vals[0] == 'v1': self._name, self._reason, self._destroyAfter, self._templateId, self._state, self._task = vals[1:] @@ -130,7 +129,6 @@ class XenPublication(Publication): self._reason = str(e) return State.ERROR - return State.RUNNING def finish(self):