This commit is contained in:
Adolfo Gómez García 2015-11-06 04:58:06 +01:00
commit d8a0a2f80a
3 changed files with 12 additions and 8 deletions

View File

@ -51,7 +51,7 @@ import requests
import json import json
import logging import logging
__updated__ = '2015-11-05' __updated__ = '2015-11-06'
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -555,7 +555,8 @@ class UserServiceManager(object):
raise ServiceInMaintenanceMode() raise ServiceInMaintenanceMode()
logger.debug('Found service: {0}'.format(userService)) logger.debug('Found service: {0}'.format(userService))
if idTransport is None: # Find a suitable transport
if idTransport is None or idTransport == '': # Find a suitable transport
for v in userService.deployed_service.transports.order_by('priority'): for v in userService.deployed_service.transports.order_by('priority'):
if v.validForIp(srcIp): if v.validForIp(srcIp):
idTransport = v.uuid idTransport = v.uuid
@ -603,4 +604,4 @@ class UserServiceManager(object):
else: else:
log.doLog(userService, log.WARN, "User {0} from {1} tried to access, but service was not ready".format(user.name, srcIp), log.WEB) log.doLog(userService, log.WARN, "User {0} from {1} tried to access, but service was not ready".format(user.name, srcIp), log.WEB)
raise ServiceNotReadyError(code=serviceNotReadyCode) raise ServiceNotReadyError(code=serviceNotReadyCode, service=userService, transport=trans)

View File

@ -32,7 +32,7 @@
''' '''
from __future__ import unicode_literals from __future__ import unicode_literals
__updated__ = '2015-04-30' __updated__ = '2015-11-06'
class ServiceException(Exception): class ServiceException(Exception):
@ -104,3 +104,5 @@ class ServiceNotReadyError(ServiceException):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(ServiceNotReadyError, self).__init__(*args, **kwargs) super(ServiceNotReadyError, self).__init__(*args, **kwargs)
self.code = kwargs.get('code', 0x0000) self.code = kwargs.get('code', 0x0000)
self.service = kwargs.get('service', None)
self.transport = kwargs.get('transport', None)

View File

@ -58,7 +58,7 @@ import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
__updated__ = '2015-09-12' __updated__ = '2015-11-06'
@csrf_exempt @csrf_exempt
@ -194,11 +194,12 @@ def ticketAuth(request, ticketId):
# Check if servicePool is part of the ticket # Check if servicePool is part of the ticket
if servicePool is not None: if servicePool is not None:
# If service pool is in there, also is transport # If service pool is in there, also is transport
res = userServiceManager().getService(request.user, request.ip, 'F' + servicePool, transport) res = userServiceManager().getService(request.user, request.ip, 'F' + servicePool, transport, False)
ip, userService, userServiceInstance, transport, transportInstance = res _x, userService, _x, transport, _x = res
transportInstance = transport.getInstance()
if transportInstance.ownLink is True: if transportInstance.ownLink is True:
link = reverse('TransportOwnLink', args=('A' + userServiceInstance.uuid, transportInstance.uuid)) link = reverse('TransportOwnLink', args=('A' + userService.uuid, transport.uuid))
else: else:
link = html.udsAccessLink(request, 'A' + userService.uuid, transport.uuid) link = html.udsAccessLink(request, 'A' + userService.uuid, transport.uuid)