1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-10-20 11:33:38 +03:00

OS Managers, in fact, provides a single type of "service (That is, VDI or VAPP, ...) but not mor than one

This commit is contained in:
Adolfo Gómez García
2023-08-01 16:01:00 +02:00
parent 28b03427f2
commit 8e5610bc50
9 changed files with 11 additions and 13 deletions

View File

@@ -69,7 +69,7 @@ class OsManagers(ModelHandler):
'deployed_count': osm.deployedServices.count(),
'type': type_.type(),
'type_name': type_.name(),
'servicesTypes': type_.servicesType,
'servicesTypes': [type_.servicesType], # A list for backward compatibility. TODO: To be removed when admin interface is changed
'comments': osm.comments,
'permission': permissions.getEffectivePermission(self._user, osm),
}

View File

@@ -93,7 +93,7 @@ class Providers(ModelHandler):
'description': gettext(t.description()),
'icon': t.icon64().replace('\n', ''),
}
for t in type_.getServicesTypes()
for t in type_.getProvidedServices()
]
return {

View File

@@ -257,10 +257,10 @@ class Services(DetailHandler): # pylint: disable=too-many-public-methods
'description': _(t.description()),
'icon': t.icon64().replace('\n', ''),
}
for t in parent.getType().getServicesTypes()
for t in parent.getType().getProvidedServices()
]
else:
for t in parent.getType().getServicesTypes():
for t in parent.getType().getProvidedServices():
if forType == t.type():
offers = [
{

View File

@@ -70,7 +70,7 @@ class OSManager(Module):
# : Type of services for which this OS Manager is designed
# : Defaults to all. (list or tuple)
servicesType: typing.Iterable[types.services.ServiceType] = types.services.ALL
servicesType: types.services.ServiceType = types.services.ServiceType.VDI
def __init__(self, environment: 'Environment', values: Module.ValuesType):
super().__init__(environment, values)

View File

@@ -125,7 +125,7 @@ class ServiceProvider(Module):
ignoreLimits: typing.Any = None
@classmethod
def getServicesTypes(cls) -> typing.List[typing.Type['Service']]:
def getProvidedServices(cls) -> typing.List[typing.Type['Service']]:
"""
Returns what type of services this provider offers
"""

View File

@@ -64,8 +64,7 @@ class RegisteredServer(models.Model):
class ServerType(enum.IntEnum):
TUNNEL_SERVER = 1
ACTOR_SERVICE = 2
APP_SERVER = 3
OTHER = 99
SERVER = 3
def as_str(self) -> str:
return self.name.lower() # type: ignore
@@ -74,8 +73,7 @@ class RegisteredServer(models.Model):
return {
RegisteredServer.ServerType.TUNNEL_SERVER: 'tunnel',
RegisteredServer.ServerType.ACTOR_SERVICE: 'actor',
RegisteredServer.ServerType.APP_SERVER: 'app',
RegisteredServer.ServerType.OTHER: 'other',
RegisteredServer.ServerType.SERVER: 'server',
}[self]
MAC_UNKNOWN = '00:00:00:00:00:00'

View File

@@ -55,7 +55,7 @@ class LinuxOsManager(osmanagers.OSManager):
typeDescription = _('Os Manager to control Linux virtual machines')
iconFile = 'losmanager.png'
servicesType = (serviceTypes.VDI,)
servicesType = serviceTypes.VDI
onLogout = gui.ChoiceField(
label=_('Logout Action'),

View File

@@ -54,7 +54,7 @@ class TestOSManager(osmanagers.OSManager):
typeDescription = _('Os Manager for testing pourposes')
iconFile = 'osmanager.png'
servicesType = types.services.ALL
servicesType = types.services.ServiceType.VDI
onLogout = gui.ChoiceField(
label=_('Logout Action'),

View File

@@ -45,7 +45,7 @@ class WindowsOsManager(osmanagers.OSManager):
typeType = 'WindowsManager'
typeDescription = _('Os Manager to control windows machines without domain.')
iconFile = 'wosmanager.png'
servicesType = (serviceTypes.VDI,)
servicesType = serviceTypes.VDI
onLogout = gui.ChoiceField(
label=_('Logout Action'),