AC-1076 Exposed scm_update_cache_timeout for projects, added needs_update_on_launch property to project and inventory source models.

This commit is contained in:
Chris Church
2014-03-26 16:40:52 -04:00
parent 3d0d75e897
commit d8383a4d69
4 changed files with 24 additions and 7 deletions

View File

@@ -297,6 +297,15 @@ class Project(UnifiedJobTemplate, ProjectOptions):
kwargs['scm_delete_on_update'] = True
return self._create_unified_job_instance(**kwargs)
@property
def needs_update_on_launch(self):
if self.active and self.scm_type and self.scm_update_on_launch:
if not self.last_job_run:
return True
if (self.last_job_run + datetime.timedelta(seconds=self.scm_update_cache_timeout)) <= now():
return True
return False
def update_signature(self, **kwargs):
if self.can_update:
project_update = self.create_project_update()