Added posibility to modify several OS Manager fields even if it is being used

This commit is contained in:
Adolfo Gómez García 2015-02-16 18:31:16 +01:00
parent 111782dffd
commit e6998cb1f3
8 changed files with 34 additions and 22 deletions

View File

@ -137,7 +137,8 @@ class UDSActorSvc(win32serviceutil.ServiceFramework, CommonService):
currName = operations.getComputerName() currName = operations.getComputerName()
if currName.lower() == name.lower(): if currName.lower() == name.lower():
currDomain = operations.getDomainName() currDomain = operations.getDomainName()
if currDomain is not None and currDomain.lower() == domain.lower(): logger.debug('Name: "{}" vs "{}", Domain: "{}" vs "{}"'.format(currName.lower(), name.lower(), currDomain.lower(), domain.lower()))
if currDomain is not None:
logger.info( logger.info(
'Machine {} is part of domain {}'.format(name, domain)) 'Machine {} is part of domain {}'.format(name, domain))
self.setReady() self.setReady()
@ -164,6 +165,7 @@ class UDSActorSvc(win32serviceutil.ServiceFramework, CommonService):
self.multiStepJoin(name, domain, ou, account, password) self.multiStepJoin(name, domain, ou, account, password)
def preConnect(self, user, protocol): def preConnect(self, user, protocol):
logger.debug('Pre connect invoked')
if protocol != 'rdp': # If connection is not using rdp, skip adding user if protocol != 'rdp': # If connection is not using rdp, skip adding user
return 'ok' return 'ok'
# Well known SSID for Remote Desktop Users # Well known SSID for Remote Desktop Users

View File

@ -64,7 +64,7 @@ def getNetworkInfo():
continue continue
if ip == '' or ip is None: if ip == '' or ip is None:
continue continue
logger.debug('Net config found: {}=({}, {})'.format(obj.Caption, obj.MACAddress, ip)) # logger.debug('Net config found: {}=({}, {})'.format(obj.Caption, obj.MACAddress, ip))
yield utils.Bunch(name=obj.Caption, mac=obj.MACAddress, ip=ip) yield utils.Bunch(name=obj.Caption, mac=obj.MACAddress, ip=ip)
except Exception: except Exception:
return return

View File

@ -77,9 +77,8 @@ class OsManagers(ModelHandler):
if item.deployedServices.count() > 0: if item.deployedServices.count() > 0:
raise RequestError(ugettext('Can\'t delete an OS Manager with services pools associated')) raise RequestError(ugettext('Can\'t delete an OS Manager with services pools associated'))
def checkSave(self, item): def checkSave(self, item): # Right now, always can be saved
if item.deployedServices.count() > 0 and settings.DEBUG is False: pass
raise RequestError(ugettext('Can\'t modify an OS Manager with services pools associated'))
# Types related # Types related
def enum_types(self): def enum_types(self):

View File

@ -270,8 +270,8 @@ class Publications(DetailHandler):
Custom method "publish", provided to initiate a publication of a deployed service Custom method "publish", provided to initiate a publication of a deployed service
:param parent: Parent service pool :param parent: Parent service pool
''' '''
logger.debug('Custom "publish" invoked') logger.debug('Custom "publish" invoked for {}'.format(parent))
parent.publish() parent.publish() # Can raise exceptions that will be processed on response
return self.success() return self.success()
def cancel(self, parent, uuid): def cancel(self, parent, uuid):

View File

@ -40,6 +40,7 @@ from django.db import IntegrityError
from uds.core.ui.UserInterface import gui as uiGui from uds.core.ui.UserInterface import gui as uiGui
from uds.REST.handlers import Handler, HandlerError from uds.REST.handlers import Handler, HandlerError
from uds.core.util import log from uds.core.util import log
import fnmatch import fnmatch
import re import re
import itertools import itertools
@ -49,7 +50,7 @@ import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
__updated__ = '2015-02-10' __updated__ = '2015-02-16'
# a few constants # a few constants
@ -293,15 +294,12 @@ class DetailHandler(BaseModelHandler): # pylint: disable=abstract-class-not-use
''' '''
logger.debug('Checking custom method {0}'.format(check)) logger.debug('Checking custom method {0}'.format(check))
if check in self.custom_methods: if check in self.custom_methods:
try:
operation = getattr(self, check) operation = getattr(self, check)
if arg is None: if arg is None:
return operation(parent) return operation(parent)
else: else:
return operation(parent, arg) return operation(parent, arg)
except Exception:
self.invalidMethodException()
return None return None

View File

@ -55,7 +55,7 @@ class LinuxOsManager(osmanagers.OSManager):
onLogout = gui.ChoiceField( onLogout = gui.ChoiceField(
label=_('On Logout'), label=_('On Logout'),
order=10, order=10,
rdonly=False, rdonly=True,
tooltip=_('What to do when user logs out from service'), tooltip=_('What to do when user logs out from service'),
values=[ values=[
{'id': 'keep', 'text': _('Keep service assigned')}, {'id': 'keep', 'text': _('Keep service assigned')},
@ -63,8 +63,13 @@ class LinuxOsManager(osmanagers.OSManager):
], ],
defvalue='keep') defvalue='keep')
idle = gui.NumericField(label=_("Max.Idle time"), length=4, defvalue=-1, rdonly=False, order=11, idle = gui.NumericField(
tooltip=_('Maximum idle time (in seconds) before session is automaticatlly closed to the user (<= 0 means no max idle time).'), required=True) label=_("Max.Idle time"),
length=4,
defvalue=-1,
rdonly=False, order=11,
tooltip=_('Maximum idle time (in seconds) before session is automaticatlly closed to the user (<= 0 means no max idle time).'),
required=True)
def __setProcessUnusedMachines(self): def __setProcessUnusedMachines(self):
self.processUnusedMachines = self._onLogout == 'remove' self.processUnusedMachines = self._onLogout == 'remove'

View File

@ -47,7 +47,7 @@ class WindowsOsManager(osmanagers.OSManager):
onLogout = gui.ChoiceField( onLogout = gui.ChoiceField(
label=_('On Logout'), label=_('On Logout'),
order=10, order=10,
rdonly=False, rdonly=True,
tooltip=_('What to do when user logs out from service'), tooltip=_('What to do when user logs out from service'),
values=[ values=[
{'id': 'keep', 'text': _('Keep service assigned')}, {'id': 'keep', 'text': _('Keep service assigned')},
@ -56,8 +56,15 @@ class WindowsOsManager(osmanagers.OSManager):
defvalue='keep' defvalue='keep'
) )
idle = gui.NumericField(label=_("Max.Idle time"), length=4, defvalue=-1, rdonly=False, order=11, idle = gui.NumericField(
tooltip=_('Maximum idle time (in seconds) before session is automaticatlly closed to the user (<= 0 means no max. idle time)'), required=True) label=_("Max.Idle time"),
length=4,
defvalue=-1,
rdonly=False,
order=11,
tooltip=_('Maximum idle time (in seconds) before session is automaticatlly closed to the user (<= 0 means no max. idle time)'),
required=True
)
@staticmethod @staticmethod
def validateLen(length): def validateLen(length):

View File

@ -1 +1,2 @@
/bin/ /bin/
/jar/