Fixed metapool usage && visualization

This commit is contained in:
Adolfo Gómez García 2020-10-05 16:03:49 +02:00
parent e38c05286f
commit cf2c984065
2 changed files with 8 additions and 9 deletions

View File

@ -158,7 +158,11 @@ class MetaAssignedService(DetailHandler):
try:
if not item: # All items
return [MetaAssignedService.itemToDict(parent, k) for k in assignedUserServicesForPools()]
result = {}
for k in assignedUserServicesForPools():
result[k.uuid] = MetaAssignedService.itemToDict(parent, k)
return result.values()
return MetaAssignedService.itemToDict(parent, self._getAssignedService(parent, item))
except Exception:
logger.exception('getItems')

View File

@ -707,15 +707,10 @@ class UserServiceManager:
if usable:
try:
usable[0].validateUser(user)
self.getService(user, os, srcIp, 'F' + usable[0].uuid, usable[1].uuid, doTest=False, clientHostname=clientHostName)
return self.getService(user, os, srcIp, 'F' + usable[0].uuid, usable[1].uuid, doTest=False, clientHostname=clientHostName)
except Exception as e:
logger.info('Meta service %s:%s could not be assigned, trying a new one', usable[0].name, e)
usable = None
if not usable:
log.doLog(meta, log.WARN, "No user service accessible from device (ip {}, os: {})".format(srcIp, os['OS']), log.SERVICE)
raise InvalidServiceException(_('The service is not accessible from this device'))
logger.debug('Found usable pair: %s', usable)
# We have found an usable deployed already assigned & can be accessed from this, so return it
return None, usable[0], None, usable[1], None
log.doLog(meta, log.WARN, "No user service accessible from device (ip {}, os: {})".format(srcIp, os['OS']), log.SERVICE)
raise InvalidServiceException(_('The service is not accessible from this device'))