Added new system info

This commit is contained in:
Adolfo Gómez García 2019-02-12 07:51:11 +01:00
parent 6889098ec8
commit 581b13e70e
2 changed files with 11 additions and 5 deletions

View File

@ -32,7 +32,7 @@
"""
from __future__ import unicode_literals
from uds.models import User, Service, UserService, DeployedService, getSqlDatetime
from uds.models import User, Group, Service, UserService, ServicePool, MetaPool, getSqlDatetime
from uds.core.util.stats import counters
from uds.core.util.Cache import Cache
@ -63,7 +63,7 @@ def getServicesPoolsCounters(servicePool, counter_type):
val = cache.get(cacheKey)
if val is None:
if servicePool is None:
us = DeployedService()
us = ServicePool()
complete = True # Get all deployed services stats
else:
us = servicePool
@ -91,12 +91,18 @@ class System(Handler):
if len(self._args) == 1:
if self._args[0] == 'overview': # System overview
users = User.objects.count()
groups = Group.objects.count()
services = Service.objects.count()
service_pools = ServicePool.objects.count()
meta_pools = MetaPool.objects.count()
user_services = UserService.objects.exclude(state__in=(State.REMOVED, State.ERROR)).count()
restrained_services_pools = len(DeployedService.getRestraineds())
restrained_services_pools = len(ServicePool.getRestraineds())
return {
'users': users,
'groups': groups,
'services': services,
'service_pools': service_pools,
'meta_pools': meta_pools,
'user_services': user_services,
'restrained_services_pools': restrained_services_pools,
}

View File

@ -58,7 +58,7 @@ import json
import logging
import random
__updated__ = '2019-02-08'
__updated__ = '2019-02-11'
logger = logging.getLogger(__name__)
traceLogger = logging.getLogger('traceLog')
@ -516,7 +516,7 @@ class UserServiceManager(object):
This checks that the service can continue existing or not
"""
osm = uService.deployed_service.osmanager
# If os manager says "machine is persistent", do not tray to delete "previous version" assigned machines
# If os manager says "machine is persistent", do not try to delete "previous version" assigned machines
doPublicationCleanup = True if osm is None else not osm.getInstance().isPersistent()
if doPublicationCleanup: