mirror of
https://github.com/ansible/awx.git
synced 2026-02-24 22:46:01 -03:30
Update settings location for certain values
* PROJECTS_ROOT * JOBOUTPUT_ROOT * SCHEDULE_MAX_JOBS * STDOUT_MAX_BYTES_DISPLAY
This commit is contained in:
@@ -52,6 +52,8 @@ class TowerSettings(CreatedModifiedModel):
|
||||
converted_type = self.value
|
||||
elif self.value_type == 'list':
|
||||
converted_type = [x.strip() for x in self.value.split(',')]
|
||||
elif self.value_type == 'bool':
|
||||
converted_type = self.value in [True, "true", "True", 1, "1", "yes"]
|
||||
else:
|
||||
t = __builtins__[self.value_type]
|
||||
converted_type = t(self.value)
|
||||
|
||||
@@ -24,6 +24,7 @@ from awx.main.models.unified_jobs import * # noqa
|
||||
from awx.main.utils import decrypt_field, ignore_inventory_computed_fields
|
||||
from awx.main.utils import emit_websocket_notification
|
||||
from awx.main.redact import PlainTextCleaner
|
||||
from awx.main.conf import tower_settings
|
||||
|
||||
logger = logging.getLogger('awx.main.models.jobs')
|
||||
|
||||
@@ -318,9 +319,9 @@ class JobTemplate(UnifiedJobTemplate, JobOptions):
|
||||
|
||||
@property
|
||||
def cache_timeout_blocked(self):
|
||||
if Job.objects.filter(job_template=self, status__in=['pending', 'waiting', 'running']).count() > getattr(settings, 'SCHEDULE_MAX_JOBS', 10):
|
||||
if Job.objects.filter(job_template=self, status__in=['pending', 'waiting', 'running']).count() > getattr(tower_settings, 'SCHEDULE_MAX_JOBS', 10):
|
||||
logger.error("Job template %s could not be started because there are more than %s other jobs from that template waiting to run" %
|
||||
(self.name, getattr(settings, 'SCHEDULE_MAX_JOBS', 10)))
|
||||
(self.name, getattr(tower_settings, 'SCHEDULE_MAX_JOBS', 10)))
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ from awx.main.models.base import * # noqa
|
||||
from awx.main.models.jobs import Job
|
||||
from awx.main.models.unified_jobs import * # noqa
|
||||
from awx.main.utils import update_scm_url
|
||||
from awx.main.conf import tower_settings
|
||||
|
||||
__all__ = ['Project', 'ProjectUpdate']
|
||||
|
||||
@@ -45,9 +46,9 @@ class ProjectOptions(models.Model):
|
||||
|
||||
@classmethod
|
||||
def get_local_path_choices(cls):
|
||||
if os.path.exists(settings.PROJECTS_ROOT):
|
||||
paths = [x.decode('utf-8') for x in os.listdir(settings.PROJECTS_ROOT)
|
||||
if (os.path.isdir(os.path.join(settings.PROJECTS_ROOT, x)) and
|
||||
if os.path.exists(tower_settings.PROJECTS_ROOT):
|
||||
paths = [x.decode('utf-8') for x in os.listdir(tower_settings.PROJECTS_ROOT)
|
||||
if (os.path.isdir(os.path.join(tower_settings.PROJECTS_ROOT, x)) and
|
||||
not x.startswith('.') and not x.startswith('_'))]
|
||||
qs = Project.objects.filter(active=True)
|
||||
used_paths = qs.values_list('local_path', flat=True)
|
||||
@@ -143,7 +144,7 @@ class ProjectOptions(models.Model):
|
||||
def get_project_path(self, check_if_exists=True):
|
||||
local_path = os.path.basename(self.local_path)
|
||||
if local_path and not local_path.startswith('.'):
|
||||
proj_path = os.path.join(settings.PROJECTS_ROOT, local_path)
|
||||
proj_path = os.path.join(tower_settings.PROJECTS_ROOT, local_path)
|
||||
if not check_if_exists or os.path.exists(smart_str(proj_path)):
|
||||
return proj_path
|
||||
|
||||
|
||||
Reference in New Issue
Block a user