mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
make the max host default to 100
Make the max host default 100. We are seeing with moderate number of hosts i.e. 500 hosts having a few host variable each runs into max size of nginx message and nginx rejects the request. we are therefor keeping the value small so that it doesn't fail with decent number of host variables as well. remove the 999 hosts test because the default max is 100 fix the credential check fix the instance groups and execution env permission checks
This commit is contained in:
parent
bca0f2dd47
commit
47b7bbeda7
@ -4642,6 +4642,9 @@ class BulkJobLaunchSerializer(BaseSerializer):
|
||||
if requested_use_inventories or 'inventory' in attrs:
|
||||
self.check_inventory_permission(attrs, request, requested_use_inventories)
|
||||
|
||||
if requested_use_credentials:
|
||||
self.check_credential_permission(request, requested_use_credentials)
|
||||
|
||||
if requested_use_labels:
|
||||
self.check_label_permission(request, requested_use_labels)
|
||||
|
||||
@ -4649,7 +4652,8 @@ class BulkJobLaunchSerializer(BaseSerializer):
|
||||
self.check_instance_group_permission(request, requested_use_instance_groups)
|
||||
|
||||
if requested_use_execution_environments:
|
||||
self.check_instance_group_permission(request, requested_use_instance_groups)
|
||||
self.check_execution_environment_permission(request, requested_use_instance_groups)
|
||||
|
||||
|
||||
# all of the unified job templates and related items have now been checked, we can now grab the objects from the DB
|
||||
jobs_object = self.get_objectified_jobs(
|
||||
@ -4814,6 +4818,8 @@ class BulkJobLaunchSerializer(BaseSerializer):
|
||||
if requested_use_instance_groups - accessible_use_instance_groups:
|
||||
not_allowed = requested_use_instance_groups - accessible_use_instance_groups
|
||||
raise serializers.ValidationError(_(f"Instance Groups {not_allowed} not found or you don't have permissions to access it"))
|
||||
else:
|
||||
raise serializers.ValidationError(_(f"Instance Groups {requested_use_instance_groups} not found or you don't have permissions to access it"))
|
||||
|
||||
def check_execution_environment_permission(self, request, requested_use_execution_environments):
|
||||
accessible_execution_env = {
|
||||
|
||||
@ -788,7 +788,7 @@ register(
|
||||
register(
|
||||
'BULK_HOST_MAX_CREATE',
|
||||
field_class=fields.IntegerField,
|
||||
default=1000,
|
||||
default=100,
|
||||
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'),
|
||||
|
||||
@ -10,7 +10,7 @@ from awx.main.scheduler import TaskManager
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@pytest.mark.parametrize('num_hosts, num_queries', [(9, 15), (99, 20), (999, 30)])
|
||||
@pytest.mark.parametrize('num_hosts, num_queries', [(9, 15), (99, 20)])
|
||||
def test_bulk_host_create_num_queries(organization, inventory, post, get, user, num_hosts, num_queries, django_assert_max_num_queries):
|
||||
'''
|
||||
If I am a...
|
||||
|
||||
@ -136,7 +136,7 @@ SCHEDULE_MAX_JOBS = 10
|
||||
BULK_JOB_MAX_LAUNCH = 100
|
||||
|
||||
# Maximum number of host that can be created in 1 bulk host create
|
||||
BULK_HOST_MAX_CREATE = 1000
|
||||
BULK_HOST_MAX_CREATE = 100
|
||||
|
||||
SITE_ID = 1
|
||||
|
||||
|
||||
@ -75,4 +75,4 @@ Following is an example of a post request at the /api/v2/bulk/host_create:
|
||||
|
||||
The above will add 6 hosts in the inventory.
|
||||
|
||||
The maximum number of hosts allowed to be added is controlled by the setting `BULK_HOST_MAX_CREATE`. The default is 1,000 hosts. Additionally, nginx limits the maximum payload size, which is very likely when posting a large number of hosts in one request with variable data associated with them. The maximum payload size is 1MB unless overridden in your nginx config.
|
||||
The maximum number of hosts allowed to be added is controlled by the setting `BULK_HOST_MAX_CREATE`. The default is 100 hosts. Additionally, nginx limits the maximum payload size, which is very likely when posting a large number of hosts in one request with variable data associated with them. The maximum payload size is 1MB unless overridden in your nginx config.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user