1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

force isolated timeout settings to be positive integers

see: https://github.com/ansible/ansible-tower/issues/7328
This commit is contained in:
Ryan Petrello 2017-07-28 12:23:04 -04:00
parent 86fc441d68
commit 568986b39f
2 changed files with 19 additions and 0 deletions

View File

@ -175,6 +175,7 @@ register(
register(
'AWX_ISOLATED_CHECK_INTERVAL',
field_class=fields.IntegerField,
min_value=0,
label=_('Isolated status check interval'),
help_text=_('The number of seconds to sleep between status checks for jobs running on isolated instances.'),
category=_('Jobs'),
@ -184,6 +185,7 @@ register(
register(
'AWX_ISOLATED_LAUNCH_TIMEOUT',
field_class=fields.IntegerField,
min_value=0,
label=_('Isolated launch timeout'),
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.'),
@ -194,6 +196,7 @@ register(
register(
'AWX_ISOLATED_CONNECTION_TIMEOUT',
field_class=fields.IntegerField,
min_value=0,
default=10,
label=_('Isolated connection timeout'),
help_text=_('Ansible SSH connection timeout (in seconds) to use when communicating with isolated instances. '

View File

@ -243,3 +243,19 @@ def test_logging_aggregrator_connection_test_invalid(mocker, get, post, admin):
'LOG_AGGREGATOR_PORT': 8080
}, user=admin, expect=500)
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