mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-24 02:04:09 +03:00
Merger 1.9 fixes
This commit is contained in:
commit
b6f582d84e
@ -93,7 +93,7 @@ class Connection(Handler):
|
||||
services.append({'id': 'A' + svr.uuid,
|
||||
'name': svr['name'],
|
||||
'transports': trans,
|
||||
'maintenance': svr.deployed_service.service.provider.maintenance_mode,
|
||||
'maintenance': svr.isInMaintenance(),
|
||||
'in_use': svr.in_use})
|
||||
|
||||
logger.debug(services)
|
||||
@ -115,7 +115,7 @@ class Connection(Handler):
|
||||
services.append({'id': 'F' + svr.uuid,
|
||||
'name': svr.name,
|
||||
'transports': trans,
|
||||
'maintenance': svr.service.provider.maintenance_mode,
|
||||
'maintenance': svr.isInMaintenance(),
|
||||
'in_use': in_use})
|
||||
|
||||
logger.debug('Services: {0}'.format(services))
|
||||
|
@ -87,7 +87,7 @@ class ServicesPools(ModelHandler):
|
||||
'parent': item.service.name,
|
||||
'parent_type': item.service.data_type,
|
||||
'comments': item.comments,
|
||||
'state': item.state if item.service.provider.maintenance_mode is False else State.MAINTENANCE,
|
||||
'state': item.state if item.isInMaintenance() is False else State.MAINTENANCE,
|
||||
'thumb': item.image.thumb64 if item.image is not None else DEFAULT_THUMB_BASE64,
|
||||
'service_id': item.service.uuid,
|
||||
'provider_id': item.service.provider.uuid,
|
||||
|
@ -56,8 +56,7 @@ class AssignedAndUnused(Job):
|
||||
since_state = getSqlDatetime() - timedelta(seconds=self.frecuency)
|
||||
for ds in DeployedService.objects.all():
|
||||
# Skips checking deployed services in maintenance mode
|
||||
if ds.service.provider.maintenance_mode is True:
|
||||
logger.warn('Skipped {} because it is in maintenance mode'.format(ds.name))
|
||||
if ds.isInMaintenance() is True:
|
||||
continue
|
||||
# If do not needs os manager, this is
|
||||
if ds.osmanager is not None:
|
||||
|
@ -65,6 +65,11 @@ class DeployedServiceRemover(Job):
|
||||
super(DeployedServiceRemover, self).__init__(environment)
|
||||
|
||||
def startRemovalOf(self, ds):
|
||||
if ds.service is None: # Maybe an inconsistent value?
|
||||
logger.error('Found service pool {} without service')
|
||||
ds.delete()
|
||||
return
|
||||
|
||||
# Get publications in course...., can be at most 1!!!
|
||||
logger.debug('Removal process of {0}'.format(ds))
|
||||
|
||||
@ -131,7 +136,7 @@ class DeployedServiceRemover(Job):
|
||||
for ds in rems:
|
||||
try:
|
||||
# Skips checking deployed services in maintenance mode
|
||||
if ds.service.provider.maintenance_mode is False:
|
||||
if ds.isInMaintenance() is False:
|
||||
self.startRemovalOf(ds)
|
||||
except Exception as e1:
|
||||
logger.error('Error removing {}: {}'.format(ds, e1))
|
||||
@ -145,6 +150,9 @@ class DeployedServiceRemover(Job):
|
||||
if len(rems) > 0:
|
||||
logger.debug('Found a deployed service in removing state, continuing removal of {0}'.format(rems))
|
||||
for ds in rems:
|
||||
# Skips checking deployed services in maintenance mode
|
||||
if ds.service.provider.maintenance_mode is False:
|
||||
self.continueRemovalOf(ds)
|
||||
try:
|
||||
# Skips checking deployed services in maintenance mode
|
||||
if ds.isInMaintenance() is False:
|
||||
self.continueRemovalOf(ds)
|
||||
except Exception:
|
||||
logger.exception('Removing deployed service')
|
||||
|
@ -81,4 +81,4 @@ class UserServiceRemover(Job):
|
||||
try:
|
||||
UserServiceManager.manager().remove(us)
|
||||
except Exception:
|
||||
logger.exception('Exception invoking remove user service {}'.format(us))
|
||||
logger.exception('Exception removing user service')
|
||||
|
@ -43,7 +43,7 @@ from uds.models.ManagedObjectModel import ManagedObjectModel
|
||||
import logging
|
||||
|
||||
|
||||
__updated__ = '2015-05-12'
|
||||
__updated__ = '2015-11-16'
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -77,6 +77,9 @@ class Provider(ManagedObjectModel):
|
||||
'''
|
||||
return services.factory().lookup(self.data_type)
|
||||
|
||||
def isInMaintenance(self):
|
||||
return self.maintenance_mode
|
||||
|
||||
def __str__(self):
|
||||
return u"{0} of type {1} (id:{2})".format(self.name, self.data_type, self.id)
|
||||
|
||||
|
@ -47,7 +47,7 @@ from uds.models.Provider import Provider
|
||||
import logging
|
||||
|
||||
|
||||
__updated__ = '2015-05-12'
|
||||
__updated__ = '2015-11-16'
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -122,6 +122,9 @@ class Service(ManagedObjectModel):
|
||||
'''
|
||||
return self.provider.getType().getServiceByType(self.data_type)
|
||||
|
||||
def isInMaintenance(self):
|
||||
return self.provider is not None and self.provider.isInMaintenance()
|
||||
|
||||
def __str__(self):
|
||||
return u"{0} of type {1} (id:{2})".format(self.name, self.data_type, self.id)
|
||||
|
||||
|
@ -55,7 +55,7 @@ from uds.models.Util import getSqlDatetime
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
__updated__ = '2015-06-12'
|
||||
__updated__ = '2015-11-16'
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -175,7 +175,7 @@ class DeployedService(UUIDModel):
|
||||
return False
|
||||
|
||||
def isInMaintenance(self):
|
||||
return self.service.provider.maintenance_mode
|
||||
return self.service is not None and self.service.isInMaintenance()
|
||||
|
||||
def storeValue(self, name, value):
|
||||
'''
|
||||
|
@ -49,7 +49,7 @@ import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
__updated__ = '2015-05-05'
|
||||
__updated__ = '2015-11-16'
|
||||
|
||||
|
||||
def about(request):
|
||||
@ -124,7 +124,7 @@ def index(request):
|
||||
'transports': trans,
|
||||
'imageId': imageId,
|
||||
'show_transports': svr.deployed_service.show_transports,
|
||||
'maintenance': svr.deployed_service.service.provider.maintenance_mode,
|
||||
'maintenance': svr.deployed_service.isInMaintenance(),
|
||||
'in_use': svr.in_use,
|
||||
})
|
||||
|
||||
@ -167,7 +167,7 @@ def index(request):
|
||||
'transports': trans,
|
||||
'imageId': imageId,
|
||||
'show_transports': svr.show_transports,
|
||||
'maintenance': svr.service.provider.maintenance_mode,
|
||||
'maintenance': svr.isInMaintenance(),
|
||||
'in_use': in_use,
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user