Update settings location for certain values

* PROJECTS_ROOT
* JOBOUTPUT_ROOT
* SCHEDULE_MAX_JOBS
* STDOUT_MAX_BYTES_DISPLAY
This commit is contained in:
Matthew Jones
2015-12-15 15:14:16 -05:00
parent 16aa34522c
commit e97e60bd30
11 changed files with 50 additions and 37 deletions

View File

@@ -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