Merge remote-tracking branch 'origin/v3.6'

This commit is contained in:
Adolfo Gómez García 2022-08-31 12:52:37 +02:00
commit c06c3df327
2 changed files with 32 additions and 3 deletions

View File

@ -252,15 +252,33 @@ class Service(Module):
""" """
return True return True
def unmarshal(self, data: bytes) -> None:
# In fact, we will not unmarshall anything here, but setup maxDeployed
# if maxServices exists and it is a gui.NumericField
# Invoke base unmarshall, so "gui fields" gets loaded from data
super().unmarshal(data)
if hasattr(self, 'maxServices'):
# Fix Own "maxDeployed" value after loading fields
try:
self.maxDeployed = getattr(self, 'maxServices').num()
except Exception:
self.maxDeployed = Service.UNLIMITED
if self.maxDeployed < 1:
self.maxDeployed = Service.UNLIMITED
else:
self.maxDeployed = Service.UNLIMITED
def requestServicesForAssignation( def requestServicesForAssignation(
self, **kwargs self, **kwargs
) -> typing.Iterable[UserDeployment]: ) -> typing.Iterable[UserDeployment]:
""" """
override this if mustAssignManualy is True override this if mustAssignManualy is True
@params kwargs: Named arguments @params kwargs: Named arguments
@return an array with the services that we can assign (they must be of type deployedType) @return an iterable with the services that we can assign manually (they must be of type UserDeployment)
We will access the returned array in "name" basis. This means that the service will be assigned by "name", so be care that every single service We will access the returned iterable in "name" basis. This means that the service will be assigned by "name", so be care that every single service
returned are not repeated... :-) name returned is unique :-)
""" """
raise Exception( raise Exception(
'The class {0} has been marked as manually asignable but no requestServicesForAssignetion provided!!!'.format( 'The class {0} has been marked as manually asignable but no requestServicesForAssignetion provided!!!'.format(

View File

@ -145,6 +145,17 @@ class OGService(Service):
), ),
) )
maxServices = gui.NumericField(
order=4,
label=_("Max. Allowd services"),
minValue=0,
maxValue=99999,
defvalue=0,
rdonly=False,
tooltip=_('Maximum number of allowed services (0 or less means no limit)'),
required=True,
)
ov = gui.HiddenField(value=None) ov = gui.HiddenField(value=None)
ev = gui.HiddenField( ev = gui.HiddenField(
value=None value=None