evaluate max bulk settings in validate and improve OPTIONS (#16)

* evaluate max bulk settings in validate...

instead of in class attribute. This makes them load at request time
instead of at app start up time, which fixes problems with test
as well as I think will be better user experience if admins
actually do change the setting it will apply without restarting
django app on each instance

* improve OPTIONS by not manually declaring feilds

alan pointed this out
This commit is contained in:
Elijah DeLee
2023-03-01 14:00:31 -05:00
parent 3efc7d5bc4
commit bca0f2dd47
2 changed files with 26 additions and 30 deletions

View File

@@ -775,26 +775,25 @@ register(
help_text=_('Indicates whether the instance is part of a kubernetes-based deployment.'),
)
# TODO : Commenting below bulk job settings because of failing conftest import. Figure out the conftest issue and then uncomment
# register(
# 'BULK_JOB_MAX_LAUNCH',
# field_class=fields.IntegerField,
# default=100,
# label=_('Max jobs to allow bulk jobs to launch'),
# help_text=_('Max jobs to allow bulk jobs to launch'),
# category=_('Bulk Actions'),
# category_slug='bulk',
# )
#
# register(
# 'BULK_HOST_MAX_CREATE',
# field_class=fields.IntegerField,
# default=1000,
# label=_('Max number of hosts to allow to be created in a single bulk action'),
# help_text=_('Max number of hosts to allow to be created in a single bulk action'),
# category=_('Bulk Actions'),
# category_slug='bulk',
# )
register(
'BULK_JOB_MAX_LAUNCH',
field_class=fields.IntegerField,
default=100,
label=_('Max jobs to allow bulk jobs to launch'),
help_text=_('Max jobs to allow bulk jobs to launch'),
category=_('Bulk Actions'),
category_slug='bulk',
)
register(
'BULK_HOST_MAX_CREATE',
field_class=fields.IntegerField,
default=1000,
label=_('Max number of hosts to allow to be created in a single bulk action'),
help_text=_('Max number of hosts to allow to be created in a single bulk action'),
category=_('Bulk Actions'),
category_slug='bulk',
)
def logging_validate(serializer, attrs):