fixed test redirect && fixed frequency

This commit is contained in:
Adolfo Gómez García 2021-02-16 13:17:10 +01:00
parent 073ce3df12
commit 672897f828
4 changed files with 15 additions and 6 deletions

View File

@ -271,6 +271,7 @@ class GlobalConfig:
# Unused services will be invoked for every machine assigned but not in use AND that has been assigned at least this time
# (only if os manager asks for this characteristic)
CHECK_UNUSED_TIME: Config.Value = Config.section(GLOBAL_SECTION).value('checkUnusedTime', '631', type=Config.NUMERIC_FIELD) # Defaults to 10 minutes
CHECK_UNUSED_DELAY: Config.Value = Config.section(GLOBAL_SECTION).value('checkUnusedDelay', '300', type=Config.NUMERIC_FIELD) # Defaults to 10 minutes
# Default CSS Used: REMOVED! (keep the for for naw, for reference, but will be cleaned on future...)
# CSS: Config.Value = Config.section(GLOBAL_SECTION).value('css', settings.STATIC_URL + 'css/uds.css', type=Config.TEXT_FIELD)
# Max logins before blocking an account

View File

@ -63,7 +63,8 @@ class RedirectMiddleware:
# For new paths
# 'uds/rest', # REST must be HTTPS if redirect is enabled
'uds/pam',
'uds/guacamole'
'uds/guacamole',
'uds/rest/client/test'
]
def __init__(self, get_response):

View File

@ -43,8 +43,8 @@ logger = logging.getLogger(__name__)
class AssignedAndUnused(Job):
frecuency = 301 # Once every 5 minute, but look for GlobalConfig.CHECK_UNUSED_TIME
# frecuency_cfg = GlobalConfig.CHECK_UNUSED_TIME
frecuency = 300 # Once every 5 minute, but look for GlobalConfig.CHECK_UNUSED_TIME
frecuency_cfg = GlobalConfig.CHECK_UNUSED_DELAY
friendly_name = 'Unused services checker'
def run(self) -> None:

View File

@ -54,9 +54,9 @@ if typing.TYPE_CHECKING:
logger = logging.getLogger(__name__)
# We have included a "hidden testing" for adding ip+mac as static machines list.
# We have included a "hidden testing" for adding ip+mac as static machines list.
# (This is done using IP;MAC as IP on the IP list)
# This is a test for WOL, and to be used at your risk.
# This is a test for WOL, and to be used at your risk.
# Example:
# WOLAPP = "/usr/sbin/etherwake {MAC} -i eth0 -b"
# Remember that you MUST setuid /usr/sbin/etherwake (chmod +s ....) and allow only for uds user,
@ -67,6 +67,7 @@ logger = logging.getLogger(__name__)
# If empty, no WOL will be tried NEVER, if not empty
WOLAPP = ''
class IPMachinesService(IPServiceBase):
# Gui
token = gui.TextField(
@ -252,11 +253,17 @@ class IPMachinesService(IPServiceBase):
theIP, self._port
),
)
logger.warning(
'Static Machine check on %s:%s failed. Will be ignored for %s minutes.',
theIP,
self._port,
self._skipTimeOnFailure,
)
self.storage.remove(theIP) # Return Machine to pool
self.cache.put(
'port{}'.format(theIP),
'1',
validity=self.skipTimeOnFailure.num() * 60,
validity=self._skipTimeOnFailure * 60,
)
continue
if theMAC: