mirror of
https://github.com/ansible/awx.git
synced 2026-03-21 19:07:39 -02:30
Merge pull request #99 from ryanpetrello/fix-7328
force isolated timeout settings to be positive integers
This commit is contained in:
@@ -175,6 +175,7 @@ register(
|
|||||||
register(
|
register(
|
||||||
'AWX_ISOLATED_CHECK_INTERVAL',
|
'AWX_ISOLATED_CHECK_INTERVAL',
|
||||||
field_class=fields.IntegerField,
|
field_class=fields.IntegerField,
|
||||||
|
min_value=0,
|
||||||
label=_('Isolated status check interval'),
|
label=_('Isolated status check interval'),
|
||||||
help_text=_('The number of seconds to sleep between status checks for jobs running on isolated instances.'),
|
help_text=_('The number of seconds to sleep between status checks for jobs running on isolated instances.'),
|
||||||
category=_('Jobs'),
|
category=_('Jobs'),
|
||||||
@@ -184,6 +185,7 @@ register(
|
|||||||
register(
|
register(
|
||||||
'AWX_ISOLATED_LAUNCH_TIMEOUT',
|
'AWX_ISOLATED_LAUNCH_TIMEOUT',
|
||||||
field_class=fields.IntegerField,
|
field_class=fields.IntegerField,
|
||||||
|
min_value=0,
|
||||||
label=_('Isolated launch timeout'),
|
label=_('Isolated launch timeout'),
|
||||||
help_text=_('The timeout (in seconds) for launching jobs on isolated instances. '
|
help_text=_('The timeout (in seconds) for launching jobs on isolated instances. '
|
||||||
'This includes the time needed to copy source control files (playbooks) to the isolated instance.'),
|
'This includes the time needed to copy source control files (playbooks) to the isolated instance.'),
|
||||||
@@ -194,6 +196,7 @@ register(
|
|||||||
register(
|
register(
|
||||||
'AWX_ISOLATED_CONNECTION_TIMEOUT',
|
'AWX_ISOLATED_CONNECTION_TIMEOUT',
|
||||||
field_class=fields.IntegerField,
|
field_class=fields.IntegerField,
|
||||||
|
min_value=0,
|
||||||
default=10,
|
default=10,
|
||||||
label=_('Isolated connection timeout'),
|
label=_('Isolated connection timeout'),
|
||||||
help_text=_('Ansible SSH connection timeout (in seconds) to use when communicating with isolated instances. '
|
help_text=_('Ansible SSH connection timeout (in seconds) to use when communicating with isolated instances. '
|
||||||
|
|||||||
@@ -243,3 +243,19 @@ def test_logging_aggregrator_connection_test_invalid(mocker, get, post, admin):
|
|||||||
'LOG_AGGREGATOR_PORT': 8080
|
'LOG_AGGREGATOR_PORT': 8080
|
||||||
}, user=admin, expect=500)
|
}, user=admin, expect=500)
|
||||||
assert resp.data == {'error': '404: Not Found'}
|
assert resp.data == {'error': '404: Not Found'}
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.django_db
|
||||||
|
@pytest.mark.parametrize('setting_name', [
|
||||||
|
'AWX_ISOLATED_CHECK_INTERVAL',
|
||||||
|
'AWX_ISOLATED_LAUNCH_TIMEOUT',
|
||||||
|
'AWX_ISOLATED_CONNECTION_TIMEOUT',
|
||||||
|
])
|
||||||
|
def test_isolated_job_setting_validation(get, patch, admin, setting_name):
|
||||||
|
url = reverse('api:setting_singleton_detail', kwargs={'category_slug': 'jobs'})
|
||||||
|
patch(url, user=admin, data={
|
||||||
|
setting_name: -1
|
||||||
|
}, expect=400)
|
||||||
|
|
||||||
|
data = get(url, user=admin).data
|
||||||
|
assert data[setting_name] != -1
|
||||||
|
|||||||
Reference in New Issue
Block a user