def getGui(self, type_): try: return self.addDefaultFields( factory().lookup(type_).guiDescription(), ['name', 'comments', 'tags']) except: raise NotFound('type not found')
def getGui(self, type_: str) -> typing.List[typing.Any]: try: return self.addDefaultFields( osmanagers.factory().lookup(type_).guiDescription(), ['name', 'comments', 'tags']) except: raise NotFound('type not found')
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 from uds.core import osmanagers # 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) p = osmanagers.OSManager # This is marked as error in IDE, but it's not (__subclasses__) for cls in p.__subclasses__(): osmanagers.factory().insert(cls)
def getType(self): ''' Get the type of the object this record represents. The type is Python type, it obtains this type from ServiceProviderFactory and associated record field. Returns: The python type for this record object :note: We only need to get info from this, not access specific data (class specific info) ''' # We only need to get info from this, not access specific data (class specific info) from uds.core import osmanagers return osmanagers.factory().lookup(self.data_type)
def getType(self) -> typing.Type['osmanagers.OSManager']: """ Get the type of the object this record represents. The type is Python type, it obtains this type from ServiceProviderFactory and associated record field. Returns: The python type for this record object :note: We only need to get info from this, not access specific data (class specific info) """ # We only need to get info from this, not access specific data (class specific info) from uds.core import osmanagers type_ = osmanagers.factory().lookup(self.data_type) if type_: return type_ # If invalid type, ensure at least we have "basic" model (that will fail if used, but not if referenced) return osmanagers.OSManager
""" @author: Adolfo Gómez, dkmaster at dkmon dot com """ import os.path import sys from django.utils.translation import ugettext_noop as _ from uds.core import osmanagers from uds.core import managers from uds.core import VERSION from .windows import WindowsOsManager from .windows_domain import WinDomainOsManager from .windows_random import WinRandomPassManager osmanagers.factory().insert(WindowsOsManager) osmanagers.factory().insert(WinDomainOsManager) osmanagers.factory().insert(WinRandomPassManager) managers.downloadsManager().registerDownloadable( 'UDSActorSetup-{version}.exe'.format(version=VERSION), _('UDS Actor for windows machines'), os.path.dirname(sys.modules[__package__].__file__) + '/files/UDSActorSetup-{version}.exe'.format(version=VERSION), 'application/x-msdos-program') managers.downloadsManager().registerDownloadable( 'UDSActorUnmanagedSetup-{version}.exe'.format(version=VERSION), _('UDS Actor for Unmanaged windows machines. Used ONLY for static machines.' ), os.path.dirname(sys.modules[__package__].__file__) +
def getGui(self, type_): try: return self.addDefaultFields(factory().lookup(type_).guiDescription(), ['name', 'comments']) except: raise NotFound('type not found')
def enum_types(self): return factory().providers().values()
def enum_types(self) -> typing.Iterable[typing.Type[osmanagers.OSManager]]: return osmanagers.factory().providers().values()