forked from shaba/openuds
* Fixed scheduler query for select what tasks are available
* Added more space to configuration labels * Fixed WindowsOSManger unicode related problem * pep8 to Actor.py (xmlrpc)
This commit is contained in:
parent
9302c0cd76
commit
c62d30c506
@ -42,7 +42,7 @@ import threading
|
||||
import time
|
||||
import logging
|
||||
|
||||
__updated__ = '2014-02-19'
|
||||
__updated__ = '2014-03-20'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -107,7 +107,7 @@ class Scheduler(object):
|
||||
jobInstance = None
|
||||
try:
|
||||
now = getSqlDatetime() # Datetimes are based on database server times
|
||||
fltr = Q(state=State.FOR_EXECUTE) & (Q(owner_server=self._hostname) | Q(owner_server='')) & (Q(last_execution__gt=now) | Q(next_execution__lt=now))
|
||||
fltr = Q(state=State.FOR_EXECUTE) & (Q(last_execution__gt=now) | Q(next_execution__lt=now))
|
||||
with transaction.atomic():
|
||||
# If next execution is before now or last execution is in the future (clock changed on this server, we take that task as executable)
|
||||
# This params are all set inside fltr (look at __init__)
|
||||
|
@ -62,7 +62,6 @@ class DeployedServiceRemover(Job):
|
||||
def __init__(self, environment):
|
||||
super(DeployedServiceRemover, self).__init__(environment)
|
||||
|
||||
@transaction.atomic
|
||||
def startRemovalOf(self, ds):
|
||||
# Get publications in course...., can be at most 1!!!
|
||||
logger.debug('Removal process of {0}'.format(ds))
|
||||
@ -80,7 +79,6 @@ class DeployedServiceRemover(Job):
|
||||
ds.name = ds.name + ' (removed)'
|
||||
ds.save()
|
||||
|
||||
@transaction.atomic
|
||||
def continueRemovalOf(self, ds):
|
||||
# First, we remove all publications and user services in "info_state"
|
||||
ds.userServices.select_for_update().filter(state__in=State.INFO_STATES).delete()
|
||||
|
@ -31,7 +31,7 @@ def scrambleMsg(data):
|
||||
for c in data[::-1]:
|
||||
res.append(chr(ord(c) ^ n))
|
||||
n = (n + ord(c)) & 0xFF
|
||||
return "".join(res).encode('hex')
|
||||
return unicode(str.join(str(''), res).encode('hex'))
|
||||
|
||||
|
||||
class WindowsOsManager(osmanagers.OSManager):
|
||||
@ -52,16 +52,15 @@ class WindowsOsManager(osmanagers.OSManager):
|
||||
defvalue='keep'
|
||||
)
|
||||
|
||||
|
||||
@staticmethod
|
||||
def validateLen(len):
|
||||
def validateLen(length):
|
||||
try:
|
||||
len = int(len)
|
||||
length = int(length)
|
||||
except Exception:
|
||||
raise osmanagers.OSManager.ValidationException(_('Length must be numeric!!'))
|
||||
if len > 6 or len < 1:
|
||||
raise osmanagers.OSManager.ValidationException(_('Length must be betwen 1 and six'))
|
||||
return len
|
||||
if length > 6 or length < 1:
|
||||
raise osmanagers.OSManager.ValidationException(_('Length must be betwen 1 and 6'))
|
||||
return length
|
||||
|
||||
def __setProcessUnusedMachines(self):
|
||||
self.processUnusedMachines = self._onLogout == 'remove'
|
||||
|
@ -334,7 +334,7 @@ class DetailModelRestApi extends BasicModelRest
|
||||
|
||||
# Generic "Invoke" method (with no args, if needed, put them on "method" after "?" as normal url would be
|
||||
invoke: (method, success_fnc, fail_fnc) ->
|
||||
@base.get
|
||||
@get
|
||||
id: method
|
||||
success: success_fnc
|
||||
fail: fail_fnc
|
||||
|
@ -18,13 +18,13 @@
|
||||
{{/ eachKey }}
|
||||
</ul>
|
||||
<div class="row">
|
||||
<div class="tab-content col-md-12 col-md-offset-0 col-lg-6 col-lg-offset-1">
|
||||
<div class="tab-content col-md-12 col-md-offset-0 col-lg-8 col-lg-offset-2">
|
||||
{{# eachKey config }}
|
||||
<div class="tab-pane {{# if first }}active{{/ if }}" id="section_{{ key }}">
|
||||
{{# eachKey value }}
|
||||
<div class="form-group">
|
||||
<label for="fld_{{ clean_whitespace ../key }}{{ key }}" class="col-sm-3 control-label">{{ key }}</label>
|
||||
<div class="col-sm-9">
|
||||
<label for="fld_{{ clean_whitespace ../key }}{{ key }}" class="col-sm-5 control-label">{{ key }}</label>
|
||||
<div class="col-sm-6">
|
||||
{{# if value.crypt }}
|
||||
<div class="input-group">
|
||||
<input type="password" class="form-control" data-section="{{ ../../key }}" data-key="{{ ../key }}" id="fld_{{ clean_whitespace ../../key }}{{ clean_whitespace ../key }}" value="€fa{}#42123~#||23|ßðđæ">
|
||||
|
@ -4,27 +4,27 @@
|
||||
# Copyright (c) 2012 Virtual Cable S.L.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
'''
|
||||
@ -39,6 +39,7 @@ import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def test():
|
||||
'''
|
||||
Simple test function called by actors to test communication.
|
||||
@ -54,7 +55,7 @@ def message(id_, message, data):
|
||||
@param message: Mesagge received from actor
|
||||
@param data: Extra data
|
||||
'''
|
||||
ids = id_.split(",")[:5] # Limit ids received to five...
|
||||
ids = id_.split(",")[:5] # Limit ids received to five...
|
||||
logger.debug("Called message for id_ {0}, message \"{1}\" and data \"{2}\"".format(ids, message, data))
|
||||
res = ""
|
||||
try:
|
||||
@ -65,12 +66,12 @@ def message(id_, message, data):
|
||||
inUse = services[0].in_use
|
||||
res = services[0].getInstance().osmanager().process(services[0], message, data)
|
||||
services = UserService.objects.select_for_update().filter(unique_id__in=ids, state__in=[State.USABLE, State.PREPARING])
|
||||
if services.count() > 0 and services[0].in_use != inUse: # If state changed, log it
|
||||
if services.count() > 0 and services[0].in_use != inUse: # If state changed, log it
|
||||
type_ = inUse and 'login' or 'logout'
|
||||
uniqueId = services[0].unique_id
|
||||
serviceIp = ''
|
||||
username = ''
|
||||
log.useLog(type_, uniqueId , serviceIp, username)
|
||||
log.useLog(type_, uniqueId, serviceIp, username)
|
||||
except Exception as e:
|
||||
logger.error("Exception at message (client): {0}".format(e))
|
||||
res = ""
|
||||
|
Loading…
Reference in New Issue
Block a user