* Added "development" method for user machines

* Fixed publications clean up on new publication & session expiration
* Added "forgotten" unicode method to DeployedPublication
This commit is contained in:
Adolfo Gómez 2013-06-20 09:03:50 +00:00
parent 32d951a43c
commit 9b99b8f1bd
3 changed files with 29 additions and 2 deletions

View File

@ -74,6 +74,7 @@ class PublicationCleaner(Job):
now = getSqlDatetime()
removeFrom = now - timedelta(hours = GlobalConfig.SESSION_EXPIRE_TIME.getInt(True))
for dsp in removables.filter(state_date__lt=removeFrom):
dsp.deployed_service.filter(in_use=True).update(in_use=False, state_date=now)
dsp.deployed_service.markOldUserServicesAsRemovables(dsp)
activePub = dsp.deployed_service.activePublication()
dsp.deployed_service.userServices.filter(in_use=True).update(in_use=False, state_date=now)
dsp.deployed_service.markOldUserServicesAsRemovables(activePub)

View File

@ -1279,6 +1279,9 @@ class DeployedServicePublication(models.Model):
logger.debug('Deleted publication {0}'.format(toDelete))
def __unicode__(self):
return 'Publication {0}, rev {1}, state {2}'.format(self.deployed_service.name, self.revision, State.toString(self.state))
# Connects a pre deletion signal to Authenticator

View File

@ -153,6 +153,28 @@ def getUserDeployedServiceError(credentials, idService):
raise FindException(_('User deployed service not found!!!'))
return error
@needs_credentials
def develAction(credentials, action, ids ):
logger.debug('Devel action invoked: {0} for {1}'.format(action, ids))
try:
for uds in UserService.objects.filter(id__in=ids):
if action == "inUse":
logger.debug('Setting {0} to in use'.format(uds.friendly_name))
uds.setInUse(True)
elif action == "releaseInUse":
logger.debug('Releasing in use from {0}'.format(uds.friendly_name))
uds.setState(State.USABLE)
uds.setInUse(False)
else:
logger.debug('Setting {0} to usable'.format(uds.friendly_name))
uds.setState(State.USABLE)
if uds.needsOsManager():
uds.setOsState(State.USABLE)
uds.save()
except UserService.DoesNotExist:
raise FindException(_('User deployed service not found!!!'))
return True
# Registers XML RPC Methods
def registerUserDeployedServiceFunctions(dispatcher):
dispatcher.register_function(getCachedDeployedServices, 'getCachedDeployedServices')
@ -161,3 +183,4 @@ def registerUserDeployedServiceFunctions(dispatcher):
dispatcher.register_function(assignDeployedService, 'assignDeployedService')
dispatcher.register_function(removeUserService, 'removeUserService')
dispatcher.register_function(getUserDeployedServiceError, 'getUserDeployedServiceError')
dispatcher.register_function(develAction, "develAction")