mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
AC-1158 Fix project to set delete on next update.
This commit is contained in:
@@ -292,9 +292,12 @@ class Project(UnifiedJobTemplate, ProjectOptions):
|
|||||||
def _can_update(self):
|
def _can_update(self):
|
||||||
return bool(self.scm_type)
|
return bool(self.scm_type)
|
||||||
|
|
||||||
def create_project_update(self, **kwargs):
|
def _update_unified_job_kwargs(self, **kwargs):
|
||||||
if self.scm_delete_on_next_update:
|
if self.scm_delete_on_next_update:
|
||||||
kwargs['scm_delete_on_update'] = True
|
kwargs['scm_delete_on_update'] = True
|
||||||
|
return kwargs
|
||||||
|
|
||||||
|
def create_project_update(self, **kwargs):
|
||||||
return self.create_unified_job(**kwargs)
|
return self.create_unified_job(**kwargs)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
@@ -254,6 +254,12 @@ class UnifiedJobTemplate(PolymorphicModel, CommonModelNameNotUnique):
|
|||||||
'''
|
'''
|
||||||
raise NotImplementedError # Implement in subclass.
|
raise NotImplementedError # Implement in subclass.
|
||||||
|
|
||||||
|
def _update_unified_job_kwargs(self, **kwargs):
|
||||||
|
'''
|
||||||
|
Hook for subclasses to update kwargs.
|
||||||
|
'''
|
||||||
|
return kwargs # Override if needed in subclass.
|
||||||
|
|
||||||
def create_unified_job(self, **kwargs):
|
def create_unified_job(self, **kwargs):
|
||||||
'''
|
'''
|
||||||
Create a new unified job based on this unified job template.
|
Create a new unified job based on this unified job template.
|
||||||
@@ -270,6 +276,7 @@ class UnifiedJobTemplate(PolymorphicModel, CommonModelNameNotUnique):
|
|||||||
if hasattr(self, '%s_id' % field_name) and ('%s_id' % field_name) in kwargs:
|
if hasattr(self, '%s_id' % field_name) and ('%s_id' % field_name) in kwargs:
|
||||||
continue
|
continue
|
||||||
kwargs[field_name] = getattr(self, field_name)
|
kwargs[field_name] = getattr(self, field_name)
|
||||||
|
kwargs = self._update_unified_job_kwargs(**kwargs)
|
||||||
unified_job = unified_job_class(**kwargs)
|
unified_job = unified_job_class(**kwargs)
|
||||||
if save_unified_job:
|
if save_unified_job:
|
||||||
unified_job.save()
|
unified_job.save()
|
||||||
|
|||||||
Reference in New Issue
Block a user