more isolated task execution tweaking

* set a more reasonable default `AWX_ISOLATED_CHECK_INTERVAL`
* make manual cancellation work for high values of
  `AWX_ISOLATED_CHECK_INTERVAL`
* remove the `/tmp/ansible_tower/jobs/` symlink directory

see: #6616
This commit is contained in:
Ryan Petrello
2017-06-16 11:18:01 -04:00
parent 44e0c8621a
commit 1ea03aa4c9
9 changed files with 36 additions and 37 deletions

View File

@@ -14,6 +14,8 @@ from Crypto import Random
from awx.main.isolated import run, isolated_manager
from django.conf import settings
HERE, FILENAME = os.path.split(__file__)
@@ -254,7 +256,7 @@ def test_check_isolated_job(private_data_dir, rsa_key):
run_pexpect.side_effect = _synchronize_job_artifacts
with mock.patch.object(mgr, '_missing_artifacts') as missing_artifacts:
missing_artifacts.return_value = False
status, rc = mgr.check()
status, rc = mgr.check(interval=0)
assert status == 'failed'
assert rc == 1
@@ -262,8 +264,8 @@ def test_check_isolated_job(private_data_dir, rsa_key):
run_pexpect.assert_called_with(
[
'ansible-playbook', '-u', 'root', '-i', 'isolated-host,',
'check_isolated.yml', '-e', '{"src": "%s", "job_id": "123"}' % private_data_dir,
'ansible-playbook', '-u', settings.AWX_ISOLATED_USERNAME, '-i', 'isolated-host,',
'check_isolated.yml', '-e', '{"src": "%s"}' % private_data_dir,
'-vvvvv'
],
'/tower_devel/awx/playbooks', mgr.env, mock.ANY,
@@ -294,7 +296,7 @@ def test_check_isolated_job_timeout(private_data_dir, rsa_key):
return ('failed', 1)
run_pexpect.side_effect = _synchronize_job_artifacts
status, rc = mgr.check()
status, rc = mgr.check(interval=0)
assert status == 'failed'
assert rc == 1

View File

@@ -11,6 +11,7 @@ import fcntl
import mock
import pytest
import yaml
from django.conf import settings
from awx.main.models import (
@@ -340,7 +341,7 @@ class TestIsolatedExecution(TestJobExecution):
playbook_run = self.run_pexpect.call_args_list[0][0]
assert ' '.join(playbook_run[0]).startswith(' '.join([
'ansible-playbook', '-u', 'root', '-i', self.REMOTE_HOST + ',',
'ansible-playbook', '-u', settings.AWX_ISOLATED_USERNAME, '-i', self.REMOTE_HOST + ',',
'run_isolated.yml', '-e',
]))
extra_vars = playbook_run[0][playbook_run[0].index('-e') + 1]
@@ -348,7 +349,6 @@ class TestIsolatedExecution(TestJobExecution):
assert extra_vars['dest'] == '/tmp'
assert extra_vars['src'] == private_data
assert extra_vars['proot_temp_dir'].startswith('/tmp/ansible_tower_proot_')
assert extra_vars['job_id'] == '1'
def test_systemctl_failure(self):
# If systemctl fails, read the contents of `artifacts/systemctl_logs`