mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-05 09:17:54 +03:00
* Added a "needed" comment on USerServiceManager
* Cached "modfinder" results * Added "early" loading of dispatchers, so they can register (for example) Configuration Parameters, etc..
This commit is contained in:
parent
63d0f6e470
commit
d75422c96f
@ -91,10 +91,12 @@ encoding//src/uds/core/workers/DeployedServiceCleaner.py=utf-8
|
|||||||
encoding//src/uds/core/workers/PublicationCleaner.py=utf-8
|
encoding//src/uds/core/workers/PublicationCleaner.py=utf-8
|
||||||
encoding//src/uds/core/workers/ServiceCacheUpdater.py=utf-8
|
encoding//src/uds/core/workers/ServiceCacheUpdater.py=utf-8
|
||||||
encoding//src/uds/core/workers/UserServiceCleaner.py=utf-8
|
encoding//src/uds/core/workers/UserServiceCleaner.py=utf-8
|
||||||
|
encoding//src/uds/dispatchers/__init__.py=utf-8
|
||||||
encoding//src/uds/dispatchers/pam/urls.py=utf-8
|
encoding//src/uds/dispatchers/pam/urls.py=utf-8
|
||||||
encoding//src/uds/dispatchers/pam/views.py=utf-8
|
encoding//src/uds/dispatchers/pam/views.py=utf-8
|
||||||
encoding//src/uds/dispatchers/test/urls.py=utf-8
|
encoding//src/uds/dispatchers/test/urls.py=utf-8
|
||||||
encoding//src/uds/dispatchers/test/views.py=utf-8
|
encoding//src/uds/dispatchers/test/views.py=utf-8
|
||||||
|
encoding//src/uds/dispatchers/wyse_enterprise/__init__.py=utf-8
|
||||||
encoding//src/uds/dispatchers/wyse_enterprise/urls.py=utf-8
|
encoding//src/uds/dispatchers/wyse_enterprise/urls.py=utf-8
|
||||||
encoding//src/uds/dispatchers/wyse_enterprise/views.py=utf-8
|
encoding//src/uds/dispatchers/wyse_enterprise/views.py=utf-8
|
||||||
encoding//src/uds/management/commands/config.py=utf-8
|
encoding//src/uds/management/commands/config.py=utf-8
|
||||||
|
@ -41,6 +41,7 @@ import services # to make sure that the packages are initialized at this point
|
|||||||
import auths # To make sure that the packages are initialized at this point
|
import auths # To make sure that the packages are initialized at this point
|
||||||
import osmanagers # To make sure that packages are initialized at this point
|
import osmanagers # To make sure that packages are initialized at this point
|
||||||
import transports # To make sure that packages are initialized at this point
|
import transports # To make sure that packages are initialized at this point
|
||||||
|
import dispatchers
|
||||||
import models
|
import models
|
||||||
|
|
||||||
|
|
||||||
|
@ -216,6 +216,11 @@ class UserServiceManager(object):
|
|||||||
state_date=now, creation_date=now, data='', deployed_service=deployedServicePublication.deployed_service, user=user, in_use=False)
|
state_date=now, creation_date=now, data='', deployed_service=deployedServicePublication.deployed_service, user=user, in_use=False)
|
||||||
|
|
||||||
def __createAssignedAtDbForNoPublication(self, deployedService, user):
|
def __createAssignedAtDbForNoPublication(self, deployedService, user):
|
||||||
|
'''
|
||||||
|
__createCacheAtDb and __createAssignedAtDb uses a publication for create the UserService.
|
||||||
|
There is cases where deployed services do not have publications (do not need them), so we need this method to create
|
||||||
|
an UserService with no publications, and create them from an DeployedService
|
||||||
|
'''
|
||||||
self.__checkMaxDeployedReached(deployedService)
|
self.__checkMaxDeployedReached(deployedService)
|
||||||
now = getSqlDatetime()
|
now = getSqlDatetime()
|
||||||
return deployedService.userServices.create(cache_level=0, state=State.PREPARING, os_state=State.PREPARING,
|
return deployedService.userServices.create(cache_level=0, state=State.PREPARING, os_state=State.PREPARING,
|
||||||
|
@ -39,8 +39,12 @@ import uds.dispatchers
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def loadModulesUrls():
|
|
||||||
patterns = []
|
patterns = []
|
||||||
|
|
||||||
|
def loadModulesUrls():
|
||||||
|
logger.debug('Looking for dispatching modules')
|
||||||
|
global patterns
|
||||||
|
if len(patterns) == 0:
|
||||||
try:
|
try:
|
||||||
modName = 'uds.dispatchers'
|
modName = 'uds.dispatchers'
|
||||||
pkgpath = os.path.dirname(sys.modules[modName].__file__)
|
pkgpath = os.path.dirname(sys.modules[modName].__file__)
|
||||||
@ -51,4 +55,6 @@ def loadModulesUrls():
|
|||||||
except Exception, e:
|
except Exception, e:
|
||||||
logger.debug(e)
|
logger.debug(e)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return patterns
|
return patterns
|
||||||
|
|
@ -0,0 +1,45 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright (c) 2012 Virtual Cable S.L.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
|
||||||
|
'''
|
||||||
|
@author: Adolfo Gómez, dkmaster at dkmon dot com
|
||||||
|
'''
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
'''
|
||||||
|
Service modules for uds are contained inside this package.
|
||||||
|
To create a new service module, you will need to follow this steps:
|
||||||
|
1.- Create the service module, probably based on an existing one
|
||||||
|
2.- Insert the module package as child of this package
|
||||||
|
3.- Import the class of your service module at __init__. For example::
|
||||||
|
from Service import SimpleService
|
||||||
|
4.- Done. At Server restart, the module will be recognized, loaded and treated
|
||||||
|
|
||||||
|
The registration of modules is done locating subclases of :py:class:`uds.core.auths.Authentication`
|
||||||
|
|
||||||
|
.. moduleauthor:: Adolfo Gómez, dkmaster at dkmon dot com
|
||||||
|
'''
|
||||||
|
|
||||||
|
def __init__():
|
||||||
|
'''
|
||||||
|
This imports all packages that are descendant of this package, and, after that,
|
||||||
|
it register all subclases of service provider as
|
||||||
|
'''
|
||||||
|
import os.path, pkgutil
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# Dinamycally import children of this package. The __init__.py files must register, if needed, inside ServiceProviderFactory
|
||||||
|
pkgpath = os.path.dirname(sys.modules[__name__].__file__)
|
||||||
|
for _, name, _ in pkgutil.iter_modules([pkgpath]):
|
||||||
|
__import__(name, globals(), locals(), [], -1)
|
||||||
|
|
||||||
|
|
||||||
|
logger.debug('Dispatchers initialized')
|
||||||
|
|
||||||
|
__init__()
|
@ -1678,16 +1678,18 @@ class Network(models.Model):
|
|||||||
'''
|
'''
|
||||||
convert decimal dotted quad string to long integer
|
convert decimal dotted quad string to long integer
|
||||||
'''
|
'''
|
||||||
|
try:
|
||||||
hexn = ''.join(["%02X" % long(i) for i in ip.split('.')])
|
hexn = ''.join(["%02X" % long(i) for i in ip.split('.')])
|
||||||
return long(hexn, 16)
|
return long(hexn, 16)
|
||||||
|
except:
|
||||||
|
return 0 # Invalid values will map to "0.0.0.0" --> 0
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def longToIp(n):
|
def longToIp(n):
|
||||||
'''
|
'''
|
||||||
convert long int to dotted quad string
|
convert long int to dotted quad string
|
||||||
'''
|
'''
|
||||||
|
try:
|
||||||
d = 256 * 256 * 256
|
d = 256 * 256 * 256
|
||||||
q = []
|
q = []
|
||||||
while d > 0:
|
while d > 0:
|
||||||
@ -1696,6 +1698,8 @@ class Network(models.Model):
|
|||||||
d = d/256
|
d = d/256
|
||||||
|
|
||||||
return '.'.join(q)
|
return '.'.join(q)
|
||||||
|
except:
|
||||||
|
return '0.0.0.0' # Invalid values will map to "0.0.0.0"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def networksFor(ip):
|
def networksFor(ip):
|
||||||
|
Loading…
Reference in New Issue
Block a user