1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

Deadline & Fake set to false

* Added deadline to notifyURLS
* Now Fake = False
This commit is contained in:
Adolfo Gómez García 2017-10-16 12:02:01 +02:00
parent 0eebe6a0a5
commit 1f5a647ff3
4 changed files with 14 additions and 12 deletions

View File

@ -43,7 +43,7 @@ import six
import pickle
import logging
__updated__ = '2017-09-29'
__updated__ = '2017-10-16'
logger = logging.getLogger(__name__)
@ -236,7 +236,8 @@ class OGDeployment(UserDeployment):
'''
try:
r = self.service().reserve()
self.service().notifyEvents(r['id'], self._uuid)
deadLine = self.dbservice().deployed_service.getDeadline()
self.service().notifyEvents(r['id'], self._uuid, deadLine)
except Exception as e:
# logger.exception('Creating machine')
return self.__error('Error creating reservation: {}'.format(e))

View File

@ -41,7 +41,7 @@ from uds.core.ui import gui
import logging
__updated__ = '2017-10-05'
__updated__ = '2017-10-16'
logger = logging.getLogger(__name__)
@ -163,8 +163,8 @@ class OGService(Service):
def unreserve(self, machineId):
return self.parent().unreserve(machineId)
def notifyEvents(self, machineId, serviceUUID):
return self.parent().notifyEvents(machineId, self.getLoginNotifyURL(serviceUUID), self.getLogoutNotifyURL(serviceUUID))
def notifyEvents(self, machineId, serviceUUID, deadLine):
return self.parent().notifyEvents(machineId, self.getLoginNotifyURL(serviceUUID), self.getLogoutNotifyURL(serviceUUID), deadLine)
def _notifyURL(self, uuid, message):
# The URL is "GET messages URL".

View File

@ -48,7 +48,7 @@ import logging
import six
__updated__ = '2017-10-05'
__updated__ = '2017-10-16'
logger = logging.getLogger(__name__)
@ -191,8 +191,8 @@ class OGProvider(ServiceProvider):
def unreserve(self, machineId):
return self.api.unreserve(machineId)
def notifyEvents(self, machineId, loginURL, logoutURL):
return self.api.notifyURLs(machineId, loginURL, logoutURL)
def notifyEvents(self, machineId, loginURL, logoutURL, deadLine):
return self.api.notifyURLs(machineId, loginURL, logoutURL, deadLine)
def status(self, machineId):
return self.api.status(machineId)

View File

@ -45,14 +45,14 @@ import six
import requests
import json
__updated__ = '2017-10-02'
__updated__ = '2017-10-16'
logger = logging.getLogger(__name__)
# URLS
# Fake part
FAKE = True
FAKE = False
CACHE_VALIDITY = 180
@ -216,12 +216,13 @@ class OpenGnsysClient(object):
return self._delete(urls.UNRESERVE.format(ou=ou, lab=lab, client=client), errMsg=errMsg)
@ensureConnected
def notifyURLs(self, machineId, loginURL, logoutURL):
def notifyURLs(self, machineId, loginURL, logoutURL, deadLine):
ou, lab, client = machineId.split('.')
errMsg = 'Notifying login/logout urls'
data = {
'urlLogin': loginURL,
'urlLogout': logoutURL
'urlLogout': logoutURL,
'deadLine': deadLine
}
return self._post(urls.EVENTS.format(ou=ou, lab=lab, client=client), data, errMsg=errMsg)