mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-02 12:51:48 -05:00
Update settings location for certain values
* PROJECTS_ROOT * JOBOUTPUT_ROOT * SCHEDULE_MAX_JOBS * STDOUT_MAX_BYTES_DISPLAY
This commit is contained in:
@@ -20,6 +20,7 @@ from awx.main.utils import * # noqa
|
||||
from awx.main.models import * # noqa
|
||||
from awx.main.tests.base import BaseJobExecutionTest
|
||||
from awx.main.tests.tasks import TEST_SSH_KEY_DATA, TEST_SSH_KEY_DATA_LOCKED, TEST_SSH_KEY_DATA_UNLOCK
|
||||
from awx.main.conf import tower_settings
|
||||
|
||||
__all__ = ['RunAdHocCommandTest', 'AdHocCommandApiTest']
|
||||
|
||||
@@ -325,13 +326,13 @@ class RunAdHocCommandTest(BaseAdHocCommandTest):
|
||||
if not has_proot:
|
||||
self.skipTest('proot is not installed')
|
||||
# Enable proot for this test.
|
||||
settings.AWX_PROOT_ENABLED = True
|
||||
tower_settings.AWX_PROOT_ENABLED = True
|
||||
# Hide local settings path.
|
||||
settings.AWX_PROOT_HIDE_PATHS = [os.path.join(settings.BASE_DIR, 'settings')]
|
||||
tower_settings.AWX_PROOT_HIDE_PATHS = [os.path.join(settings.BASE_DIR, 'settings')]
|
||||
# Create list of paths that should not be visible to the command.
|
||||
hidden_paths = [
|
||||
os.path.join(settings.PROJECTS_ROOT, '*'),
|
||||
os.path.join(settings.JOBOUTPUT_ROOT, '*'),
|
||||
os.path.join(tower_settings.PROJECTS_ROOT, '*'),
|
||||
os.path.join(tower_settings.JOBOUTPUT_ROOT, '*'),
|
||||
]
|
||||
# Create a temp directory that should not be visible to the command.
|
||||
temp_path = tempfile.mkdtemp()
|
||||
|
||||
@@ -31,6 +31,7 @@ from awx.main.models import * # noqa
|
||||
from awx.main.management.commands.run_callback_receiver import CallbackReceiver
|
||||
from awx.main.management.commands.run_task_system import run_taskmanager
|
||||
from awx.main.utils import get_ansible_version
|
||||
from awx.main.conf import tower_settings
|
||||
from awx.main.task_engine import TaskEngager as LicenseWriter
|
||||
from awx.sso.backends import LDAPSettings
|
||||
|
||||
@@ -263,14 +264,14 @@ class BaseTestMixin(QueueTestMixin, MockCommonlySlowTestMixin):
|
||||
if not name:
|
||||
name = self.unique_name('Project')
|
||||
|
||||
if not os.path.exists(settings.PROJECTS_ROOT):
|
||||
os.makedirs(settings.PROJECTS_ROOT)
|
||||
if not os.path.exists(tower_settings.PROJECTS_ROOT):
|
||||
os.makedirs(tower_settings.PROJECTS_ROOT)
|
||||
# Create temp project directory.
|
||||
if unicode_prefix:
|
||||
tmp_prefix = u'\u2620tmp'
|
||||
else:
|
||||
tmp_prefix = 'tmp'
|
||||
project_dir = tempfile.mkdtemp(prefix=tmp_prefix, dir=settings.PROJECTS_ROOT)
|
||||
project_dir = tempfile.mkdtemp(prefix=tmp_prefix, dir=tower_settings.PROJECTS_ROOT)
|
||||
self._temp_paths.append(project_dir)
|
||||
# Create temp playbook in project (if playbook content is given).
|
||||
if playbook_content:
|
||||
|
||||
@@ -20,6 +20,7 @@ from django.utils.timezone import now
|
||||
|
||||
# AWX
|
||||
from awx.main.models import * # noqa
|
||||
from awx.main.conf import tower_settings
|
||||
from awx.main.tests.base import BaseTransactionTest
|
||||
from awx.main.tests.tasks import TEST_SSH_KEY_DATA, TEST_SSH_KEY_DATA_LOCKED, TEST_SSH_KEY_DATA_UNLOCK, TEST_OPENSSH_KEY_DATA, TEST_OPENSSH_KEY_DATA_LOCKED
|
||||
from awx.main.utils import decrypt_field, update_scm_url
|
||||
@@ -150,7 +151,7 @@ class ProjectsTest(BaseTransactionTest):
|
||||
url = reverse('api:api_v1_config_view')
|
||||
response = self.get(url, expect=200, auth=self.get_super_credentials())
|
||||
self.assertTrue('project_base_dir' in response)
|
||||
self.assertEqual(response['project_base_dir'], settings.PROJECTS_ROOT)
|
||||
self.assertEqual(response['project_base_dir'], tower_settings.PROJECTS_ROOT)
|
||||
self.assertTrue('project_local_paths' in response)
|
||||
self.assertEqual(set(response['project_local_paths']),
|
||||
set(Project.get_local_path_choices()))
|
||||
@@ -218,7 +219,7 @@ class ProjectsTest(BaseTransactionTest):
|
||||
self.assertEquals(results['count'], 0)
|
||||
|
||||
# can add projects (super user)
|
||||
project_dir = tempfile.mkdtemp(dir=settings.PROJECTS_ROOT)
|
||||
project_dir = tempfile.mkdtemp(dir=tower_settings.PROJECTS_ROOT)
|
||||
self._temp_paths.append(project_dir)
|
||||
project_data = {
|
||||
'name': 'My Test Project',
|
||||
|
||||
@@ -21,6 +21,7 @@ from crum import impersonate
|
||||
# AWX
|
||||
from awx.main.utils import * # noqa
|
||||
from awx.main.models import * # noqa
|
||||
from awx.main.conf import tower_settings
|
||||
from awx.main.tests.base import BaseJobExecutionTest
|
||||
|
||||
TEST_PLAYBOOK = u'''
|
||||
@@ -1412,8 +1413,8 @@ class RunJobTest(BaseJobExecutionTest):
|
||||
project_path = self.project.local_path
|
||||
job_template = self.create_test_job_template()
|
||||
extra_vars = {
|
||||
'projects_root': settings.PROJECTS_ROOT,
|
||||
'joboutput_root': settings.JOBOUTPUT_ROOT,
|
||||
'projects_root': tower_settings.PROJECTS_ROOT,
|
||||
'joboutput_root': tower_settings.JOBOUTPUT_ROOT,
|
||||
'project_path': project_path,
|
||||
'other_project_path': other_project_path,
|
||||
'temp_path': temp_path,
|
||||
|
||||
Reference in New Issue
Block a user